You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Andrew Ferguson (JIRA)" <xa...@xml.apache.org> on 2007/06/28 10:55:25 UTC

[jira] Created: (XALANJ-2386) tranforming a StreamResult constructed with a File object for a path containing namespaces fails

tranforming a StreamResult constructed with a File object for a path containing namespaces fails
------------------------------------------------------------------------------------------------

                 Key: XALANJ-2386
                 URL: https://issues.apache.org/jira/browse/XALANJ-2386
             Project: XalanJ2
          Issue Type: Bug
          Components: XSLTC
    Affects Versions: 2.7
         Environment: Windows XP, Sun J2SE 5 or Harmony 533500
            Reporter: Andrew Ferguson
             Fix For: 2.5


hi,

The behaviour of the code snippet below is different depending on whether you use XalanJ 2.7.0 or the inbuilt equivalent in Sun Java 5.

If you construct a StreamResult with a java.io.File containing spaces in the name, then a wrapped FileNotFoundException is thrown because it looks for a filename with the spaces encoded as "%20"

We hit this as part of the Eclipse CDT 4.0 project:
   https://bugs.eclipse.org/bugs/show_bug.cgi?id=194359

thanks,
Andrew

------------- Snippet

import java.io.File;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Document;


public class Main {
        public static void main(String[] args) throws Exception {
                try {
                        Document d =
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
                        DOMSource domSource = new DOMSource(d);
                        StreamResult res = new StreamResult(new File("C:/A B/test.xml"));
                        TransformerFactory.newInstance().newTransformer().transform(domSource, res);
                } catch(TransformerException te) {
                        if(te.getMessage().indexOf("%20")!=-1) {
                                System.out.println("XalanJ 2.7.0");
                        } else {
                                System.out.println("Ok"); // assuming "C:/A B/" does not exist
                        }
                }
        }
}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Resolved: (XALANJ-2386) tranforming a StreamResult constructed with a File object for a path containing namespaces fails

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XALANJ-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henry Zongaro resolved XALANJ-2386.
-----------------------------------

    Resolution: Cannot Reproduce

I tried this out with the latest development code and with Xalan-J 2.7.0, using both Xalan-J processors (interpreter and compiler).  In all four cases, the test was able to create a file in a directory whose name contained a space.

I will mark this as unreproducible.  If you are able to provide a test that demonstrates that the same problem exists in Xalan-J (not just in the version of the XSLT processor that Sun includes in its Java distribution), please let us know and we would be glad to investigate.

> tranforming a StreamResult constructed with a File object for a path containing namespaces fails
> ------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2386
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2386
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: XSLTC
>    Affects Versions: 2.7
>         Environment: Windows XP, Sun J2SE 5 or Harmony 533500
>            Reporter: Andrew Ferguson
>             Fix For: 2.5
>
>
> hi,
> The behaviour of the code snippet below is different depending on whether you use XalanJ 2.7.0 or the inbuilt equivalent in Sun Java 5.
> If you construct a StreamResult with a java.io.File containing spaces in the name, then a wrapped FileNotFoundException is thrown because it looks for a filename with the spaces encoded as "%20"
> We hit this as part of the Eclipse CDT 4.0 project:
>    https://bugs.eclipse.org/bugs/show_bug.cgi?id=194359
> thanks,
> Andrew
> ------------- Snippet
> import java.io.File;
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.transform.TransformerException;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.dom.DOMSource;
> import javax.xml.transform.stream.StreamResult;
> import org.w3c.dom.Document;
> public class Main {
>         public static void main(String[] args) throws Exception {
>                 try {
>                         Document d =
> DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>                         DOMSource domSource = new DOMSource(d);
>                         StreamResult res = new StreamResult(new File("C:/A B/test.xml"));
>                         TransformerFactory.newInstance().newTransformer().transform(domSource, res);
>                 } catch(TransformerException te) {
>                         if(te.getMessage().indexOf("%20")!=-1) {
>                                 System.out.println("XalanJ 2.7.0");
>                         } else {
>                                 System.out.println("Ok"); // assuming "C:/A B/" does not exist
>                         }
>                 }
>         }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2386) tranforming a StreamResult constructed with a File object for a path containing namespaces fails

Posted by "Henry Zongaro (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510203 ] 

Henry Zongaro commented on XALANJ-2386:
---------------------------------------

I am now able to reproduce the problem.  Thanks for providing the samples of the command-line invocation.

