United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-5077403 : javax.xml: transform() throws FileNotFound exception

Details
Type:
Bug
Submit Date:
2004-07-22
Status:
Resolved
Updated Date:
2012-04-25
Project Name:
JDK
Resolved Date:
2004-07-26
Component:
xml
OS:
windows_2000
Sub-Component:
javax.xml.transform
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
5.0 (b60)

Related Reports
Backport:

Sub Tasks

Description
jdk: 1.5.0 b58 
platform: win 2000 (possibly others)

Path of the output file, out_path, contains white spaces.  transform() throws FileNotFound Exception. This behavior was not observed in b51.  After changing the path to contain no white spaces, everything works fine again.

            static private String out_path =
            "C:\\Documents and Settings\\Dina\\My Documents\\ms_project\\out\\";

	    ..... .....

            DocumentBuilder builder = factory.newDocumentBuilder();
            document = builder.parse(datafile);

            // Use a Transformer for output
            TransformerFactory tFactory = TransformerFactory.newInstance();
            StreamSource stylesource = new StreamSource(stylesheet);
            Transformer transformer = tFactory.newTransformer(stylesource);

            DOMSource source = new DOMSource(document);
            File f = new File(out_path + "\\" + datafile.getName());
            StreamResult result = new StreamResult(f);
      >>>>> transformer.transform(source, result);
            

javax.xml.transform.TransformerException: java.io.FileNotFoundException: C:\Documents%20and%20Settings\Dina\My%20Documents\ms_project\out\res00024.dat (The system cannot find the path specified)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(Unknown Source)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
    at MyDomParser.doTransformation(MyDomParser.java:306)
    at MyDomParser.actionPerformed(MyDomParser.java:243)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Documents%20and%20Settings\Dina\My%20Documents\ms_project\out\res00024.dat (The system cannot find the path specified)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    ... 28 more
---------
java.io.FileNotFoundException: C:\Documents%20and%20Settings\Dina\My%20Documents\ms_project\out\res00024.dat (The system cannot find the path specified)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(Unknown Source)
    at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(Unknown Source)
    at MyDomParser.doTransformation(MyDomParser.java:306)
    at MyDomParser.actionPerformed(MyDomParser.java:243)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent

           

                                    

Comments
EVALUATION

I ran the test-case with xalan and jaxp-api from Tiger-RC-build58-b02 tag and HEAD, both worked fine. But if i run the  testcase with jdk1.5.0-b58 it gives me the error. It might be integration issue.

###@###.### 2004-07-23

JAXP API is correct in its usage of URIs.
the Xalan implementation is assuming the use of URLs.  fixing JAXP API to correctly use URIs exposes this Xalan bug.  Xalan needs to be URI aware and also support J2SE 1.3 which does not have a URI class.
###@###.### 2004-07-23
                                     
2004-07-23
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger-rc

FIXED IN:
tiger-rc

INTEGRATED IN:
tiger-b60
tiger-rc


                                     
2004-08-03



Hardware and Software, Engineered to Work Together