You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "Rick Riemer (JIRA)" <xa...@xml.apache.org> on 2005/08/05 16:15:39 UTC
[jira] Created: (XALANJ-2182) Incorrect URL (systemId) handling when running with Sun JRE 1.5.0 or above
Incorrect URL (systemId) handling when running with Sun JRE 1.5.0 or above
--------------------------------------------------------------------------
Key: XALANJ-2182
URL: http://issues.apache.org/jira/browse/XALANJ-2182
Project: XalanJ2
Type: Bug
Components: transformation
Versions: 2.6
Environment: Windows XP SP2, Sun JDK 1.5.0_01, Xalan 2.6.0
Reporter: Rick Riemer
Priority: Minor
When running the following piece of code:
Transformer identity = TransformerFactory.newInstance().newTransformer();
identity.setOutputProperty("method", "xml");
identity.setOutputProperty("indent", "yes");
identity.transform(src, new StreamResult(new File("file.xml")));
on a Sun JRE 1.5.0 or above, Xalan is unable to create a new file and thus throws a TransformerException.
This is caused by lines 225-235 in Xalan's TransformerIdentityImpl.java:
String fileURL = sresult.getSystemId();
if (fileURL.startsWith("file:///"))
{
if (fileURL.substring(8).indexOf(":") >0)
fileURL = fileURL.substring(8);
else
fileURL = fileURL.substring(7);
}
m_outputStream = new java.io.FileOutputStream(fileURL);
As of JRE 1.5.0 Sun now generates URIs in a different way in StreamResult (see StreamResult.setSystemId()), an therefore the URI will start with file:/ instead of file:///. Thus FileOutputStream will not be able to open the file anymore, since the if-block never executes.
The suggested fix is to change the code to the following:
String fileURL = sresult.getSystemId();
File file = new File(new URI(fileURL));
m_outputStream = new java.io.FileOutputStream(file);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Resolved: (XALANJ-2182) Incorrect URL (systemId) handling when running with Sun JRE 1.5.0 or above
Posted by "Sarah McNamara (JIRA)" <xa...@xml.apache.org>.
[ http://issues.apache.org/jira/browse/XALANJ-2182?page=all ]
Sarah McNamara resolved XALANJ-2182:
------------------------------------
Fix Version: 2.7
Resolution: Duplicate
I believe this is a duplicate of XALANJ-1978 which was fixed in Xalan Java 2.7. Could you please try
the Xalan Java 2.7 release and if the problem persists, reopen this issue.
Thanks.
> Incorrect URL (systemId) handling when running with Sun JRE 1.5.0 or above
> --------------------------------------------------------------------------
>
> Key: XALANJ-2182
> URL: http://issues.apache.org/jira/browse/XALANJ-2182
> Project: XalanJ2
> Type: Bug
> Components: transformation
> Versions: 2.6
> Environment: Windows XP SP2, Sun JDK 1.5.0_01, Xalan 2.6.0
> Reporter: Rick Riemer
> Priority: Minor
> Fix For: 2.7
>
> When running the following piece of code:
> Transformer identity = TransformerFactory.newInstance().newTransformer();
> identity.setOutputProperty("method", "xml");
> identity.setOutputProperty("indent", "yes");
> identity.transform(src, new StreamResult(new File("file.xml")));
> on a Sun JRE 1.5.0 or above, Xalan is unable to create a new file and thus throws a TransformerException.
> This is caused by lines 225-235 in Xalan's TransformerIdentityImpl.java:
> String fileURL = sresult.getSystemId();
> if (fileURL.startsWith("file:///"))
> {
> if (fileURL.substring(8).indexOf(":") >0)
> fileURL = fileURL.substring(8);
> else
> fileURL = fileURL.substring(7);
> }
> m_outputStream = new java.io.FileOutputStream(fileURL);
> As of JRE 1.5.0 Sun now generates URIs in a different way in StreamResult (see StreamResult.setSystemId()), an therefore the URI will start with file:/ instead of file:///. Thus FileOutputStream will not be able to open the file anymore, since the if-block never executes.
> The suggested fix is to change the code to the following:
> String fileURL = sresult.getSystemId();
> File file = new File(new URI(fileURL));
> m_outputStream = new java.io.FileOutputStream(file);
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org
[jira] Commented: (XALANJ-2182) Incorrect URL (systemId) handling
when running with Sun JRE 1.5.0 or above
Posted by "Michael Vorburger (JIRA)" <xa...@xml.apache.org>.
[ https://issues.apache.org/jira/browse/XALANJ-2182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12865209#action_12865209 ]
Michael Vorburger commented on XALANJ-2182:
-------------------------------------------
Well... this one wasn't really a duplicate of XALANJ-1978 actually, because XALANJ-1978 only seems to have addressed the "with file:/ instead of file:///. " issue, but not the actual root cause here which is incorrect URL handling in TransformerIdentityImpl, which the proposed fix above would have addressed but which what was done in XALANJ-1978 has not addressed.
XALANJ-2461 is still open about the root cause of incorrect URL unescaping in TransformerIdentityImpl.
> Incorrect URL (systemId) handling when running with Sun JRE 1.5.0 or above
> --------------------------------------------------------------------------
>
> Key: XALANJ-2182
> URL: https://issues.apache.org/jira/browse/XALANJ-2182
> Project: XalanJ2
> Issue Type: Bug
> Components: transformation
> Affects Versions: 2.6
> Environment: Windows XP SP2, Sun JDK 1.5.0_01, Xalan 2.6.0
> Reporter: Rick Riemer
> Priority: Minor
> Fix For: 2.7
>
>
> When running the following piece of code:
> Transformer identity = TransformerFactory.newInstance().newTransformer();
> identity.setOutputProperty("method", "xml");
> identity.setOutputProperty("indent", "yes");
> identity.transform(src, new StreamResult(new File("file.xml")));
> on a Sun JRE 1.5.0 or above, Xalan is unable to create a new file and thus throws a TransformerException.
> This is caused by lines 225-235 in Xalan's TransformerIdentityImpl.java:
> String fileURL = sresult.getSystemId();
> if (fileURL.startsWith("file:///"))
> {
> if (fileURL.substring(8).indexOf(":") >0)
> fileURL = fileURL.substring(8);
> else
> fileURL = fileURL.substring(7);
> }
> m_outputStream = new java.io.FileOutputStream(fileURL);
> As of JRE 1.5.0 Sun now generates URIs in a different way in StreamResult (see StreamResult.setSystemId()), an therefore the URI will start with file:/ instead of file:///. Thus FileOutputStream will not be able to open the file anymore, since the if-block never executes.
> The suggested fix is to change the code to the following:
> String fileURL = sresult.getSystemId();
> File file = new File(new URI(fileURL));
> m_outputStream = new java.io.FileOutputStream(file);
--
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