I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Unverified Commit 3d71a540 authored by zzz's avatar zzz
Browse files

Util: Fix check for illegal chars in storeProps()

parent 37beb532
No related branches found
No related tags found
No related merge requests found
......@@ -110,8 +110,8 @@ public class DataHelper {
}
}
private static final Pattern ILLEGAL_KEY = Pattern.compile("[#=\r\n;]");
private static final Pattern ILLEGAL_VALUE = Pattern.compile("[#\r\n]");
private static final Pattern ILLEGAL_KEY = Pattern.compile("[#=\\r\\n;]");
private static final Pattern ILLEGAL_VALUE = Pattern.compile("[#\\r\\n]");
/**
* The default formatting for date/time, current locale, local time zone
......@@ -535,13 +535,13 @@ public class DataHelper {
for (Map.Entry<Object, Object> entry : props.entrySet()) {
String name = (String) entry.getKey();
String val = (String) entry.getValue();
if (ILLEGAL_KEY.matcher(name).matches()) {
if (ILLEGAL_KEY.matcher(name).find()) {
if (iae == null)
iae = new IllegalArgumentException("Invalid character (one of \"#;=\\r\\n\") in key: \"" +
name + "\" = \"" + val + '\"');
continue;
}
if (ILLEGAL_VALUE.matcher(val).matches()) {
if (ILLEGAL_VALUE.matcher(val).find()) {
if (iae == null)
iae = new IllegalArgumentException("Invalid character (one of \"#\\r\\n\") in value: \"" +
name + "\" = \"" + val + '\"');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment