-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
7u45
-
x86_64
-
windows_7
FULL PRODUCT VERSION :
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 64-bit
A DESCRIPTION OF THE PROBLEM :
DocumentBuilderFactory is not capable of handling the file with the '#' letter in its name!!!.
While am trying to prepare a Document Object with an xml file ('#' letter in its name) as like in below statement
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource("test1#test.xml"));
it shows file not foundException as
Error :
java.io.FileNotFoundException: C:\Users\jayapal-1\workspace\Sample\test1 (The system cannot find the file specified)
REGRESSION. Last worked in version 7u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute the below line in a main function.
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource("test1#test.xml"));
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should prepare a Document object by loading the file
ACTUAL -
hitting file not found exception
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.io.FileNotFoundException: C:\Users\jayapal-1\workspace\Sample\test1 (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at FileTester.main(FileTester.java:23)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class FileTester {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource("test1#test.xml"));
} catch (SAXException | IOException | ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Need to use the InputStream to load the file instead of directly loading with file on to inputsource.
like below,
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new FileInputStream("test1#test.xml")));
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Windows 7 64-bit
A DESCRIPTION OF THE PROBLEM :
DocumentBuilderFactory is not capable of handling the file with the '#' letter in its name!!!.
While am trying to prepare a Document Object with an xml file ('#' letter in its name) as like in below statement
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource("test1#test.xml"));
it shows file not foundException as
Error :
java.io.FileNotFoundException: C:\Users\jayapal-1\workspace\Sample\test1 (The system cannot find the file specified)
REGRESSION. Last worked in version 7u45
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute the below line in a main function.
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource("test1#test.xml"));
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should prepare a Document object by loading the file
ACTUAL -
hitting file not found exception
ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.io.FileNotFoundException: C:\Users\jayapal-1\workspace\Sample\test1 (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at FileTester.main(FileTester.java:23)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.IOException;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
public class FileTester {
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource("test1#test.xml"));
} catch (SAXException | IOException | ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Need to use the InputStream to load the file instead of directly loading with file on to inputsource.
like below,
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new FileInputStream("test1#test.xml")));