Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2075572 | 5.0 | Kohsuke Kawaguchi | P3 | Closed | Fixed | b36 |
Name: eaR10174 Date: 10/07/2003
The methods XMLUtils.IsValidNCName() accept invalid names (see test.java below). The
method isValidNCName(String ncName) returns true in case when ncName is ".abc". The method
isValidNCName(String ncName, String xmlVersion) returns true in case when ncName is
"\u05BFq", xmlVersion is 1.0 and in case when ncName is "\u00B7q", xmlVersion is 1.1 .
According to XML 1.0, 1.1 specifications names can not start with ".", "\u05BF" and
"\u00B7" so the methods should return false.
The bug appears in jdk1.5.0beta-b22 and affects new JCK1.5 tests:
api/javax_xml/XMLUtils/index.html#XMLUtils[IsValidNCName002]
api/javax_xml/XMLUtils/index.html#XMLUtils[IsValidNCName004]
api/javax_xml/XMLUtils/index.html#XMLUtils[IsValidNCName006]
------------------------------------test.java-----------------------------
import javax.xml.XMLUtils;
public class test {
public static void main(String [] args) {
if (XMLUtils.isValidNCName(".abc")) {
System.out.println("Name '.abc': true returned, expected false");
} else {
System.out.println("Name '.abc': OK");
}
if (XMLUtils.isValidNCName("\u05BFq", "1.0")) {
System.out.println("Name '\\u05BFq': true returned, expected false");
} else {
System.out.println("Name '\\u05BFq': OK");
}
if (XMLUtils.isValidNCName("\u00B7q", "1.1")) {
System.out.println("Name '\\u00B7q': true returned, expected false");
} else {
System.out.println("Name '\\u00B7q': OK");
}
}
}
--------------------------------------------------------------------------
% java -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b22)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b22, mixed mode)
Name '.abc': true returned, expected false
Name '\u05BFq': true returned, expected false
Name '\u00B7q': true returned, expected false
--------------------------------------------------------------------------
======================================================================
The methods XMLUtils.IsValidNCName() accept invalid names (see test.java below). The
method isValidNCName(String ncName) returns true in case when ncName is ".abc". The method
isValidNCName(String ncName, String xmlVersion) returns true in case when ncName is
"\u05BFq", xmlVersion is 1.0 and in case when ncName is "\u00B7q", xmlVersion is 1.1 .
According to XML 1.0, 1.1 specifications names can not start with ".", "\u05BF" and
"\u00B7" so the methods should return false.
The bug appears in jdk1.5.0beta-b22 and affects new JCK1.5 tests:
api/javax_xml/XMLUtils/index.html#XMLUtils[IsValidNCName002]
api/javax_xml/XMLUtils/index.html#XMLUtils[IsValidNCName004]
api/javax_xml/XMLUtils/index.html#XMLUtils[IsValidNCName006]
------------------------------------test.java-----------------------------
import javax.xml.XMLUtils;
public class test {
public static void main(String [] args) {
if (XMLUtils.isValidNCName(".abc")) {
System.out.println("Name '.abc': true returned, expected false");
} else {
System.out.println("Name '.abc': OK");
}
if (XMLUtils.isValidNCName("\u05BFq", "1.0")) {
System.out.println("Name '\\u05BFq': true returned, expected false");
} else {
System.out.println("Name '\\u05BFq': OK");
}
if (XMLUtils.isValidNCName("\u00B7q", "1.1")) {
System.out.println("Name '\\u00B7q': true returned, expected false");
} else {
System.out.println("Name '\\u00B7q': OK");
}
}
}
--------------------------------------------------------------------------
% java -showversion test
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b22)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b22, mixed mode)
Name '.abc': true returned, expected false
Name '\u05BFq': true returned, expected false
Name '\u00B7q': true returned, expected false
--------------------------------------------------------------------------
======================================================================
- backported by
-
JDK-2075572 Methods IsValidNCName() accept invalid names
- Closed