Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2008-04-14 15:53:37 -0400
committerpelder2008-04-14 15:53:37 -0400
commit400cacbae1e11f77db2c9193d93e72a18a12d8c8 (patch)
tree74194c5ead772ebb1de69fd034f3a9a008110caa
parentd9781c8b59158d109fffe69d37e93138b8466243 (diff)
downloadorg.eclipse.jet-400cacbae1e11f77db2c9193d93e72a18a12d8c8.tar.gz
org.eclipse.jet-400cacbae1e11f77db2c9193d93e72a18a12d8c8.tar.xz
org.eclipse.jet-400cacbae1e11f77db2c9193d93e72a18a12d8c8.zip
[206469] Escape character (\) in tag attribute values not correctly processed
-rw-r--r--plugins/org.eclipse.jet.core/src/org/eclipse/jet/internal/core/parser/jasper/XMLElementDelegate.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/plugins/org.eclipse.jet.core/src/org/eclipse/jet/internal/core/parser/jasper/XMLElementDelegate.java b/plugins/org.eclipse.jet.core/src/org/eclipse/jet/internal/core/parser/jasper/XMLElementDelegate.java
index 2b6b2e8..a4cb126 100644
--- a/plugins/org.eclipse.jet.core/src/org/eclipse/jet/internal/core/parser/jasper/XMLElementDelegate.java
+++ b/plugins/org.eclipse.jet.core/src/org/eclipse/jet/internal/core/parser/jasper/XMLElementDelegate.java
@@ -10,12 +10,14 @@
*
* </copyright>
*
- * $Id: XMLElementDelegate.java,v 1.2 2007/04/12 18:02:43 pelder Exp $
+ * $Id: XMLElementDelegate.java,v 1.3 2008/04/14 19:53:37 pelder Exp $
* /
*******************************************************************************/
package org.eclipse.jet.internal.core.parser.jasper;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -118,7 +120,7 @@ public class XMLElementDelegate implements JETCoreElement
}
else
{
- attributeMap.put(name, value.substring(1, value.length() - 1));
+ attributeMap.put(name, unescape(value.substring(1, value.length() - 1)));
}
reader.skipSpaces();
}
@@ -164,4 +166,25 @@ public class XMLElementDelegate implements JETCoreElement
return true;
}
+ /**
+ * Remove any escape characters
+ * @param rawString
+ * @return
+ */
+ private String unescape(String rawString) {
+ StringBuffer result = new StringBuffer(rawString.length());
+ for(StringCharacterIterator i = new StringCharacterIterator(rawString); i.current() != CharacterIterator.DONE; i.next()) {
+ char c = i.current();
+ if(c != '\\') {
+ result.append(c);
+ } else {
+ c = i.next();
+ if(c != CharacterIterator.DONE) {
+ result.append(c);
+ }
+ }
+ }
+ return result.toString();
+ }
+
}

Back to the top