diff options
Diffstat (limited to 'src/java/org')
10 files changed, 27 insertions, 27 deletions
diff --git a/src/java/org/apache/fop/apps/FOURIResolver.java b/src/java/org/apache/fop/apps/FOURIResolver.java index 76b0bedd5..878a2745a 100644 --- a/src/java/org/apache/fop/apps/FOURIResolver.java +++ b/src/java/org/apache/fop/apps/FOURIResolver.java @@ -77,7 +77,7 @@ public class FOURIResolver implements javax.xml.transform.URIResolver { } 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 @@ public class FOURIResolver implements javax.xml.transform.URIResolver { 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 diff --git a/src/java/org/apache/fop/cli/InputHandler.java b/src/java/org/apache/fop/cli/InputHandler.java index b3ea35e0d..5e38b803a 100644 --- a/src/java/org/apache/fop/cli/InputHandler.java +++ b/src/java/org/apache/fop/cli/InputHandler.java @@ -112,7 +112,7 @@ public class InputHandler implements ErrorListener, Renderable { try { baseURL = new File(sourcefile.getAbsolutePath()). - getParentFile().toURL().toExternalForm(); + getParentFile().toURI().toURL().toExternalForm(); } catch (Exception e) { baseURL = ""; } diff --git a/src/java/org/apache/fop/cli/Main.java b/src/java/org/apache/fop/cli/Main.java index 545aef7ff..f1a23ea46 100644 --- a/src/java/org/apache/fop/cli/Main.java +++ b/src/java/org/apache/fop/cli/Main.java @@ -66,7 +66,7 @@ public class Main { + 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 @@ public class Main { 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 @@ public class Main { 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 @@ public class Main { } 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 @@ public class Main { } 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); } diff --git a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java b/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java index 521f3b81b..7711130b1 100644 --- a/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java +++ b/src/java/org/apache/fop/fo/extensions/svg/SVGElement.java @@ -92,7 +92,7 @@ public class SVGElement extends SVGObj { 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; diff --git a/src/java/org/apache/fop/hyphenation/HyphenationTree.java b/src/java/org/apache/fop/hyphenation/HyphenationTree.java index 67488c5b5..d145936c6 100644 --- a/src/java/org/apache/fop/hyphenation/HyphenationTree.java +++ b/src/java/org/apache/fop/hyphenation/HyphenationTree.java @@ -125,7 +125,7 @@ public class HyphenationTree extends TernaryTree 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: " diff --git a/src/java/org/apache/fop/hyphenation/PatternParser.java b/src/java/org/apache/fop/hyphenation/PatternParser.java index b0378a40b..2edf64676 100644 --- a/src/java/org/apache/fop/hyphenation/PatternParser.java +++ b/src/java/org/apache/fop/hyphenation/PatternParser.java @@ -92,7 +92,7 @@ public class PatternParser extends DefaultHandler implements PatternConsumer { */ 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: " diff --git a/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java b/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java index 77792267c..7951be26c 100644 --- a/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java +++ b/src/java/org/apache/fop/render/afp/fonts/AFPFontReader.java @@ -157,7 +157,7 @@ public final class AFPFontReader { 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 @@ public final class AFPFontReader { 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 @@ public final class AFPFontReader { 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 @@ public final class AFPFontReader { 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 " diff --git a/src/java/org/apache/fop/tools/TestConverter.java b/src/java/org/apache/fop/tools/TestConverter.java index 145f88187..5cbd3c095 100644 --- a/src/java/org/apache/fop/tools/TestConverter.java +++ b/src/java/org/apache/fop/tools/TestConverter.java @@ -274,7 +274,7 @@ public class TestConverter { 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"); } diff --git a/src/java/org/apache/fop/tools/anttasks/Fop.java b/src/java/org/apache/fop/tools/anttasks/Fop.java index 83217651e..da25478c3 100644 --- a/src/java/org/apache/fop/tools/anttasks/Fop.java +++ b/src/java/org/apache/fop/tools/anttasks/Fop.java @@ -444,14 +444,14 @@ class FOPTaskStarter { //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 @@ class FOPTaskStarter { 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(); } diff --git a/src/java/org/apache/fop/tools/anttasks/RunTest.java b/src/java/org/apache/fop/tools/anttasks/RunTest.java index b11c75242..2bc13e8b2 100644 --- a/src/java/org/apache/fop/tools/anttasks/RunTest.java +++ b/src/java/org/apache/fop/tools/anttasks/RunTest.java @@ -224,11 +224,11 @@ public class RunTest extends Task { */ 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()]); |