xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adelme...@apache.org
Subject svn commit: r676297 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop: apps/ cli/ fo/extensions/svg/ hyphenation/ render/afp/fonts/ tools/ tools/anttasks/
Date Sun, 13 Jul 2008 10:26:51 GMT
Author: adelmelle
Date: Sun Jul 13 03:26:48 2008
New Revision: 676297

URL: http://svn.apache.org/viewvc?rev=676297&view=rev
Log:
Replace occurrences of File.toURL() by File.toURI().toURL() (recommended as of Java 6, where
File.toURL() is deprecated)

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/InputHandler.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/Main.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/TestConverter.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/Fop.java
    xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/RunTest.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/apps/FOURIResolver.java Sun Jul 13 03:26:48
2008
@@ -77,7 +77,7 @@
         }
         File dir = new File(base);
         try {
-            base = (dir.isDirectory() ? dir.toURL() : new URL(base)).toExternalForm();
+            base = (dir.isDirectory() ? dir.toURI().toURL() : new URL(base)).toExternalForm();
         } catch (MalformedURLException mfue) {
             if (throwExceptions) {
                 throw mfue;
@@ -173,9 +173,9 @@
             if (file.canRead() && file.isFile()) {
                 try {
                     if (fragment != null) {
-                        absoluteURL = new URL(file.toURL().toExternalForm() + fragment);
+                        absoluteURL = new URL(file.toURI().toURL().toExternalForm() + fragment);
                     } else {
-                        absoluteURL = file.toURL();
+                        absoluteURL = file.toURI().toURL();
                     }
                 } catch (MalformedURLException mfue) {
                     handleException(mfue, "Could not convert filename '" + href

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/InputHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/InputHandler.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/InputHandler.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/InputHandler.java Sun Jul 13 03:26:48
2008
@@ -112,7 +112,7 @@
 
             try {
                 baseURL = new File(sourcefile.getAbsolutePath()).
-                        getParentFile().toURL().toExternalForm();
+                        getParentFile().toURI().toURL().toExternalForm();
             } catch (Exception e) {
                 baseURL = "";
             }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/Main.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/Main.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/Main.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/cli/Main.java Sun Jul 13 03:26:48 2008
@@ -66,7 +66,7 @@
                     + baseDir.getAbsolutePath() + " (or below)");
         }
         List jars = new java.util.ArrayList();
-        jars.add(fopJar.toURL());
+        jars.add(fopJar.toURI().toURL());
         File[] files;
         FileFilter filter = new FileFilter() {
             public boolean accept(File pathname) {
@@ -80,7 +80,7 @@
         files = libDir.listFiles(filter);
         if (files != null) {
             for (int i = 0, size = files.length; i < size; i++) {
-                jars.add(files[i].toURL());
+                jars.add(files[i].toURI().toURL());
             }
         }
         String optionalLib = System.getProperty("fop.optional.lib");
@@ -88,7 +88,7 @@
             files = new File(optionalLib).listFiles(filter);
             if (files != null) {
                 for (int i = 0, size = files.length; i < size; i++) {
-                    jars.add(files[i].toURL());
+                    jars.add(files[i].toURI().toURL());
                 }
             }
         }
@@ -172,9 +172,9 @@
                 } else {
                     options.getInputHandler().transformTo(out);
                 }
-             } finally {
-                 IOUtils.closeQuietly(out);
-             }
+            } finally {
+                IOUtils.closeQuietly(out);
+            }
 
             // System.exit(0) called to close AWT/SVG-created threads, if any.
             // AWTRenderer closes with window shutdown, so exit() should not
@@ -185,9 +185,9 @@
         } catch (Exception e) {
             if (options != null) {
                 options.getLogger().error("Exception", e);
-            }
-            if (options.getOutputFile() != null) {
-                options.getOutputFile().delete();
+                if (options.getOutputFile() != null) {
+                    options.getOutputFile().delete();
+                }
             }
             System.exit(1);
         }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java Sun Jul
