From 038699200e6beaa3dbd0c169600ca263f7670b2e Mon Sep 17 00:00:00 2001 From: Gabriel Belingueres Date: Sat, 23 Jan 2021 17:49:16 -0300 Subject: [PATCH] Fix MXParser fails to recognize illegal character references (#132) --- .../plexus/util/xml/pull/MXParser.java | 120 +++-- ...onformanceTestSuite_Production66_Test.java | 426 ++++++++++++++++++ .../xmlconf/ibm/not-wf/P66/ibm66n01.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n02.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n03.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n04.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n05.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n06.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n07.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n08.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n09.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n10.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n11.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n12.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n13.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n14.xml | 7 + .../xmlconf/ibm/not-wf/P66/ibm66n15.xml | 7 + 17 files changed, 608 insertions(+), 43 deletions(-) create mode 100644 src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test.java create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n01.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n02.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n03.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n04.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n05.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n06.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n07.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n08.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n09.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n10.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n11.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n12.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n13.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n14.xml create mode 100755 src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n15.xml 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 40a12a21..d8ac85cd 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 @@ -2534,44 +2534,7 @@ else if ( xmlnsPos == 5 ) } if ( ch == '&' ) { - // extractEntityRef - posEnd = pos - 1; - if ( !usePC ) - { - final boolean hadCharData = posEnd > posStart; - if ( hadCharData ) - { - // posEnd is already set correctly!!! - joinPC(); - } - else - { - usePC = true; - pcStart = pcEnd = 0; - } - } - // assert usePC == true; - - final char[] resolvedEntity = parseEntityRef(); - // check if replacement text can be resolved !!! - if ( resolvedEntity == null ) - { - if ( entityRefName == null ) - { - entityRefName = newString( buf, posStart, posEnd - posStart ); - } - throw new XmlPullParserException( "could not resolve entity named '" + printable( entityRefName ) - + "'", this, null ); - } - // write into PC replacement text - do merge for replacement text!!!! - for ( char aResolvedEntity : resolvedEntity ) - { - if ( pcEnd >= pc.length ) - { - ensurePC( pcEnd ); - } - pc[pcEnd++] = aResolvedEntity; - } + extractEntityRef(); } else if ( ch == '\t' || ch == '\n' || ch == '\r' ) { @@ -2759,11 +2722,22 @@ else if ( ch >= 'A' && ch <= 'F' ) } } posEnd = pos - 1; - try + + int codePoint = Integer.parseInt( sb.toString(), isHex ? 16 : 10 ); + boolean isValidCodePoint = isValidCodePoint( codePoint ); + if ( isValidCodePoint ) { - charRefOneCharBuf = Character.toChars( Integer.parseInt( sb.toString(), isHex ? 16 : 10 ) ); + try + { + charRefOneCharBuf = Character.toChars( codePoint ); + } + catch ( IllegalArgumentException e ) + { + isValidCodePoint = false; + } } - catch ( IllegalArgumentException e ) + + if ( !isValidCodePoint ) { throw new XmlPullParserException( "character reference (with " + ( isHex ? "hex" : "decimal" ) + " value " + sb.toString() + ") is invalid", this, null ); @@ -2865,6 +2839,19 @@ else if ( len == 4 && buf[posStart] == 'q' && buf[posStart + 1] == 'u' && buf[po } } + /** + * Check if the provided parameter is a valid Char, according to: {@link https://www.w3.org/TR/REC-xml/#NT-Char} + * + * @param codePoint the numeric value to check + * @return true if it is a valid numeric character reference. False otherwise. + */ + private static boolean isValidCodePoint( int codePoint ) + { + // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] + return codePoint == 0x9 || codePoint == 0xA || codePoint == 0xD || ( 0x20 <= codePoint && codePoint <= 0xD7FF ) + || ( 0xE000 <= codePoint && codePoint <= 0xFFFD ) || ( 0x10000 <= codePoint && codePoint <= 0x10FFFF ); + } + private char[] lookuEntityReplacement( int entityNameLen ) throws XmlPullParserException, IOException @@ -3423,10 +3410,14 @@ private void parseDocdecl() ch = more(); if ( ch == '[' ) ++bracketLevel; - if ( ch == ']' ) + else if ( ch == ']' ) --bracketLevel; - if ( ch == '>' && bracketLevel == 0 ) + else if ( ch == '>' && bracketLevel == 0 ) break; + else if ( ch == '&' ) + { + extractEntityRef(); + } if ( normalizeIgnorableWS ) { if ( ch == '\r' ) @@ -3479,6 +3470,49 @@ else if ( ch == '\n' ) posEnd = pos - 1; } + private void extractEntityRef() + throws XmlPullParserException, IOException + { + // extractEntityRef + posEnd = pos - 1; + if ( !usePC ) + { + final boolean hadCharData = posEnd > posStart; + if ( hadCharData ) + { + // posEnd is already set correctly!!! + joinPC(); + } + else + { + usePC = true; + pcStart = pcEnd = 0; + } + } + // assert usePC == true; + + final char[] resolvedEntity = parseEntityRef(); + // check if replacement text can be resolved !!! + if ( resolvedEntity == null ) + { + if ( entityRefName == null ) + { + entityRefName = newString( buf, posStart, posEnd - posStart ); + } + throw new XmlPullParserException( "could not resolve entity named '" + printable( entityRefName ) + + "'", this, null ); + } + // write into PC replacement text - do merge for replacement text!!!! + for ( char aResolvedEntity : resolvedEntity ) + { + if ( pcEnd >= pc.length ) + { + ensurePC( pcEnd ); + } + pc[pcEnd++] = aResolvedEntity; + } + } + private void parseCDSect( boolean hadCharData ) throws XmlPullParserException, IOException { diff --git a/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test.java b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test.java new file mode 100644 index 00000000..c1d0f2e6 --- /dev/null +++ b/src/test/java/org/codehaus/plexus/util/xml/pull/IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test.java @@ -0,0 +1,426 @@ + +package org.codehaus.plexus.util.xml.pull; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.Reader; + +import org.junit.Before; +import org.junit.Test; + +/** + * Test class that execute a particular set of tests associated to a TESCASES tag from the XML W3C Conformance Tests. + * TESCASES PROFILE:
IBM XML Conformance Test Suite - Production 66
+ * XML test files base folder:
xmlconf/ibm/
+ * + * @author Gabriel Belingueres + */ +public class IBMXML10Tests_Test_IBMXMLConformanceTestSuite_not_wftests_Test_IBMXMLConformanceTestSuite_Production66_Test +{ + + final static File testResourcesDir = new File( "src/test/resources/", "xmlconf/ibm/" ); + + MXParser parser; + + @Before + public void setUp() + { + parser = new MXParser(); + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n01.xml
+ * Test URI:
not-wf/P66/ibm66n01.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#002f" is      used as the referred character in the CharRef in the EntityDecl in the DTD.
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n01xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n01.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#002f\" is used as the referred character in the CharRef in the EntityDecl in the DTD." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with decimal value) may not contain f" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n02.xml
+ * Test URI:
not-wf/P66/ibm66n02.xml
+ * Comment:
Tests CharRef with the semicolon character missing. The semicolon      character is missing at the end of the CharRef in the attribute value in     the STag of element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n02xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n02.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with the semicolon character missing. The semicolon character is missing at the end of the CharRef in the attribute value in the STag of element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value) may not contain \"" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n03.xml
+ * Test URI:
not-wf/P66/ibm66n03.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "49" is      used as the referred character in the CharRef in the EntityDecl in the DTD.
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n03xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n03.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"49\" is used as the referred character in the CharRef in the EntityDecl in the DTD." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "entity reference names can not start with character '4'" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n04.xml
+ * Test URI:
not-wf/P66/ibm66n04.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#5~0" is      used as the referred character in the attribute value in the EmptyElemTag     of the element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n04xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n04.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#5~0\" is used as the referred character in the attribute value in the EmptyElemTag of the element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with decimal value) may not contain ~" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n05.xml
+ * Test URI:
not-wf/P66/ibm66n05.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#x002g" is     used as the referred character in the CharRef in the EntityDecl in the DTD.
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n05xml() + throws FileNotFoundException, IOException, XmlPullParserException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n05.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#x002g\" is used as the referred character in the CharRef in the EntityDecl in the DTD." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value) may not contain g" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n06.xml
+ * Test URI:
not-wf/P66/ibm66n06.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#x006G" is     used as the referred character in the attribute value in the EmptyElemTag      of the element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n06xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n06.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#x006G\" is used as the referred character in the attribute value in the EmptyElemTag of the element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value) may not contain G" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n07.xml
+ * Test URI:
not-wf/P66/ibm66n07.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#0=2f" is      used as the referred character in the CharRef in the EntityDecl in the DTD.
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n07xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n07.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#0=2f\" is used as the referred character in the CharRef in the EntityDecl in the DTD." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value) may not contain =" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n08.xml
+ * Test URI:
not-wf/P66/ibm66n08.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#56.0" is      used as the referred character in the attribute value in the EmptyElemTag      of the element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n08xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n08.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#56.0\" is used as the referred character in the attribute value in the EmptyElemTag of the element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with decimal value) may not contain ." ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n09.xml
+ * Test URI:
not-wf/P66/ibm66n09.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#x00/2f"      is used as the referred character in the CharRef in the EntityDecl in the      DTD.
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n09xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n09.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#x00/2f\" is used as the referred character in the CharRef in the EntityDecl in the DTD." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value) may not contain /" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n10.xml
+ * Test URI:
not-wf/P66/ibm66n10.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#51)" is      used as the referred character in the attribute value in the EmptyElemTag      of the element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n10xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n10.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#51)\" is used as the referred character in the attribute value in the EmptyElemTag of the element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with decimal value) may not contain )" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n11.xml
+ * Test URI:
not-wf/P66/ibm66n11.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#00 2f"     is used as the referred character in the CharRef in the EntityDecl in the      DTD.
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n11xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n11.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#00 2f\" is used as the referred character in the CharRef in the EntityDecl in the DTD." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value) may not contain " ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n12.xml
+ * Test URI:
not-wf/P66/ibm66n12.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#x0000"      is used as the referred character in the attribute value in the EmptyElemTag     of the element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n12xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n12.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#x0000\" is used as the referred character in the attribute value in the EmptyElemTag of the element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value 0000) is invalid" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n13.xml
+ * Test URI:
not-wf/P66/ibm66n13.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#x001f"      is used as the referred character in the attribute value in the EmptyElemTag     of the element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n13xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n13.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#x001f\" is used as the referred character in the attribute value in the EmptyElemTag of the element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value 001f) is invalid" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n14.xml
+ * Test URI:
not-wf/P66/ibm66n14.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#xfffe"      is used as the referred character in the attribute value in the EmptyElemTag     of the element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n14xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n14.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#xfffe\" is used as the referred character in the attribute value in the EmptyElemTag of the element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value fffe) is invalid" ) ); + } + } + + /** + * Test ID:
ibm-not-wf-P66-ibm66n15.xml
+ * Test URI:
not-wf/P66/ibm66n15.xml
+ * Comment:
Tests CharRef with an illegal character referred to. The "#xffff"      is used as the referred character in the attribute value in the EmptyElemTag     of the element "root".
+ * Sections:
4.1
+ * Version: + * + * @throws IOException if there is an I/O error + */ + @Test + public void testibm_not_wf_P66_ibm66n15xml() + throws IOException + { + try ( Reader reader = new FileReader( new File( testResourcesDir, "not-wf/P66/ibm66n15.xml" ) ) ) + { + parser.setInput( reader ); + while ( parser.nextToken() != XmlPullParser.END_DOCUMENT ) + ; + fail( "Tests CharRef with an illegal character referred to. The \"#xffff\" is used as the referred character in the attribute value in the EmptyElemTag of the element \"root\"." ); + } + catch ( XmlPullParserException e ) + { + assertTrue( e.getMessage().contains( "character reference (with hex value ffff) is invalid" ) ); + } + } + +} diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n01.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n01.xml new file mode 100755 index 00000000..b90314e2 --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n01.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n02.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n02.xml new file mode 100755 index 00000000..da5d293a --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n02.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n03.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n03.xml new file mode 100755 index 00000000..60eb3c90 --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n03.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n04.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n04.xml new file mode 100755 index 00000000..d9cd5aa3 --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n04.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n05.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n05.xml new file mode 100755 index 00000000..ef5287b8 --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n05.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n06.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n06.xml new file mode 100755 index 00000000..ef2b241b --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n06.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n07.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n07.xml new file mode 100755 index 00000000..dc7db07f --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n07.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n08.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n08.xml new file mode 100755 index 00000000..257a2b15 --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n08.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n09.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n09.xml new file mode 100755 index 00000000..d84e557b --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n09.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n10.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n10.xml new file mode 100755 index 00000000..302b4adc --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n10.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n11.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n11.xml new file mode 100755 index 00000000..c1a7735a --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n11.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n12.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n12.xml new file mode 100755 index 00000000..ac45641e --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n12.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n13.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n13.xml new file mode 100755 index 00000000..5fb7e723 --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n13.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n14.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n14.xml new file mode 100755 index 00000000..fbac719b --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n14.xml @@ -0,0 +1,7 @@ + + + +]> + diff --git a/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n15.xml b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n15.xml new file mode 100755 index 00000000..612e4ae0 --- /dev/null +++ b/src/test/resources/xmlconf/ibm/not-wf/P66/ibm66n15.xml @@ -0,0 +1,7 @@ + + + +]> +