summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-06-12 11:53:56 (EDT)
committer pelder2006-06-12 11:53:56 (EDT)
commitc803cfc5f30416dee2a04efb8f1dc5da14452f25 (patch)
tree8275c64e04806c31a98e11963ceb6998897fc883
parentac474f1d44bf6e90fe14147d7da5c7f027680c79 (diff)
downloadorg.eclipse.jet-c803cfc5f30416dee2a04efb8f1dc5da14452f25.zip
org.eclipse.jet-c803cfc5f30416dee2a04efb8f1dc5da14452f25.tar.gz
org.eclipse.jet-c803cfc5f30416dee2a04efb8f1dc5da14452f25.tar.bz2
[146335] Ensure attribute values are properly escaped in generated Java code.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java3
-rw-r--r--plugins/org.eclipse.jet/templates/tagDataDeclarations.jet3
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java
index b0f41d9..32763d8 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/compiler/templates/TagDataDeclGenerator.java
@@ -5,6 +5,7 @@ import org.eclipse.jet.JET2Template;
import org.eclipse.jet.JET2Writer;
import java.util.Iterator;
import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.internal.JavaUtil;
import org.eclipse.jet.compiler.XMLElement;
import org.eclipse.jet.internal.compiler.MethodBodyCreator;
@@ -41,7 +42,7 @@ public class TagDataDeclGenerator implements JET2Template {
} out.write( " },\r\n new String[] {\r\n" ); //$NON-NLS-1$
for (Iterator i = element.getAttributes().values().iterator(); i.hasNext();) {
String attrValue = (String) i.next(); out.write( " \"" ); //$NON-NLS-1$
- out.write( attrValue );
+ out.write( JavaUtil.escapeJavaString(attrValue.toCharArray()) );
out.write( "\", //$NON-NLS-1$\r\n" ); //$NON-NLS-1$
} out.write( " } );\r\n" ); //$NON-NLS-1$
diff --git a/plugins/org.eclipse.jet/templates/tagDataDeclarations.jet b/plugins/org.eclipse.jet/templates/tagDataDeclarations.jet
index 8bc1eab..fb1471f 100644
--- a/plugins/org.eclipse.jet/templates/tagDataDeclarations.jet
+++ b/plugins/org.eclipse.jet/templates/tagDataDeclarations.jet
@@ -1,6 +1,7 @@
<%@jet class="TagDataDeclGenerator"%>
<%@jet imports="java.util.Iterator"%>
<%@jet imports="org.eclipse.jet.taglib.JET2TagException"%>
+<%@jet imports="org.eclipse.jet.internal.JavaUtil"%>
<%@jet imports="org.eclipse.jet.compiler.XMLElement"%>
<%@jet imports="org.eclipse.jet.internal.compiler.MethodBodyCreator"%>
<%
@@ -25,6 +26,6 @@
new String[] {
<% for (Iterator i = element.getAttributes().values().iterator(); i.hasNext();) {
String attrValue = (String) i.next(); %>
- "<%= attrValue %>", //$NON-NLS-1$
+ "<%= JavaUtil.escapeJavaString(attrValue.toCharArray()) %>", //$NON-NLS-1$
<% } %>
} );