glongman 2005/07/22 19:42:52
Modified: junit/src/org/apache/tapestry/junit/parse Tag: branch-3-0
TestTemplateParser.java
framework/src/org/apache/tapestry/parse Tag: branch-3-0
TemplateParser.java
framework/src/org/apache/tapestry Tag: branch-3-0
TapestryStrings.properties
Added: junit/src/org/apache/tapestry/junit/parse Tag: branch-3-0
DuplicateTagAttribute.html
Log:
fixed - TemplateParser silently discards tag attributes if there are
duplicates.
Encountering this case causes the TemplateParser to throw an exception.
PR: (TAPESTRY-431)
Revision Changes Path
No revision
No revision
1.14.2.1 +6 -1
jakarta-tapestry/junit/src/org/apache/tapestry/junit/parse/Attic/TestTemplateParser.java
Index: TestTemplateParser.java
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/parse/Attic/TestTemplateParser.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -r1.14 -r1.14.2.1
--- TestTemplateParser.java 19 Feb 2004 17:37:44 -0000 1.14
+++ TestTemplateParser.java 23 Jul 2005 02:42:51 -0000 1.14.2.1
@@ -335,6 +335,11 @@
{
runFailure("UnterminatedComment.html", "Comment on line 3 did not
end.");
}
+
+ public void testDuplicateTagAttributeFailure()
+ {
+ runFailure("DuplicateTagAttribute.html", "Tag <input> on line 3
contains more than one 'value' attribute.");
+ }
public void testUnclosedOpenTagFailure()
{
No revision
Index: TestTemplateParser.java
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/parse/Attic/TestTemplateParser.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -r1.14 -r1.14.2.1
--- TestTemplateParser.java 19 Feb 2004 17:37:44 -0000 1.14
+++ TestTemplateParser.java 23 Jul 2005 02:42:51 -0000 1.14.2.1
@@ -335,6 +335,11 @@
{
runFailure("UnterminatedComment.html", "Comment on line 3 did not
end.");
}
+
+ public void testDuplicateTagAttributeFailure()
+ {
+ runFailure("DuplicateTagAttribute.html", "Tag <input> on line 3
contains more than one 'value' attribute.");
+ }
public void testUnclosedOpenTagFailure()
{
No revision
Index: TestTemplateParser.java
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/parse/Attic/TestTemplateParser.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -r1.14 -r1.14.2.1
--- TestTemplateParser.java 19 Feb 2004 17:37:44 -0000 1.14
+++ TestTemplateParser.java 23 Jul 2005 02:42:51 -0000 1.14.2.1
@@ -335,6 +335,11 @@
{
runFailure("UnterminatedComment.html", "Comment on line 3 did not
end.");
}
+
+ public void testDuplicateTagAttributeFailure()
+ {
+ runFailure("DuplicateTagAttribute.html", "Tag <input> on line 3
contains more than one 'value' attribute.");
+ }
public void testUnclosedOpenTagFailure()
{
1.1.2.1 +13 -0
jakarta-tapestry/junit/src/org/apache/tapestry/junit/parse/Attic/DuplicateTagAttribute.html
No revision
No revision
1.20.2.1 +16 -3
jakarta-tapestry/framework/src/org/apache/tapestry/parse/Attic/TemplateParser.java
Index: TemplateParser.java
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/Attic/TemplateParser.java,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -u -r1.20 -r1.20.2.1
--- TemplateParser.java 3 Mar 2004 20:16:28 -0000 1.20
+++ TemplateParser.java 23 Jul 2005 02:42:52 -0000 1.20.2.1
@@ -848,9 +848,22 @@
{
String attributeValue =
new String(_templateData, attributeValueStart,
_cursor - attributeValueStart);
-
- _attributes.put(attributeName, attributeValue);
+
+
attributeEndEvent(_cursor);
+
+ if (_attributes.containsKey(attributeName))
+ templateParseProblem(
+ Tapestry.format(
+
"TemplateParser.duplicate-tag-attribute",
+ tagName,
+ Integer.toString(_line),
+ attributeName),
+ getCurrentLocation(),
+ _line,
+ _cursor);
+
+ _attributes.put(attributeName, attributeValue);
// Advance over the quote.
advance();
No revision
No revision
1.41.2.2 +2 -1
jakarta-tapestry/framework/src/org/apache/tapestry/Attic/TapestryStrings.properties
Index: TapestryStrings.properties
===================================================================
RCS file:
/home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/Attic/TapestryStrings.properties,v
retrieving revision 1.41.2.1
retrieving revision 1.41.2.2
diff -u -r1.41.2.1 -r1.41.2.2
--- TapestryStrings.properties 17 Mar 2005 08:14:54 -0000 1.41.2.1
+++ TapestryStrings.properties 23 Jul 2005 02:42:52 -0000 1.41.2.2
@@ -355,6 +355,7 @@
TemplateParser.improperly-nested-close-tag=Closing tag </{0}> on line {1} is
improperly nested with tag <{2}> on line {3}.
TemplateParser.unmatched-close-tag=Closing tag </{0}> on line {1} does not
have a matching open tag.
TemplateParser.component-id-invalid=Tag <{0}> on line {1} contains an
invalid jwcid ''{2}''.
+TemplateParser.duplicate-tag-attribute=Tag <{0}> on line {1} contains more
than one ''{2}'' attribute.
TextToken.range-error={0}: out of range for template length {1}.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]