diff --git a/pom.xml b/pom.xml index cfc72fd8..35d72bce 100644 --- a/pom.xml +++ b/pom.xml @@ -24,20 +24,21 @@ limitations under the License. plexus-xml - 4.0.0 + 4.0.2 Plexus XML Utilities A collection of various utility classes to ease working with XML. + https://codehaus-plexus.github.io/plexus-xml/ scm:git:https://github.com/codehaus-plexus/plexus-xml.git ${project.scm.connection} - plexus-xml-4.0.0 - https://github.com/codehaus-plexus/plexus-xml/tree/master/ + plexus-xml-4.0.2 + https://github.com/codehaus-plexus/plexus-xml/tree/${project.scm.tag}/ github - http://github.com/codehaus-plexus/plexus-xml/issues + https://github.com/codehaus-plexus/plexus-xml/issues @@ -47,14 +48,20 @@ limitations under the License. - 2023-05-22T15:08:22Z + 2023-07-04T08:14:13Z org.apache.maven maven-xml-impl - 4.0.0-alpha-5 + 4.0.0-alpha-7 + + + org.eclipse.sisu + org.eclipse.sisu.plexus + + org.openjdk.jmh @@ -71,72 +78,24 @@ limitations under the License. org.junit.jupiter junit-jupiter - 5.9.2 + test + + + org.hamcrest + hamcrest + 2.2 + test + + + org.codehaus.plexus + plexus-utils + 4.0.0 test - - - - org.apache.maven.plugins - maven-enforcer-plugin - 3.3.0 - - - org.apache.maven.plugins - maven-resources-plugin - 3.3.1 - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0 - - - org.apache.maven.plugins - maven-compiler-plugin - 3.11.0 - - - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-maven - - enforce - - - - - 3.2.5 - This project requires at least Maven 3.2.5 - - - - - - - - maven-compiler-plugin - - - default-compile - - compile - - - 1.8 - 1.8 - - - - org.apache.maven.plugins maven-scm-publish-plugin @@ -161,47 +120,8 @@ limitations under the License. true - - - JAVA_HOME - ${JAVA_HOME} - - - M2_HOME - ${M2_HOME} - - - - - - jdk9+ - - [9,) - - - - - - maven-compiler-plugin - - - compile-java-9 - - compile - - - 8 - - - - - - - - - diff --git a/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomUtils.java b/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomUtils.java index b4475f61..d8a47e53 100644 --- a/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomUtils.java +++ b/src/main/java/org/codehaus/plexus/util/xml/Xpp3DomUtils.java @@ -125,7 +125,7 @@ public static Xpp3Dom mergeXpp3Dom(Xpp3Dom dominant, Xpp3Dom recessive) { } /** - * @deprecated Use {@link org.codehaus.plexus.util.StringUtils#isNotEmpty(String)} instead + * @deprecated Use org.codehaus.plexus.util.StringUtils#isNotEmpty(String) instead */ @Deprecated public static boolean isNotEmpty(String str) { @@ -133,7 +133,7 @@ public static boolean isNotEmpty(String str) { } /** - * @deprecated Use {@link org.codehaus.plexus.util.StringUtils#isEmpty(String)} instead + * @deprecated Use org.codehaus.plexus.util.StringUtils#isEmpty(String) instead */ @Deprecated public static boolean isEmpty(String str) { diff --git a/src/main/java/org/codehaus/plexus/util/xml/pull/MXParser.java b/src/main/java/org/codehaus/plexus/util/xml/pull/MXParser.java index 9f4396bc..63fffedd 100644 --- a/src/main/java/org/codehaus/plexus/util/xml/pull/MXParser.java +++ b/src/main/java/org/codehaus/plexus/util/xml/pull/MXParser.java @@ -2528,9 +2528,11 @@ private void parsePI() throws XmlPullParserException, IOException { if ((buf[piTargetStart] == 'x' || buf[piTargetStart] == 'X') && (buf[piTargetStart + 1] == 'm' || buf[piTargetStart + 1] == 'M') && (buf[piTargetStart + 2] == 'l' || buf[piTargetStart + 2] == 'L')) { - if (piTargetStart > 3) { // 2) { // + + + + + diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/MXParserTest.java b/src/test/java/org/codehaus/plexus/util/xml/pull/MXParserTest.java index 8c3fd284..f7c9d68c 100644 --- a/src/test/java/org/codehaus/plexus/util/xml/pull/MXParserTest.java +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/MXParserTest.java @@ -30,7 +30,11 @@ import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.xml.XmlStreamReader; import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import static org.hamcrest.MatcherAssert.*; +import static org.hamcrest.Matchers.*; import static org.junit.jupiter.api.Assertions.*; /** @@ -1473,4 +1477,22 @@ public void testProcessingInstructionTokenizeAfterXMLDeclAndBeforeFirstTag() thr assertEquals(XmlPullParser.END_TAG, parser.nextToken()); assertEquals(XmlPullParser.END_DOCUMENT, parser.nextToken()); } + + @ParameterizedTest + @ValueSource(strings = {" ", "\n", "\r", "\r\n", " ", "\n "}) + void testBlankAtBeginning(String ws) throws XmlPullParserException, IOException { + String xml = "nnn"; + + MXParser parser = new MXParser(); + parser.setInput(new StringReader(ws + xml)); + assertThat( + assertThrows(XmlPullParserException.class, parser::next).getMessage(), + containsString("XMLDecl is only allowed as first characters in input")); + + parser.setInput(new StringReader(ws + xml)); + assertEquals(XmlPullParser.IGNORABLE_WHITESPACE, parser.nextToken()); + assertThat( + assertThrows(XmlPullParserException.class, parser::nextToken).getMessage(), + containsString("processing instruction can not have PITarget with reserved xml name")); + } }