From dbd7b4a8245dd84e9a745eb921291c3d91e6245c Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 18 Feb 2008 17:24:23 +0000 Subject: Made the necessary changes to remove the long-standing deprecations in the apps package as discussed. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@628826 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/apps/FopFactory.java | 36 +++++++++++++--------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'src/java/org/apache/fop/apps/FopFactory.java') diff --git a/src/java/org/apache/fop/apps/FopFactory.java b/src/java/org/apache/fop/apps/FopFactory.java index de4c43626..e6ac70d67 100644 --- a/src/java/org/apache/fop/apps/FopFactory.java +++ b/src/java/org/apache/fop/apps/FopFactory.java @@ -24,7 +24,6 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.net.MalformedURLException; -import java.net.URISyntaxException; import java.net.URL; import java.util.Collection; import java.util.Collections; @@ -195,7 +194,7 @@ public class FopFactory implements ImageContext { * @throws FOPException when the constructor fails */ public Fop newFop(String outputFormat) throws FOPException { - return new Fop(outputFormat, newFOUserAgent()); + return newFop(outputFormat, newFOUserAgent()); } /** @@ -212,10 +211,7 @@ public class FopFactory implements ImageContext { * @throws FOPException when the constructor fails */ public Fop newFop(String outputFormat, FOUserAgent userAgent) throws FOPException { - if (userAgent == null) { - throw new NullPointerException("The userAgent parameter must not be null!"); - } - return new Fop(outputFormat, userAgent); + return newFop(outputFormat, userAgent, null); } /** @@ -230,7 +226,7 @@ public class FopFactory implements ImageContext { * @throws FOPException when the constructor fails */ public Fop newFop(String outputFormat, OutputStream stream) throws FOPException { - return new Fop(outputFormat, newFOUserAgent(), stream); + return newFop(outputFormat, newFOUserAgent(), stream); } /** @@ -333,11 +329,10 @@ public class FopFactory implements ImageContext { } /** - * cleans the base url - * @param base - * @return - * @throws MalformedURLException - * @throws URISyntaxException + * Checks if the given base URL is acceptable. It also normalizes the URL. + * @param base the base URL to check + * @return the normalized URL + * @throws MalformedURLException if there's a problem with a file URL */ private String checkBaseURL(String base) throws MalformedURLException { if (!base.endsWith("/")) { @@ -364,8 +359,7 @@ public class FopFactory implements ImageContext { /** * Sets the base URL. * @param base base URL - * @throws MalformedURLException - * @throws URISyntaxException + * @throws MalformedURLException if there's a problem with a file URL */ public void setBaseURL(String base) throws MalformedURLException { this.base = checkBaseURL(base); @@ -382,8 +376,7 @@ public class FopFactory implements ImageContext { /** * Sets the font base URL. * @param fontBase font base URL - * @throws MalformedURLException - * @throws URISyntaxException + * @throws MalformedURLException if there's a problem with a file URL */ public void setFontBaseURL(String fontBase) throws MalformedURLException { this.fontBase = checkBaseURL(fontBase); @@ -402,8 +395,7 @@ public class FopFactory implements ImageContext { /** * Sets the hyphen base URL. * @param hyphenBase hythen base URL - * @throws MalformedURLException - * @throws URISyntaxException + * @throws MalformedURLException if there's a problem with a file URL * */ public void setHyphenBaseURL(final String hyphenBase) throws MalformedURLException { if (hyphenBase != null) { @@ -440,8 +432,8 @@ public class FopFactory implements ImageContext { } /** - * sets the HyphenationTreeResolver - * @param hyphResolver + * Sets the HyphenationTreeResolver to be used for resolving user-supplied hyphenation files. + * @param hyphResolver the HyphenationTreeResolver instance */ public void setHyphenationTreeResolver(HyphenationTreeResolver hyphResolver) { this.hyphResolver = hyphResolver; @@ -724,6 +716,10 @@ public class FopFactory implements ImageContext { return (this.fontCache != null); } + /** + * Returns the font cache instance used by this factory. + * @return the font cache + */ public FontCache getFontCache() { return this.fontCache; } -- cgit v1.2.3