From: Finn Bock Date: Mon, 13 Sep 2004 07:08:49 +0000 (+0000) Subject: Avoid throwing exceptions from ctor, the logger is lost in that case. X-Git-Tag: Root_Temp_KnuthStylePageBreaking~549 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d6603609537ed8e97af8e34acdde4dca8381c419;p=xmlgraphics-fop.git Avoid throwing exceptions from ctor, the logger is lost in that case. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197946 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/apps/CommandLineOptions.java b/src/java/org/apache/fop/apps/CommandLineOptions.java index a2e8ebd9e..e344078ff 100644 --- a/src/java/org/apache/fop/apps/CommandLineOptions.java +++ b/src/java/org/apache/fop/apps/CommandLineOptions.java @@ -72,13 +72,9 @@ public class CommandLineOptions implements Constants { private Vector xsltParams = null; /** - * Construct a command line option object from command line arguments - * @param args command line parameters - * @throws FOPException for general errors - * @throws FileNotFoundException if an input file wasn't found - * @throws IOException if the the configuration file could not be loaded + * Construct a command line option object. */ - public CommandLineOptions(String[] args) throws FOPException, IOException { + public CommandLineOptions() { LogFactory logFactory = LogFactory.getFactory(); // Enable the simple command line logging when no other logger is @@ -90,11 +86,16 @@ public class CommandLineOptions implements Constants { } log = LogFactory.getLog("FOP"); - - parse(args); } - private void parse(String[] args) + /** + * Parse the command line arguments. + * @param args the command line arguments. + * @throws FOPException for general errors + * @throws FileNotFoundException if an input file wasn't found + * @throws IOException if the the configuration file could not be loaded + */ + public void parse(String[] args) throws FOPException, IOException { boolean optionsParsed = true; diff --git a/src/java/org/apache/fop/apps/Fop.java b/src/java/org/apache/fop/apps/Fop.java index b9b52ec43..90fb83d39 100644 --- a/src/java/org/apache/fop/apps/Fop.java +++ b/src/java/org/apache/fop/apps/Fop.java @@ -138,7 +138,8 @@ public class Fop implements Constants { BufferedOutputStream bos = null; try { - options = new CommandLineOptions(args); + options = new CommandLineOptions(); + options.parse(args); foUserAgent = options.getFOUserAgent(); Fop fop = new Fop(options.getRenderer(), foUserAgent);