mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
Handle bad key-value pairs in URL by ignoring
git-svn-id: https://zxing.googlecode.com/svn/trunk@2283 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
4a907a6201
commit
b73efdfba1
|
@ -178,18 +178,19 @@ public abstract class ResultParser {
|
|||
return result;
|
||||
}
|
||||
|
||||
private static void appendKeyValue(CharSequence keyValue,
|
||||
Map<String,String> result) {
|
||||
private static void appendKeyValue(CharSequence keyValue, Map<String,String> result) {
|
||||
String[] keyValueTokens = EQUALS.split(keyValue, 2);
|
||||
if (keyValueTokens.length == 2) {
|
||||
String key = keyValueTokens[0];
|
||||
String value = keyValueTokens[1];
|
||||
try {
|
||||
value = URLDecoder.decode(value, "UTF-8");
|
||||
result.put(key, value);
|
||||
} catch (UnsupportedEncodingException uee) {
|
||||
throw new IllegalStateException(uee); // can't happen
|
||||
} catch (IllegalArgumentException iae) {
|
||||
// continue; invalid data such as an escape like %0t
|
||||
}
|
||||
result.put(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue