You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-cvs@xml.apache.org by mr...@apache.org on 2009/10/26 22:15:04 UTC
svn commit: r829968 -
/xml/commons/branches/tck-jaxp-1_3_0/java/external/src/javax/xml/transform/stream/StreamResult.java
Author: mrglavas
Date: Mon Oct 26 21:15:03 2009
New Revision: 829968
URL: http://svn.apache.org/viewvc?rev=829968&view=rev
Log:
Updated File to URI conversion code so that it's consistent with StreamSource.
Modified:
xml/commons/branches/tck-jaxp-1_3_0/java/external/src/javax/xml/transform/stream/StreamResult.java
Modified: xml/commons/branches/tck-jaxp-1_3_0/java/external/src/javax/xml/transform/stream/StreamResult.java
URL: http://svn.apache.org/viewvc/xml/commons/branches/tck-jaxp-1_3_0/java/external/src/javax/xml/transform/stream/StreamResult.java?rev=829968&r1=829967&r2=829968&view=diff
==============================================================================
--- xml/commons/branches/tck-jaxp-1_3_0/java/external/src/javax/xml/transform/stream/StreamResult.java (original)
+++ xml/commons/branches/tck-jaxp-1_3_0/java/external/src/javax/xml/transform/stream/StreamResult.java Mon Oct 26 21:15:03 2009
@@ -19,13 +19,11 @@
package javax.xml.transform.stream;
-import java.lang.reflect.Method;
-import javax.xml.transform.Result;
-
import java.io.File;
import java.io.OutputStream;
import java.io.Writer;
-import java.net.MalformedURLException;
+
+import javax.xml.transform.Result;
/**
* <p>Acts as an holder for a transformation result,
@@ -161,28 +159,7 @@
* @param f Must a non-null File reference.
*/
public void setSystemId(File f) {
-
- try {
- // use reflection to call f.toURI().toString().
- // Avoid compile time dependency on J2SE 1.4.
- Method toURIMethod = f.getClass().getMethod("toURI", (Class[]) null);
- Object uri = toURIMethod.invoke(f, (Object[]) null);
- Method toStringMethod = uri.getClass().getMethod("toString", (Class[]) null);
- this.systemId = (String)toStringMethod.invoke(uri, (Object[]) null);
- }
- catch (Exception exception)
- {
- // running on J2SE 1.3?
- try {
- this.systemId = f.toURL().toString();
- } catch (MalformedURLException malformedURLException) {
- this.systemId = null;
- throw new RuntimeException(
- "javax.xml.transform.stream.StreamResult#setSystemId(File f) with MalformedURLException: "
- + malformedURLException.toString()
- );
- }
- }
+ this.systemId = FilePathToURI.filepath2URI(f.getAbsolutePath());
}
/**