diff options
author | Alena Laskavaia | 2009-05-19 15:34:40 +0000 |
---|---|---|
committer | Alena Laskavaia | 2009-05-19 15:34:40 +0000 |
commit | 593cd79862ce7b206929f86552d5fbff878f892e (patch) | |
tree | 4385d753e29c95877e65ec3c9504e82329f55f33 | |
parent | 57756dcb6c5f31cf25073499c88d1d8b9cb6b23e (diff) | |
download | org.eclipse.cdt-593cd79862ce7b206929f86552d5fbff878f892e.tar.gz org.eclipse.cdt-593cd79862ce7b206929f86552d5fbff878f892e.tar.xz org.eclipse.cdt-593cd79862ce7b206929f86552d5fbff878f892e.zip |
[255946] - fixing escaping for MI output, patch applied kind of
-rw-r--r-- | debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java index dbb778bc151..1565077be8f 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIParser.java @@ -237,11 +237,7 @@ public class MIParser { stream = new MILogStreamOutput(); break; } - // translateCString() assumes that the leading " is deleted - if (buffer.length() > 0 && buffer.charAt(0) == '"') { - buffer.deleteCharAt(0); - } - stream.setCString(translateCString(new FSB(buffer))); + stream.setCString(removeSurroundingDoubleQuotes(buffer.toString())); oob = stream; } else { // Badly format MI line, just pass it to the user as target stream @@ -252,9 +248,22 @@ public class MIParser { return oob; } + private String removeSurroundingDoubleQuotes(String str) { + String s = str; + // remove leading double quote + if (s.startsWith("\"")) { //$NON-NLS-1$ + s = s.substring(1); + } + // remove trailing double quote + if (s.endsWith("\"")) { //$NON-NLS-1$ + s = s.substring(0, s.length() - 1); + } + return s; + } + /** * Assuming that the usual leading comma was consumed. - * Extract the MI Result comma seperated responses. + * Extract the MI Result comma separated responses. */ private MIResult[] processMIResults(FSB buffer) { List aList = new ArrayList(); @@ -389,12 +398,12 @@ public class MIParser { } /* - * MI C-String rather MICOnst values are enclose in double quotes + * MI C-String rather MIConst values are enclose in double quotes * and any double quotes or backslash in the string are escaped. * Assuming the starting double quote was removed. * This method will stop at the closing double quote remove the extra - * backslach escaping and return the string __without__ the enclosing double quotes - * The orignal StringBuffer will move forward. + * backslash escaping and return the string __without__ the enclosing double quotes + * The original StringBuffer will move forward. */ private String translateCString(FSB buffer) { boolean escape = false; |