13 03:26:48 2008
@@ -92,7 +92,7 @@
 
         try {
             URL baseURL = new URL(getUserAgent().getBaseURL() == null 
-                            ? new java.io.File("").toURL().toExternalForm() 
+                            ? new java.io.File("").toURI().toURL().toExternalForm() 
                             : getUserAgent().getBaseURL());
             if (baseURL != null) {
                 SVGOMDocument svgdoc = (SVGOMDocument)doc; 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/HyphenationTree.java Sun Jul
13 03:26:48 2008
@@ -125,7 +125,7 @@
     public void loadPatterns(String filename) throws HyphenationException {
         File f = new File(filename);
         try {
-            InputSource src = new InputSource(f.toURL().toExternalForm());
+            InputSource src = new InputSource(f.toURI().toURL().toExternalForm());
             loadPatterns(src);
         } catch (MalformedURLException e) {
             throw new HyphenationException("Error converting the File '" + f + "' to a URL:
" 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/PatternParser.java Sun Jul 13
03:26:48 2008
@@ -92,7 +92,7 @@
      */
     public void parse(File file) throws HyphenationException {
         try {
-            InputSource src = new InputSource(file.toURL().toExternalForm());
+            InputSource src = new InputSource(file.toURI().toURL().toExternalForm());
             parse(src);
         } catch (MalformedURLException e) {
             throw new HyphenationException("Error converting the File '" + file + "' to a
URL: " 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java Sun
Jul 13 03:26:48 2008
@@ -157,7 +157,7 @@
             if (url == null) {
                 try {
                     File file = new File(path);
-                    url = file.toURL();
+                    url = file.toURI().toURL();
                     if (url == null) {
                         String msg = "CharacterSet file not found for "
                             + characterset + " in classpath: " + path;
@@ -194,7 +194,7 @@
                 log.warn(msg);
             }
 
-            inputStream = csfont[0].toURL().openStream();
+            inputStream = csfont[0].toURI().toURL().openStream();
             if (inputStream == null) {
                 String msg = "Failed to open character set resource "
                     + characterset;
@@ -258,7 +258,7 @@
         if (url == null) {
             try {
                 File file = new File(path);
-                url = file.toURL();
+                url = file.toURI().toURL();
                 if (url == null) {
                     String msg = "CodePage file not found for " + codePage
                         + " in classpath: " + path;
@@ -300,7 +300,7 @@
             log.warn(msg);
         }
 
-        InputStream is = codepage[0].toURL().openStream();
+        InputStream is = codepage[0].toURI().toURL().openStream();
 
         if (is == null) {
             String msg = "AFPFontReader:: loadCodePage(String):: code page file not found
for "

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/TestConverter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/TestConverter.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/TestConverter.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/TestConverter.java Sun Jul 13 03:26:48
2008
@@ -274,7 +274,7 @@
             File xmlFile = new File(baseDir + "/" + xml);
             String baseURL = null;
             try {
-                baseURL = xmlFile.getParentFile().toURL().toExternalForm();
+                baseURL = xmlFile.getParentFile().toURI().toURL().toExternalForm();
             } catch (Exception e) {
                 logger.error("Error setting base directory");
             }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/Fop.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/Fop.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/Fop.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/Fop.java Sun Jul 13 03:26:48
2008
@@ -444,14 +444,14 @@
         //Set base directory
         if (task.getBasedir() != null) {
             try {
-                this.baseURL = task.getBasedir().toURL().toExternalForm();
+                this.baseURL = task.getBasedir().toURI().toURL().toExternalForm();
             } catch (MalformedURLException mfue) {
                 logger.error("Error creating base URL from base directory", mfue);
             }
         } else {
             try {
                 if (task.getFofile() != null) {
-                    this.baseURL =  task.getFofile().getParentFile().toURL().
+                    this.baseURL =  task.getFofile().getParentFile().toURI().toURL().
                                       toExternalForm();
                 }
             } catch (MalformedURLException mfue) {
@@ -519,11 +519,11 @@
 
                 try {
                     if (task.getRelativebase()) {
-                        this.baseURL = f.getParentFile().toURL().
+                        this.baseURL = f.getParentFile().toURI().toURL().
                                          toExternalForm();
                     }
                     if (this.baseURL == null) {
-                        this.baseURL = fs.getDir(task.getProject()).toURL().
+                        this.baseURL = fs.getDir(task.getProject()).toURI().toURL().
                                           toExternalForm();
                     }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/RunTest.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/RunTest.java?rev=676297&r1=676296&r2=676297&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/RunTest.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/tools/anttasks/RunTest.java Sun Jul 13 03:26:48
2008
@@ -224,11 +224,11 @@
      */
     private URL[] createUrls(String mainJar) throws MalformedURLException {
         ArrayList urls = new ArrayList();
-        urls.add(new File(mainJar).toURL());
+        urls.add(new File(mainJar).toURI().toURL());
         File[] libFiles = new File("lib").listFiles();
         for (int i = 0; i < libFiles.length; i++) {
             if (libFiles[i].getPath().endsWith(".jar")) {
-                urls.add(libFiles[i].toURL());
+                urls.add(libFiles[i].toURI().toURL());
             }
         }
         return (URL[]) urls.toArray(new URL[urls.size()]);



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message