[FOray-commit] SF.net SVN: foray: [7781] trunk/foray/foray-app/src/java/org/foray/app
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-07-15 21:09:23
|
Revision: 7781 Author: victormote Date: 2006-07-15 14:08:38 -0700 (Sat, 15 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7781&view=rev Log Message: ----------- Use new URL factory methods instead of URL constructors. Modified Paths: -------------- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java trunk/foray/foray-common/src/java/org/foray/common/Configuration.java trunk/foray/foray-common/src/java/org/foray/common/URLBuilder.java trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java Modified: trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-app/src/java/org/foray/app/CommandLineOptions.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -25,6 +25,7 @@ package org.foray.app; import org.foray.common.Logging; +import org.foray.common.url.URLFactory; import org.foray.core.FOInputHandler; import org.foray.core.FOrayException; import org.foray.core.InputHandler; @@ -141,7 +142,8 @@ + "specify the name of the configuration file"); } try { - this.userConfigFile = new URL(args[currentArgument + 1]); + this.userConfigFile = URLFactory.createURL( + args[currentArgument + 1]); } catch (MalformedURLException e) { throw new FOrayException(e); } Modified: trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-app/src/java/org/foray/app/FOraySpecific.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -27,6 +27,7 @@ import org.foray.area.FOrayAreaTreeFactory; import org.foray.common.Logging; import org.foray.common.XMLParser; +import org.foray.common.url.URLFactory; import org.foray.core.FOrayException; import org.foray.core.FOraySession; import org.foray.core.SessionConfig; @@ -149,7 +150,7 @@ urls[0] = configuration.getBaseDocument(); urls[1] = configuration.optionBaseDirectory(); try { - urls[2] = new URL(System.getProperty("user.dir")); + urls[2] = URLFactory.createURL(System.getProperty("user.dir")); } catch (MalformedURLException e) { // Ignore this -- just leave the null value in the array } Modified: trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java =================================================================== --- trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-app/src/java/org/foray/app/ant/RunTest.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -25,6 +25,7 @@ package org.foray.app.ant; import org.foray.common.Logging; +import org.foray.common.url.URLFactory; import org.apache.commons.logging.Log; import org.apache.tools.ant.BuildException; @@ -89,7 +90,7 @@ Log logger = Logging.makeDefaultLogger(); try { ClassLoader loader = new URLClassLoader(new URL[] { - new URL("file:build/fop.jar") + URLFactory.createURL("file:build/fop.jar") }); HashMap diff = runConverter(loader, "areatree", "reference/output/"); @@ -133,7 +134,7 @@ // } else { try { ClassLoader loader = new URLClassLoader(new URL[] { - new URL("file:" + referenceJar) + URLFactory.createURL("file:" + referenceJar) }); boolean failed = false; Modified: trunk/foray/foray-common/src/java/org/foray/common/Configuration.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-common/src/java/org/foray/common/Configuration.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -24,6 +24,8 @@ package org.foray.common; +import org.foray.common.url.URLFactory; + import org.apache.commons.logging.Log; import java.io.File; @@ -224,13 +226,13 @@ URL baseURL = null; try { if (directory == null) { - return new URL("."); + return URLFactory.createURL("."); } File dir = new File(directory); if (dir.isDirectory()) { return dir.toURL(); } - baseURL = new URL(directory); + baseURL = URLFactory.createURL(directory); } catch (MalformedURLException e) { this.getLogger().error("Invalid " + key + ": " + directory + " (" + e.getMessage() + ")"); Modified: trunk/foray/foray-common/src/java/org/foray/common/URLBuilder.java =================================================================== --- trunk/foray/foray-common/src/java/org/foray/common/URLBuilder.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-common/src/java/org/foray/common/URLBuilder.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -24,6 +24,8 @@ package org.foray.common; +import org.foray.common.url.URLFactory; + import java.io.File; import java.net.MalformedURLException; import java.net.URL; @@ -59,7 +61,7 @@ if (f.exists()) { return f.toURL(); } - return new URL(spec); + return URLFactory.createURL(spec); } @@ -84,7 +86,7 @@ if (baseURL == null) { throw mfue; } - URL u2 = new URL(baseURL, spec); + URL u2 = URLFactory.createURL(baseURL, spec); return u2; } } @@ -131,7 +133,7 @@ // Try the raw urlSpecified first. try { - newURL = new URL(urlSpecified); + newURL = URLFactory.createURL(urlSpecified); } catch (MalformedURLException e) { // Ignore. } @@ -142,7 +144,7 @@ // Try it with the "file" protocol prepended. newURL = null; try { - newURL = new URL("file:" + urlSpecified); + newURL = URLFactory.createURL("file:" + urlSpecified); } catch (MalformedURLException e) { // Ignore. } @@ -186,7 +188,7 @@ relativeURL = relativeURL.substring(scheme.length()); } try { - newURL = new URL(baseURL, relativeURL); + newURL = URLFactory.createURL(baseURL, relativeURL); } catch (MalformedURLException e1) { // Ignore } Modified: trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java =================================================================== --- trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-core/src/java/org/foray/core/InputHandler.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -26,6 +26,8 @@ +import org.foray.common.url.URLFactory; + import org.apache.commons.logging.Log; import org.xml.sax.InputSource; @@ -71,7 +73,8 @@ path = '/' + path; } try { - return new InputSource(new URL("file", null, path).toString()); + return new InputSource(URLFactory.createURL("file", null, + path).toString()); } catch (MalformedURLException e) { throw new Error("unexpected MalformedURLException"); } Modified: trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -27,6 +27,7 @@ import org.foray.common.Environment; import org.foray.common.RandomReader; import org.foray.common.URLBuilder; +import org.foray.common.url.URLFactory; import org.foray.ps.encode.EncodingParser; import org.foray.ps.encode.EncodingVector; import org.foray.ps.encode.GlyphList; @@ -136,7 +137,7 @@ this.fontServer = server; this.filename = filename; try { - this.currentXMLBase = new URL("file", null, "."); + this.currentXMLBase = URLFactory.createURL("file", null, "."); } catch (MalformedURLException e) { /* This shouldn't fail, but if it does, there isn't much that can * be done. */ @@ -467,7 +468,8 @@ URL fontFileURL = null; if (fontFile != null) { try { - fontFileURL = new URL(this.currentXMLBase, fontFile); + fontFileURL = URLFactory.createURL(this.currentXMLBase, + fontFile); } catch (MalformedURLException e) { this.logError("Malformed URL in font configuration:\n" + " " + fontFile); @@ -480,7 +482,8 @@ URL metricsFileURL = null; if (metricsFile != null) { try { - metricsFileURL = new URL(this.currentXMLBase, metricsFile); + metricsFileURL = URLFactory.createURL(this.currentXMLBase, + metricsFile); } catch (MalformedURLException e) { this.logError("Malformed URL in font configuration:\n" + " " + metricsFile); @@ -635,7 +638,7 @@ if (dir.isDirectory()) { this.currentXMLBase = dir.toURL(); } else { - this.currentXMLBase = new URL(directory); + this.currentXMLBase = URLFactory.createURL(directory); } } catch (MalformedURLException e1) { logError("Cannot create URL from current directory: " @@ -645,7 +648,7 @@ } try { String modifiedBase = replaceParameters(this.parsedRootXMLBase); - this.currentXMLBase = new URL(modifiedBase); + this.currentXMLBase = URLFactory.createURL(modifiedBase); } catch (MalformedURLException e) { logError("Cannot create URL from: " + this.parsedRootXMLBase); } @@ -672,7 +675,7 @@ } URL url; try { - url = new URL(encodingFile); + url = URLFactory.createURL(encodingFile); } catch (MalformedURLException e) { logError("Unable to create URL: " + encodingFile); return; @@ -736,7 +739,7 @@ } URL url; try { - url = new URL(file); + url = URLFactory.createURL(file); } catch (MalformedURLException e) { logError("Unable to create URL: " + file); return; Modified: trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -27,6 +27,7 @@ import org.foray.common.Logging; import org.foray.common.RandomReader; import org.foray.common.StringUtil; +import org.foray.common.url.URLFactory; import org.foray.ps.encode.EncodingParser; import org.foray.ps.encode.GlyphList; @@ -220,7 +221,7 @@ } URL url = null; try { - url = new URL(args[0]); + url = URLFactory.createURL(args[0]); } catch (MalformedURLException e) { logger.error("Unable to create URL for: " + args[0] + "\n"); logger.error(" " + e.getMessage()); Modified: trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java =================================================================== --- trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-hyphen-r/src/java/org/foray/hyphenR/PatternParser.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -25,6 +25,7 @@ package org.foray.hyphenR; import org.foray.common.Logging; +import org.foray.common.url.URLFactory; import org.axsl.hyphenR.HyphenationException; @@ -40,7 +41,6 @@ import java.io.File; import java.io.IOException; import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; /** @@ -146,7 +146,8 @@ path = '/' + path; } try { - return new InputSource(new URL("file", null, path).toString()); + return new InputSource(URLFactory.createURL("file", null, + path).toString()); } catch (MalformedURLException e) { throw new HyphenationException("unexpected MalformedURLException"); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFImageElementBridge.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -49,7 +49,8 @@ Element e, ParsedURL purl) { try { - JpegImage jpeg = new JpegImage(new URL(purl.toString())); + JpegImage jpeg = new JpegImage(URLFactory.createURL( + purl.toString())); PDFFilter filter = jpeg.getPDFFilter(); PDFJpegNode node = new PDFJpegNode(jpeg); Rectangle2D bounds = node.getPrimitiveBounds(); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFTranscoder.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -24,6 +24,8 @@ package org.foray.pdf.svg.batik; +import org.foray.common.url.URLFactory; + import org.axsl.fontR.FontUse; import org.axsl.pdfW.PDFException; @@ -62,7 +64,6 @@ import java.awt.geom.Dimension2D; import java.awt.geom.Rectangle2D; import java.net.MalformedURLException; -import java.net.URL; /** * This class enables to transcode an input to a pdf document. @@ -202,7 +203,7 @@ AffineTransform Px; String ref = null; try { - ref = new URL(uri).getRef(); + ref = URLFactory.createURL(uri).getRef(); } catch (MalformedURLException ex) { // nothing to do, catched previously } Modified: trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java =================================================================== --- trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-pretty/src/java/org/foray/pretty/FOrayXDiff.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -26,6 +26,7 @@ import org.foray.common.StringUtil; import org.foray.common.XMLUtil; +import org.foray.common.url.URLFactory; import java.io.IOException; import java.io.InputStream; @@ -482,14 +483,14 @@ URL[] urlsToCompare = new URL[args.length]; URL context = null; try { - context = new URL("file", null, "."); + context = URLFactory.createURL("file", null, "."); } catch (MalformedURLException e1) { System.out.println("Unable to get URL context."); } for (int i = 0; i < args.length; i++) { URL url = null; try { - url = new URL(context, args[i]); + url = URLFactory.createURL(context, args[i]); } catch (MalformedURLException e) { System.out.println("Malformed URL: " + args[i]); System.exit(1); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -27,6 +27,7 @@ import org.foray.common.Logging; import org.foray.common.RandomReader; import org.foray.common.StringUtil; +import org.foray.common.url.URLFactory; import org.apache.commons.logging.Log; @@ -442,7 +443,7 @@ } URL url = null; try { - url = new URL(args[0]); + url = URLFactory.createURL(args[0]); } catch (MalformedURLException e) { logger.error("Unable to create URL for: " + args[0] + "\n"); logger.error(" " + e.getMessage()); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -26,6 +26,7 @@ import org.foray.common.Logging; import org.foray.common.RandomReader; +import org.foray.common.url.URLFactory; import org.apache.commons.logging.Log; @@ -337,7 +338,7 @@ } URL url = null; try { - url = new URL(args[0]); + url = URLFactory.createURL(args[0]); } catch (MalformedURLException e) { logger.error("Unable to create URL for: " + args[0] + "\n"); logger.error(" " + e.getMessage()); Modified: trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-render/src/java/org/foray/render/awt/AWTRenderer.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -24,6 +24,7 @@ package org.foray.render.awt; +import org.foray.common.url.URLFactory; import org.foray.output.OutputConfig; import org.foray.render.Renderer; import org.foray.render.awt.viewer.ProgressListener; @@ -532,7 +533,7 @@ String urlString = img.getURL().toString(); try { - URL url = new URL(urlString); + URL url = URLFactory.createURL(urlString); ImageIcon icon = new ImageIcon(url); Image image = icon.getImage(); @@ -843,7 +844,7 @@ * float height, Vector transform) { * // What is with transformations? * try { - * URL url = new URL(href); + * URL url = URLFactory.createURL(href); * ImageIcon imageIcon = new ImageIcon(url); * AffineTransform fullTransform = new AffineTransform(); * AffineTransform aTransform; Modified: trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java =================================================================== --- trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2006-07-15 21:07:38 UTC (rev 7780) +++ trunk/foray/foray-render/src/java/org/foray/render/svg/SVGRenderer.java 2006-07-15 21:08:38 UTC (rev 7781) @@ -373,7 +373,7 @@ // // String urlString = img.getURL().toString(); // try { -// URL url = new URL(urlString); +// URL url = URLFactory.createURL(urlString); // // ImageIcon icon = new ImageIcon(url); // Image image = icon.getImage(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |