summaryrefslogtreecommitdiff
path: root/tools/gnu/classpath
diff options
context:
space:
mode:
authorTania Bento <tbento@redhat.com>2006-11-29 20:48:29 +0000
committerTania Bento <tbento@redhat.com>2006-11-29 20:48:29 +0000
commitc3d922c8516a15538552865bb95c2ff8156a39dd (patch)
tree7e6dbc9502ab10b5b395cb4d8676e49726d325d9 /tools/gnu/classpath
parent6c189d4de1468725eafb38b187bfd0aa3eeb8bc2 (diff)
downloadclasspath-c3d922c8516a15538552865bb95c2ff8156a39dd.tar.gz
2006-11-29 Tania Bento <tbento@redhat.com>generics-merge-20061129
* tools/gnu/classpath/tools/appletviewer/TagParser.java: (parseParams): Unescape 'val' before putting it into the Map. (unescapeString): New private method.
Diffstat (limited to 'tools/gnu/classpath')
-rw-r--r--tools/gnu/classpath/tools/appletviewer/TagParser.java56
1 files changed, 55 insertions, 1 deletions
diff --git a/tools/gnu/classpath/tools/appletviewer/TagParser.java b/tools/gnu/classpath/tools/appletviewer/TagParser.java
index 68dce97e0..b5bdca70f 100644
--- a/tools/gnu/classpath/tools/appletviewer/TagParser.java
+++ b/tools/gnu/classpath/tools/appletviewer/TagParser.java
@@ -230,12 +230,66 @@ public class TagParser
t.archives = parseArchives(val, t);
val = t.archives.toString();
}
-
+ val = unescapeString(val);
t.parameters.put(key.toLowerCase(), val);
}
}
/**
+ * This method does the same thing as the g_strcompress function in glib.
+ *
+ * @param value
+ * @return value in its original one-byte equivalence.
+ */
+ private static String unescapeString(String value)
+ {
+ String unescVal = "";
+ for (int i = 0; i < value.length(); i++)
+ {
+ if (i == value.length() - 1)
+ {
+ unescVal = unescVal.concat(value.substring(i));
+ break;
+ }
+ if (value.charAt(i) == '\\')
+ {
+ switch (value.charAt(i + 1))
+ {
+ case 'b':
+ unescVal = unescVal.concat("\b");
+ break;
+ case 'f':
+ unescVal = unescVal.concat("\f");
+ break;
+ case 'n':
+ unescVal = unescVal.concat("\n");
+ break;
+ case 'r':
+ unescVal = unescVal.concat("\r");
+ break;
+ case 't':
+ unescVal = unescVal.concat("\t");
+ break;
+ case '\\':
+ unescVal = unescVal.concat("\\");
+ break;
+ case '\"':
+ unescVal = unescVal.concat("\"");
+ break;
+ default:
+ unescVal = unescVal.concat("\\");
+ unescVal = unescVal.concat(value.substring(i + 1, i + 2));
+ break;
+ }
+ i++;
+ }
+ else
+ unescVal = unescVal.concat(value.substring(i, i + 1));
+ }
+ return unescVal;
+ }
+
+ /**
* Parses the archive string and returns a list.
*
* @param the list of archives (comma-separated) in a String.