SAM: Allow backslash escapes in parser (tickets #1325, #1488)

remove unneeded escape char in other parsers
This commit is contained in:
zzz
2015-11-28 18:53:40 +00:00
parent 87fa1cb1ac
commit dffd441304
3 changed files with 10 additions and 4 deletions

View File

@ -180,10 +180,10 @@ class SAMUtils {
* PING any thing goes
* PONG any thing goes
*
* No escaping of '"' or anything else is allowed or defined
* Escaping is allowed with a backslash, e.g. \"
* No spaces before or after '=' allowed
* Keys may not be quoted
* COMMAND and OPCODE may not have '='
* COMMAND, OPCODE, and keys may not have '=' or whitespace unless escaped
* Duplicate keys not allowed
*</pre>
*
@ -274,6 +274,12 @@ class SAMUtils {
}
break;
case '\\':
if (++i >= length)
throw new SAMException("Unterminated escape");
c = args.charAt(i);
// fall through...
default:
buf.append(c);
break;

View File

@ -1520,7 +1520,7 @@ public class EepGet {
String key = null;
for (int i = 0; i < data.length; i++) {
switch (data[i]) {
case '\"':
case '"':
if (isQuoted) {
// keys never quoted
if (key != null) {

View File

@ -123,7 +123,7 @@ public class LoadClientAppsJob extends JobImpl {
for (int i = 0; i < data.length; i++) {
switch (data[i]) {
case '\'':
case '\"':
case '"':
if (isQuoted) {
String str = buf.toString().trim();
if (str.length() > 0)