> tranforming a StreamResult constructed with a File object for a path containing namespaces fails
> ------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2386
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2386
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: XSLTC
>    Affects Versions: 2.7
>         Environment: Windows XP, Sun J2SE 5 or Harmony 533500
>            Reporter: Andrew Ferguson
>             Fix For: 2.5
>
>
> hi,
> The behaviour of the code snippet below is different depending on whether you use XalanJ 2.7.0 or the inbuilt equivalent in Sun Java 5.
> If you construct a StreamResult with a java.io.File containing spaces in the name, then a wrapped FileNotFoundException is thrown because it looks for a filename with the spaces encoded as "%20"
> We hit this as part of the Eclipse CDT 4.0 project:
>    https://bugs.eclipse.org/bugs/show_bug.cgi?id=194359
> thanks,
> Andrew
> ------------- Snippet
> import java.io.File;
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.transform.TransformerException;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.dom.DOMSource;
> import javax.xml.transform.stream.StreamResult;
> import org.w3c.dom.Document;
> public class Main {
>         public static void main(String[] args) throws Exception {
>                 try {
>                         Document d =
> DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>                         DOMSource domSource = new DOMSource(d);
>                         StreamResult res = new StreamResult(new File("C:/A B/test.xml"));
>                         TransformerFactory.newInstance().newTransformer().transform(domSource, res);
>                 } catch(TransformerException te) {
>                         if(te.getMessage().indexOf("%20")!=-1) {
>                                 System.out.println("XalanJ 2.7.0");
>                         } else {
>                                 System.out.println("Ok"); // assuming "C:/A B/" does not exist
>                         }
>                 }
>         }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2386) tranforming a StreamResult constructed with a File object for a path containing namespaces fails

Posted by "Brian Minchau (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509126 ] 

Brian Minchau commented on XALANJ-2386:
---------------------------------------

If I am reading this report right, then this is not a bug in Xalan 2.7.0 but rather a bug in SUN's Java 5 (which would package their own modified/repackaged version of Xalan 2.7.0).

Xalan is an open source project, so you will have to take this issue up with SUN.  Or did I read this wrong and it is somehow a Xalan bug?

> tranforming a StreamResult constructed with a File object for a path containing namespaces fails
> ------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2386
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2386
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: XSLTC
>    Affects Versions: 2.7
>         Environment: Windows XP, Sun J2SE 5 or Harmony 533500
>            Reporter: Andrew Ferguson
>             Fix For: 2.5
>
>
> hi,
> The behaviour of the code snippet below is different depending on whether you use XalanJ 2.7.0 or the inbuilt equivalent in Sun Java 5.
> If you construct a StreamResult with a java.io.File containing spaces in the name, then a wrapped FileNotFoundException is thrown because it looks for a filename with the spaces encoded as "%20"
> We hit this as part of the Eclipse CDT 4.0 project:
>    https://bugs.eclipse.org/bugs/show_bug.cgi?id=194359
> thanks,
> Andrew
> ------------- Snippet
> import java.io.File;
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.transform.TransformerException;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.dom.DOMSource;
> import javax.xml.transform.stream.StreamResult;
> import org.w3c.dom.Document;
> public class Main {
>         public static void main(String[] args) throws Exception {
>                 try {
>                         Document d =
> DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>                         DOMSource domSource = new DOMSource(d);
>                         StreamResult res = new StreamResult(new File("C:/A B/test.xml"));
>                         TransformerFactory.newInstance().newTransformer().transform(domSource, res);
>                 } catch(TransformerException te) {
>                         if(te.getMessage().indexOf("%20")!=-1) {
>                                 System.out.println("XalanJ 2.7.0");
>                         } else {
>                                 System.out.println("Ok"); // assuming "C:/A B/" does not exist
>                         }
>                 }
>         }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Commented: (XALANJ-2386) tranforming a StreamResult constructed with a File object for a path containing namespaces fails

Posted by "Jan Novak (JIRA)" <xa...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XALANJ-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12509119 ] 

Jan Novak commented on XALANJ-2386:
-----------------------------------

I encountered similar problem with Xalan 2.7.0 and Sun JVM 1.5.0_9 - 12. In my case redirect cause the problem, solution is add base = base.replaceAll("%20"," "); in org.apache.xalan.lib.Redirect.urlToFileName(String base) method. This is rather quick and dirty fix, not system wide solution.


