This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new d9a49e6ff7 [MNG-7965] Fix duplicate tags not rejected (#1344)
d9a49e6ff7 is described below

commit d9a49e6ff73fa925bc7ef59d0da205b1ef361877
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Dec 15 07:33:11 2023 +0100

    [MNG-7965] Fix duplicate tags not rejected (#1344)
---
 src/mdo/reader-stax.vm | 4 ++++
 src/mdo/reader.vm      | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/src/mdo/reader-stax.vm b/src/mdo/reader-stax.vm
index f4b5f03d93..f53ca01396 100644
--- a/src/mdo/reader-stax.vm
+++ b/src/mdo/reader-stax.vm
@@ -761,6 +761,10 @@ public class ${className} {
                 throw new XMLStreamException("Duplicated tag: '" + tagName + 
"'", parser.getLocation(), null);
             }
         }
+#else
+        if (!parsed.add(tagName)) {
+            throw new XMLStreamException("Duplicated tag: '" + tagName + "'", 
parser.getLocation(), null);
+        }
 #end
         return tagName;
     }
diff --git a/src/mdo/reader.vm b/src/mdo/reader.vm
index 652a78c53a..1b7e8a3a7b 100644
--- a/src/mdo/reader.vm
+++ b/src/mdo/reader.vm
@@ -613,6 +613,7 @@ public class ${className} {
   #foreach( $entry in $aliases.entrySet() )
             case "${entry.key}":
                 tagName = "${entry.value}";
+                break;
   #end
         }
 #end
@@ -627,6 +628,10 @@ public class ${className} {
                     throw new XMLStreamException("Duplicated tag: '" + tagName 
+ "'", parser.getLocation(), null);
                 }
         }
+#else
+        if (!parsed.add(tagName)) {
+            throw new XMLStreamException("Duplicated tag: '" + tagName + "'", 
parser.getLocation(), null);
+        }
 #end
         return tagName;
     }

Reply via email to