mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (4.3/Cloud)
73684: Merged V4.2-BUG-FIX (4.2.3) to HEAD-BUG-FIX (4.3/Cloud) 73483: Merged DEV to V4.2-BUG-FIX (4.2.3) 72998 : MNT-11359 : Cmis operations randomly fail with internal server error - Create CharsetDecoder on demand git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@74799 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -27,6 +27,7 @@ import java.nio.charset.CharsetDecoder;
|
|||||||
import java.nio.charset.CodingErrorAction;
|
import java.nio.charset.CodingErrorAction;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -67,28 +68,23 @@ public class AuthenticationFilter extends BaseAuthenticationFilter implements De
|
|||||||
private static final String PPT_EXTN = ".ppt";
|
private static final String PPT_EXTN = ".ppt";
|
||||||
|
|
||||||
/** The password encodings to try in priority order **/
|
/** The password encodings to try in priority order **/
|
||||||
private static final String[] ENCODINGS = new String[] {
|
private static final String[] ENCODINGS;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
String[] encodings = new String[] {
|
||||||
"UTF-8",
|
"UTF-8",
|
||||||
System.getProperty("file.encoding"),
|
System.getProperty("file.encoding"),
|
||||||
"ISO-8859-1"
|
"ISO-8859-1"
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Corresponding array of CharsetDecoders with CodingErrorAction.REPORT. Duplicates removed. */
|
Set<String> encodingsSet = new LinkedHashSet<String>();
|
||||||
private static final CharsetDecoder[] DECODERS;
|
for (String encoding : encodings)
|
||||||
|
|
||||||
static
|
|
||||||
{
|
{
|
||||||
Map<String, CharsetDecoder> decoders = new LinkedHashMap<String, CharsetDecoder>(ENCODINGS.length * 2);
|
encodingsSet.add(encoding);
|
||||||
for (String encoding : ENCODINGS)
|
|
||||||
{
|
|
||||||
if (!decoders.containsKey(encoding))
|
|
||||||
{
|
|
||||||
decoders.put(encoding, Charset.forName(encoding).newDecoder()
|
|
||||||
.onMalformedInput(CodingErrorAction.REPORT));
|
|
||||||
}
|
}
|
||||||
}
|
ENCODINGS = new String[encodingsSet.size()];
|
||||||
DECODERS = new CharsetDecoder[decoders.size()];
|
encodingsSet.toArray(ENCODINGS);
|
||||||
decoders.values().toArray(DECODERS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Various services required by NTLM authenticator
|
// Various services required by NTLM authenticator
|
||||||
@@ -132,9 +128,11 @@ public class AuthenticationFilter extends BaseAuthenticationFilter implements De
|
|||||||
byte[] encodedString = Base64.decodeBase64(authHdr.substring(5).getBytes());
|
byte[] encodedString = Base64.decodeBase64(authHdr.substring(5).getBytes());
|
||||||
|
|
||||||
// ALF-13621: Due to browser inconsistencies we have to try a fallback path of encodings
|
// ALF-13621: Due to browser inconsistencies we have to try a fallback path of encodings
|
||||||
Set<String> attemptedAuths = new HashSet<String>(DECODERS.length * 2);
|
Set<String> attemptedAuths = new HashSet<String>(ENCODINGS.length * 2);
|
||||||
for (CharsetDecoder decoder : DECODERS)
|
for (String encoding : ENCODINGS)
|
||||||
{
|
{
|
||||||
|
CharsetDecoder decoder = Charset.forName(encoding).newDecoder()
|
||||||
|
.onMalformedInput(CodingErrorAction.REPORT);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Attempt to decode using this charset
|
// Attempt to decode using this charset
|
||||||
|
Reference in New Issue
Block a user