> tranforming a StreamResult constructed with a File object for a path containing namespaces fails
> ------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2386
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2386
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: XSLTC
>    Affects Versions: 2.7
>         Environment: Windows XP, Sun J2SE 5 or Harmony 533500
>            Reporter: Andrew Ferguson
>             Fix For: 2.5
>
>
> hi,
> The behaviour of the code snippet below is different depending on whether you use XalanJ 2.7.0 or the inbuilt equivalent in Sun Java 5.
> If you construct a StreamResult with a java.io.File containing spaces in the name, then a wrapped FileNotFoundException is thrown because it looks for a filename with the spaces encoded as "%20"
> We hit this as part of the Eclipse CDT 4.0 project:
>    https://bugs.eclipse.org/bugs/show_bug.cgi?id=194359
> thanks,
> Andrew
> ------------- Snippet
> import java.io.File;
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.transform.TransformerException;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.dom.DOMSource;
> import javax.xml.transform.stream.StreamResult;
> import org.w3c.dom.Document;
> public class Main {
>         public static void main(String[] args) throws Exception {
>                 try {
>                         Document d =
> DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>                         DOMSource domSource = new DOMSource(d);
>                         StreamResult res = new StreamResult(new File("C:/A B/test.xml"));
>                         TransformerFactory.newInstance().newTransformer().transform(domSource, res);
>                 } catch(TransformerException te) {
>                         if(te.getMessage().indexOf("%20")!=-1) {
>                                 System.out.println("XalanJ 2.7.0");
>                         } else {
>                                 System.out.println("Ok"); // assuming "C:/A B/" does not exist
>                         }
>                 }
>         }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org


[jira] Reopened: (XALANJ-2386) tranforming a StreamResult constructed with a File object for a path containing namespaces fails

Posted by "Andrew Ferguson (JIRA)" <xa...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XALANJ-2386?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andrew Ferguson reopened XALANJ-2386:
-------------------------------------


hi,

I'm able to reproduce this with the snippet above and the standalone XalanJ 2.7.0 binary distribution available from
   http://mirrors.dedipower.com/ftp.apache.org/xml/xalan-j/xalan-j_2_7_0-bin.zip

The following is an example console session:

=====
D:\test>java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

D:\test>java -cp . Main
Ok

D:\test>java -cp xalan-j_2_7_0\xalan.jar;. Main
XalanJ 2.7.0

D:\test>C:\apache-harmony-jre-r533500-windows-x86-32-snapshot\harmony-jre-r53350
0\bin\java -cp . Main
XalanJ 2.7.0
=====

please let me know if there is any further information I can provide
thanks,
Andrew

> tranforming a StreamResult constructed with a File object for a path containing namespaces fails
> ------------------------------------------------------------------------------------------------
>
>                 Key: XALANJ-2386
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2386
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: XSLTC
>    Affects Versions: 2.7
>         Environment: Windows XP, Sun J2SE 5 or Harmony 533500
>            Reporter: Andrew Ferguson
>             Fix For: 2.5
>
>
> hi,
> The behaviour of the code snippet below is different depending on whether you use XalanJ 2.7.0 or the inbuilt equivalent in Sun Java 5.
> If you construct a StreamResult with a java.io.File containing spaces in the name, then a wrapped FileNotFoundException is thrown because it looks for a filename with the spaces encoded as "%20"
> We hit this as part of the Eclipse CDT 4.0 project:
>    https://bugs.eclipse.org/bugs/show_bug.cgi?id=194359
> thanks,
> Andrew
> ------------- Snippet
> import java.io.File;
> import javax.xml.parsers.DocumentBuilderFactory;
> import javax.xml.transform.TransformerException;
> import javax.xml.transform.TransformerFactory;
> import javax.xml.transform.dom.DOMSource;
> import javax.xml.transform.stream.StreamResult;
> import org.w3c.dom.Document;
> public class Main {
>         public static void main(String[] args) throws Exception {
>                 try {
>                         Document d =
> DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
>                         DOMSource domSource = new DOMSource(d);
>                         StreamResult res = new StreamResult(new File("C:/A B/test.xml"));
>                         TransformerFactory.newInstance().newTransformer().transform(domSource, res);
>                 } catch(TransformerException te) {
>                         if(te.getMessage().indexOf("%20")!=-1) {
>                                 System.out.println("XalanJ 2.7.0");
>                         } else {
>                                 System.out.println("Ok"); // assuming "C:/A B/" does not exist
>                         }
>                 }
>         }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org