-
Bug
-
Resolution: Unresolved
-
P4
-
None
-
5.0
-
Fix Understood
-
x86
-
windows_xp
FULL PRODUCT VERSION :
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
Any -- bug in core Java lib.
EXTRA RELEVANT SYSTEM CONFIGURATION :
javax.xml.parsers.DocumentBuilder bug, not parser-specific.
A DESCRIPTION OF THE PROBLEM :
The parse(File) method of javax.xml.parsers.DocumentBuilder creates an InputSource with an invalid file URL as a system ID. Special characters, such as whitespace, are not escaped. Using the result of File.toURI().toString() would work.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an XML document that refers to a DTD relative to itself. Locate the document in a path that has contains whitespace in some component. Parse the document using DocumentBuilder.parse(File)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The document should parse successfully as if I had used DocumentBuilder.parse(new InputSource(file.toURI().toString()))
ACTUAL -
The relative entity cannot be accessed because the base system ID (provided by DocumentBuilder) is not recognized as a URI.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Use a different version of the DocumentBuilder.parse method. Create a URI for your File in your application rather than letting DocumentBuilder try to do it for you.
java version "1.5.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_04-b05)
Java HotSpot(TM) Client VM (build 1.5.0_04-b05, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
Any -- bug in core Java lib.
EXTRA RELEVANT SYSTEM CONFIGURATION :
javax.xml.parsers.DocumentBuilder bug, not parser-specific.
A DESCRIPTION OF THE PROBLEM :
The parse(File) method of javax.xml.parsers.DocumentBuilder creates an InputSource with an invalid file URL as a system ID. Special characters, such as whitespace, are not escaped. Using the result of File.toURI().toString() would work.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create an XML document that refers to a DTD relative to itself. Locate the document in a path that has contains whitespace in some component. Parse the document using DocumentBuilder.parse(File)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The document should parse successfully as if I had used DocumentBuilder.parse(new InputSource(file.toURI().toString()))
ACTUAL -
The relative entity cannot be accessed because the base system ID (provided by DocumentBuilder) is not recognized as a URI.
REPRODUCIBILITY :
This bug can be reproduced always.
CUSTOMER SUBMITTED WORKAROUND :
Use a different version of the DocumentBuilder.parse method. Create a URI for your File in your application rather than letting DocumentBuilder try to do it for you.