From: fotis Date: Tue, 27 Jun 2000 22:14:35 +0000 (+0000) Subject: replaces calls of System.err.println etc. with calls to the new MessageHandler methods X-Git-Tag: pre-columns~436 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f11bad903dbef3d04d48b3a219fb0adb139ce953;p=xmlgraphics-fop.git replaces calls of System.err.println etc. with calls to the new MessageHandler methods git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193441 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/codegen/charlist.xml b/src/codegen/charlist.xml index 6483e279d..15700eb6e 100644 --- a/src/codegen/charlist.xml +++ b/src/codegen/charlist.xml @@ -450,196 +450,184 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + TBD: remove doublettes --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/codegen/properties.xsl b/src/codegen/properties.xsl index 2f85784dc..214c9cb23 100644 --- a/src/codegen/properties.xsl +++ b/src/codegen/properties.xsl @@ -13,6 +13,7 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.*; import org.apache.fop.fo.*; import org.apache.fop.apps.FOPException; +import org.apache.fop.messaging.MessageHandler; public class extends Property { @@ -80,6 +81,7 @@ package org.apache.fop.fo.properties; import org.apache.fop.datatypes.*; import org.apache.fop.fo.*; import org.apache.fop.apps.FOPException; +import org.apache.fop.messaging.MessageHandler; public class extends Property { @@ -94,7 +96,7 @@ public class extends Property { if (value.equals("")) { v = ; } else { - System.err.println("WARNING: Unknown value for : " + value); + MessageHandler.errorln("WARNING: Unknown value for : " + value); return make(propertyList, ""); } return new (propertyList, v); diff --git a/src/org/apache/fop/apps/AWTCommandLine.java b/src/org/apache/fop/apps/AWTCommandLine.java index e9da9c501..3350ec767 100644 --- a/src/org/apache/fop/apps/AWTCommandLine.java +++ b/src/org/apache/fop/apps/AWTCommandLine.java @@ -6,11 +6,11 @@ package org.apache.fop.apps; Rainer Steinkuhle: Rainer.Steinkuhle@jcatalog.com, Stanislav Gorkhover: Stanislav.Gorkhover@jcatalog.com */ - - +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.viewer.*; import org.apache.fop.render.awt.*; + import javax.swing.UIManager; import java.awt.*; @@ -72,7 +72,7 @@ public class AWTCommandLine { if (parser == null) { - System.err.println("ERROR: Unable to create SAX parser"); + MessageHandler.errorln("ERROR: Unable to create SAX parser"); System.exit(1); } @@ -102,8 +102,8 @@ public class AWTCommandLine { frame.progress(resource.getString("Show")); } catch (Exception e) { - System.err.println("FATAL ERROR: " + e.getMessage()); - e.printStackTrace(); + MessageHandler.errorln("FATAL ERROR: " + e.getMessage()); + e.printStackTrace(); System.exit(1); } } @@ -115,20 +115,20 @@ public class AWTCommandLine { if (parserClassName == null) { parserClassName = "com.jclark.xml.sax.Driver"; } - System.err.println("using SAX parser " + parserClassName); + MessageHandler.errorln("using SAX parser " + parserClassName); try { return (Parser) Class.forName(parserClassName).newInstance(); } catch (ClassNotFoundException e) { - System.err.println("Could not find " + parserClassName); + MessageHandler.errorln("Could not find " + parserClassName); } catch (InstantiationException e) { - System.err.println("Could not instantiate " + MessageHandler.errorln("Could not instantiate " + parserClassName); } catch (IllegalAccessException e) { - System.err.println("Could not access " + parserClassName); + MessageHandler.errorln("Could not access " + parserClassName); } catch (ClassCastException e) { - System.err.println(parserClassName + " is not a SAX driver"); + MessageHandler.errorln(parserClassName + " is not a SAX driver"); } return null; } @@ -186,7 +186,7 @@ public class AWTCommandLine { URL url = getClass().getResource(path); in = url.openStream(); } catch(Exception ex) { - System.out.println("Can't find URL to: <" + path + "> " + ex.getMessage()); + MessageHandler.logln("Can't find URL to: <" + path + "> " + ex.getMessage()); } return new SecureResourceBundle(in); } @@ -205,9 +205,9 @@ public class AWTCommandLine { String language = null; String imageDir = null; - System.err.println(Version.getVersion()); + MessageHandler.errorln(Version.getVersion()); if (args.length < 1 || args.length > 3) { - System.err.println("usage: java AWTCommandLine " + + MessageHandler.errorln("usage: java AWTCommandLine " + "formatting-object-file [language] "); System.exit(1); } diff --git a/src/org/apache/fop/apps/CommandLine.java b/src/org/apache/fop/apps/CommandLine.java index 82720499f..8fa6dc08f 100644 --- a/src/org/apache/fop/apps/CommandLine.java +++ b/src/org/apache/fop/apps/CommandLine.java @@ -65,6 +65,10 @@ import java.io.IOException; import java.io.FileNotFoundException; import java.net.URL; +// FOP +import org.apache.fop.messaging.MessageHandler; + + /** * mainline class. * @@ -86,20 +90,20 @@ public class CommandLine { if (parserClassName == null) { parserClassName = "org.apache.xerces.parsers.SAXParser"; } - System.err.println("using SAX parser " + parserClassName); + org.apache.fop.messaging.MessageHandler.logln("using SAX parser " + parserClassName); try { return (Parser) Class.forName(parserClassName).newInstance(); } catch (ClassNotFoundException e) { - System.err.println("Could not find " + parserClassName); + org.apache.fop.messaging.MessageHandler.errorln("Could not find " + parserClassName); } catch (InstantiationException e) { - System.err.println("Could not instantiate " + org.apache.fop.messaging.MessageHandler.errorln("Could not instantiate " + parserClassName); } catch (IllegalAccessException e) { - System.err.println("Could not access " + parserClassName); + org.apache.fop.messaging.MessageHandler.errorln("Could not access " + parserClassName); } catch (ClassCastException e) { - System.err.println(parserClassName + " is not a SAX driver"); + org.apache.fop.messaging.MessageHandler.errorln(parserClassName + " is not a SAX driver"); } return null; } @@ -139,10 +143,12 @@ public class CommandLine { */ public static void main(String[] args) { String version = Version.getVersion(); - System.err.println(version); + MessageHandler.errorln(version); + + if (args.length != 2) { - System.err.println("usage: java " + MessageHandler.errorln("usage: java " + "org.apache.fop.apps.CommandLine " + "formatting-object-file pdf-file"); System.exit(1); @@ -151,7 +157,7 @@ public class CommandLine { Parser parser = createParser(); if (parser == null) { - System.err.println("ERROR: Unable to create SAX parser"); + MessageHandler.errorln("ERROR: Unable to create SAX parser"); System.exit(1); } @@ -165,7 +171,7 @@ public class CommandLine { driver.format(); driver.render(); } catch (Exception e) { - System.err.println("FATAL ERROR: " + e.getMessage()); + MessageHandler.errorln("FATAL ERROR: " + e.getMessage()); System.exit(1); } } diff --git a/src/org/apache/fop/apps/Driver.java b/src/org/apache/fop/apps/Driver.java index f2a185569..27e471c93 100644 --- a/src/org/apache/fop/apps/Driver.java +++ b/src/org/apache/fop/apps/Driver.java @@ -57,6 +57,7 @@ import org.apache.fop.fo.ElementMapping; import org.apache.fop.layout.AreaTree; import org.apache.fop.layout.FontInfo; import org.apache.fop.render.Renderer; +import org.apache.fop.messaging.MessageHandler; // DOM import org.w3c.dom.Document; @@ -149,20 +150,20 @@ public class Driver { * instantiate the Renderer class */ protected Renderer createRenderer(String rendererClassName) { - System.err.println("using renderer " + rendererClassName); + MessageHandler.logln("using renderer " + rendererClassName); try { return (Renderer) Class.forName(rendererClassName).newInstance(); } catch (ClassNotFoundException e) { - System.err.println("Could not find " + rendererClassName); + MessageHandler.errorln("Could not find " + rendererClassName); } catch (InstantiationException e) { - System.err.println("Could not instantiate " + MessageHandler.errorln("Could not instantiate " + rendererClassName); } catch (IllegalAccessException e) { - System.err.println("Could not access " + rendererClassName); + MessageHandler.errorln("Could not access " + rendererClassName); } catch (ClassCastException e) { - System.err.println(rendererClassName + " is not a renderer"); + MessageHandler.errorln(rendererClassName + " is not a renderer"); } return null; } @@ -188,20 +189,20 @@ public class Driver { * instantiate element mapping class */ protected ElementMapping createElementMapping(String mappingClassName) { - System.err.println("using element mapping " + mappingClassName); + MessageHandler.logln("using element mapping " + mappingClassName); try { return (ElementMapping) Class.forName(mappingClassName).newInstance(); } catch (ClassNotFoundException e) { - System.err.println("Could not find " + mappingClassName); + MessageHandler.errorln("Could not find " + mappingClassName); } catch (InstantiationException e) { - System.err.println("Could not instantiate " + MessageHandler.errorln("Could not instantiate " + mappingClassName); } catch (IllegalAccessException e) { - System.err.println("Could not access " + mappingClassName); + MessageHandler.errorln("Could not access " + mappingClassName); } catch (ClassCastException e) { - System.err.println(mappingClassName + " is not an element mapping"); + MessageHandler.errorln(mappingClassName + " is not an element mapping"); } return null; } diff --git a/src/org/apache/fop/apps/PDFOutputHandler.java b/src/org/apache/fop/apps/PDFOutputHandler.java index 8ca1671ce..04b50242c 100644 --- a/src/org/apache/fop/apps/PDFOutputHandler.java +++ b/src/org/apache/fop/apps/PDFOutputHandler.java @@ -10,6 +10,7 @@ import org.apache.fop.fo.ElementMapping; import org.apache.fop.layout.AreaTree; import org.apache.fop.layout.FontInfo; import org.apache.fop.render.Renderer; +import org.apache.fop.messaging.MessageHandler; ////////////////////////////////////////////////////////////////////////////////////// /** @@ -138,20 +139,20 @@ public class PDFOutputHandler extends FOTreeBuilder implements OutputDocumentHan * instantiate element mapping class */ protected ElementMapping createElementMapping(String mappingClassName) { - System.err.println("using element mapping " + mappingClassName); + MessageHandler.logln("using element mapping " + mappingClassName); try { return (ElementMapping) Class.forName(mappingClassName).newInstance(); } catch (ClassNotFoundException e) { - System.err.println("Could not find " + mappingClassName); + MessageHandler.errorln("Could not find " + mappingClassName); } catch (InstantiationException e) { - System.err.println("Could not instantiate " + MessageHandler.errorln("Could not instantiate " + mappingClassName); } catch (IllegalAccessException e) { - System.err.println("Could not access " + mappingClassName); + MessageHandler.errorln("Could not access " + mappingClassName); } catch (ClassCastException e) { - System.err.println(mappingClassName + " is not an element mapping"); + MessageHandler.errorln(mappingClassName + " is not an element mapping"); } return null; } @@ -162,20 +163,20 @@ public class PDFOutputHandler extends FOTreeBuilder implements OutputDocumentHan * instantiate the Renderer class */ protected Renderer createRenderer(String rendererClassName) { - System.err.println("using renderer " + rendererClassName); + MessageHandler.logln("using renderer " + rendererClassName); try { return (Renderer) Class.forName(rendererClassName).newInstance(); } catch (ClassNotFoundException e) { - System.err.println("Could not find " + rendererClassName); + MessageHandler.errorln("Could not find " + rendererClassName); } catch (InstantiationException e) { - System.err.println("Could not instantiate " + MessageHandler.errorln("Could not instantiate " + rendererClassName); } catch (IllegalAccessException e) { - System.err.println("Could not access " + rendererClassName); + MessageHandler.errorln("Could not access " + rendererClassName); } catch (ClassCastException e) { - System.err.println(rendererClassName + " is not a renderer"); + MessageHandler.errorln(rendererClassName + " is not a renderer"); } return null; } diff --git a/src/org/apache/fop/apps/PrintCommandLine.java b/src/org/apache/fop/apps/PrintCommandLine.java index 338b9478d..1b286b4d1 100755 --- a/src/org/apache/fop/apps/PrintCommandLine.java +++ b/src/org/apache/fop/apps/PrintCommandLine.java @@ -21,6 +21,7 @@ import java.util.Vector; import org.apache.fop.render.awt.AWTRenderer; import org.apache.fop.layout.AreaTree; import org.apache.fop.layout.Page; +import org.apache.fop.messaging.MessageHandler; /** @@ -40,10 +41,10 @@ public class PrintCommandLine extends CommandLine { public static void main(String[] args) { String version = Version.getVersion(); - System.err.println(version); + MessageHandler.errorln(version); if (args.length != 1) { - System.err.println("usage: java [-Dstart=i] [-Dend=i]" + MessageHandler.errorln("usage: java [-Dstart=i] [-Dend=i]" + " [-Dcopies=i] [-Deven=true|false]" + " org.apache.fop.apps.PrintCommandLine formatting-object-file"); System.exit(1); @@ -52,7 +53,7 @@ public class PrintCommandLine extends CommandLine { Parser parser = createParser(); if (parser == null) { - System.err.println("ERROR: Unable to create SAX parser"); + MessageHandler.errorln("ERROR: Unable to create SAX parser"); System.exit(1); } @@ -67,7 +68,7 @@ public class PrintCommandLine extends CommandLine { driver.format(); driver.render(); } catch (Exception e) { - System.err.println("FATAL ERROR: " + e.getMessage()); + MessageHandler.errorln("FATAL ERROR: " + e.getMessage()); System.exit(1); } diff --git a/src/org/apache/fop/apps/XTCommandLine.java b/src/org/apache/fop/apps/XTCommandLine.java index 71e4d4a97..c52f68816 100644 --- a/src/org/apache/fop/apps/XTCommandLine.java +++ b/src/org/apache/fop/apps/XTCommandLine.java @@ -54,6 +54,7 @@ package org.apache.fop.apps; import org.apache.fop.render.pdf.PDFRenderer; import org.apache.fop.fo.StandardElementMapping; import org.apache.fop.svg.SVGElementMapping; +import org.apache.fop.messaging.MessageHandler; // James Clark import com.jclark.xsl.sax.XSLProcessor; @@ -92,17 +93,17 @@ public class XTCommandLine extends CommandLine { */ public static void main(String[] args) { String version = Version.getVersion(); - System.err.println(version); + MessageHandler.errorln(version); if (args.length != 3) { - System.err.println("usage: java org.apache.fop.apps.XTCommandLine xml-file xsl-stylesheet pdf-file"); + MessageHandler.errorln("usage: java org.apache.fop.apps.XTCommandLine xml-file xsl-stylesheet pdf-file"); System.exit(1); } Parser parser = createParser(); if (parser == null) { - System.err.println("ERROR: Unable to create SAX parser"); + MessageHandler.errorln("ERROR: Unable to create SAX parser"); System.exit(1); } @@ -122,7 +123,7 @@ public class XTCommandLine extends CommandLine { driver.format(); driver.render(); } catch (Exception e) { - System.err.println("FATAL ERROR: " + e.getMessage()); + MessageHandler.errorln("FATAL ERROR: " + e.getMessage()); System.exit(1); } } diff --git a/src/org/apache/fop/datatypes/ColorType.java b/src/org/apache/fop/datatypes/ColorType.java index 036f20190..1bab0ced0 100644 --- a/src/org/apache/fop/datatypes/ColorType.java +++ b/src/org/apache/fop/datatypes/ColorType.java @@ -51,6 +51,7 @@ package org.apache.fop.datatypes; import java.util.*; +import org.apache.fop.messaging.MessageHandler; /** * a colour quantity in XSL @@ -90,13 +91,13 @@ public class ColorType { this.red = 0; this.green = 0; this.blue = 0; - System.err.println("ERROR: unknown colour format. Must be #RGB or #RRGGBB"); + MessageHandler.errorln("ERROR: unknown colour format. Must be #RGB or #RRGGBB"); } } catch (Exception e) { this.red = 0; this.green = 0; this.blue = 0; - System.err.println("ERROR: unknown colour format. Must be #RGB or #RRGGBB"); + MessageHandler.errorln("ERROR: unknown colour format. Must be #RGB or #RRGGBB"); } } else if (value.startsWith("rgb(")) { int poss = value.indexOf("("); @@ -133,7 +134,7 @@ public class ColorType { this.red = 0; this.green = 0; this.blue = 0; - System.err.println("ERROR: unknown colour format. Must be #RGB or #RRGGBB"); + MessageHandler.errorln("ERROR: unknown colour format. Must be #RGB or #RRGGBB"); } } } else if (value.startsWith("url(")) { @@ -217,7 +218,7 @@ public class ColorType { this.red = 0; this.green = 0; this.blue = 0; - System.err.println("ERROR: unknown colour name: " + value); + MessageHandler.errorln("ERROR: unknown colour name: " + value); } } } diff --git a/src/org/apache/fop/datatypes/Length.java b/src/org/apache/fop/datatypes/Length.java index 082bfd930..7a9aca55c 100644 --- a/src/org/apache/fop/datatypes/Length.java +++ b/src/org/apache/fop/datatypes/Length.java @@ -51,6 +51,7 @@ package org.apache.fop.datatypes; import org.apache.fop.fo.Property; +import org.apache.fop.messaging.MessageHandler; /** * a length quantity in XSL @@ -95,7 +96,7 @@ public class Length { int l = len.length(); if (l == 0) { - System.err.println("WARNING: empty length"); + MessageHandler.errorln("WARNING: empty length"); this.millipoints = 0; } else if (len.equals("auto")) { this.auto = true; @@ -120,7 +121,7 @@ public class Length { dvalue = dvalue * assumed_resolution; else { dvalue = 0; - System.err.println("ERROR: unknown length units in " + MessageHandler.errorln("ERROR: unknown length units in " + len); } diff --git a/src/org/apache/fop/fo/FOText.java b/src/org/apache/fop/fo/FOText.java index a35b16486..d3f4a8740 100644 --- a/src/org/apache/fop/fo/FOText.java +++ b/src/org/apache/fop/fo/FOText.java @@ -53,6 +53,7 @@ package org.apache.fop.fo; // FOP import org.apache.fop.layout.Area; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.layout.BlockArea; import org.apache.fop.layout.FontState; import org.apache.fop.datatypes.*; @@ -86,7 +87,7 @@ public class FOText extends FONode { public Status layout(Area area) throws FOPException { if (!(area instanceof BlockArea)) { - System.err.println("WARNING: text outside block area" + new String(ca, start, length)); + MessageHandler.errorln("WARNING: text outside block area" + new String(ca, start, length)); return new Status(Status.OK); } if (this.marker == START) { diff --git a/src/org/apache/fop/fo/FOTreeBuilder.java b/src/org/apache/fop/fo/FOTreeBuilder.java index 0d3bc52ea..d00308588 100644 --- a/src/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/org/apache/fop/fo/FOTreeBuilder.java @@ -52,6 +52,7 @@ package org.apache.fop.fo; // FOP import org.apache.fop.layout.AreaTree; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.apps.FOPException; import org.apache.fop.fo.pagination.Root; @@ -178,7 +179,7 @@ public class FOTreeBuilder extends HandlerBase { /** SAX Handler for the start of the document */ public void startDocument() { - System.err.println("building formatting object tree"); + MessageHandler.logln("building formatting object tree"); } /** SAX Handler for the start of an element */ @@ -212,7 +213,7 @@ public class FOTreeBuilder extends HandlerBase { if (fobjMaker == null) { if (!this.unknownFOs.containsKey(fullName)) { this.unknownFOs.put(fullName, ""); - System.err.println("WARNING: Unknown formatting object " + MessageHandler.errorln("WARNING: Unknown formatting object " + fullName); } fobjMaker = new FObjMixed.Maker(); // fall back @@ -248,7 +249,7 @@ public class FOTreeBuilder extends HandlerBase { */ public void format(AreaTree areaTree) throws FOPException { - System.err.println("formatting FOs into areas"); + MessageHandler.logln("formatting FOs into areas"); ((Root) this.rootFObj).format(areaTree); } } diff --git a/src/org/apache/fop/fo/PropertyList.java b/src/org/apache/fop/fo/PropertyList.java index ca53e2b0b..cd9a2566e 100644 --- a/src/org/apache/fop/fo/PropertyList.java +++ b/src/org/apache/fop/fo/PropertyList.java @@ -51,6 +51,7 @@ package org.apache.fop.fo; import java.util.Hashtable; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.apps.FOPException; @@ -65,7 +66,7 @@ public class PropertyList extends Hashtable { public Property get(String propertyName) { if (builder == null) - System.err.println("OH OH, builder has not been set"); + MessageHandler.errorln("OH OH, builder has not been set"); Property p = (Property)super.get(propertyName); if (p == null) { // if not explicit diff --git a/src/org/apache/fop/fo/PropertyListBuilder.java b/src/org/apache/fop/fo/PropertyListBuilder.java index 7d2ab6aa8..70f9e80ce 100644 --- a/src/org/apache/fop/fo/PropertyListBuilder.java +++ b/src/org/apache/fop/fo/PropertyListBuilder.java @@ -52,6 +52,7 @@ package org.apache.fop.fo; import org.apache.fop.fo.properties.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.svg.*; import org.apache.fop.apps.FOPException; @@ -177,7 +178,7 @@ public class PropertyListBuilder { if (propertyMaker != null) { p = propertyMaker.compute(propertyList); } else { - System.err.println("WARNING: property " + propertyName + " ignored"); + MessageHandler.errorln("WARNING: property " + propertyName + " ignored"); } return p; } @@ -189,7 +190,7 @@ public class PropertyListBuilder { if (propertyMaker != null) { b = propertyMaker.isInherited(); } else { - //System.err.println("WARNING: Unknown property " + propertyName); + //MessageHandler.errorln("WARNING: Unknown property " + propertyName); b = true; } return b; @@ -206,7 +207,7 @@ public class PropertyListBuilder { if (propertyMaker != null) { p.put(attributeName,propertyMaker.make(p,attributes.getValue(i))); } else { - //System.err.println("WARNING: property " + attributeName + " ignored"); + //MessageHandler.errorln("WARNING: property " + attributeName + " ignored"); } } @@ -221,7 +222,7 @@ public class PropertyListBuilder { if (propertyMaker != null) { p = propertyMaker.make(propertyList); } else { - System.err.println("WARNING: property " + propertyName + " ignored"); + MessageHandler.errorln("WARNING: property " + propertyName + " ignored"); } return p; } diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java index 1e28d1684..40e0866a0 100644 --- a/src/org/apache/fop/fo/flow/Block.java +++ b/src/org/apache/fop/fo/flow/Block.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.*; import org.apache.fop.datatypes.*; @@ -104,7 +105,7 @@ public class Block extends FObjMixed { } public Status layout(Area area) throws FOPException { - // System.err.print(" b:LAY[" + marker + "] "); + // MessageHandler.error(" b:LAY[" + marker + "] "); if (this.marker == BREAK_AFTER) { return new Status(Status.OK); @@ -289,7 +290,7 @@ public class Block extends FObjMixed { return new Status(Status.KEEP_WITH_NEXT); } - //System.err.print(" b:OK" + marker + " "); + //MessageHandler.error(" b:OK" + marker + " "); return new Status(Status.OK); } diff --git a/src/org/apache/fop/fo/flow/DisplayGraphic.java b/src/org/apache/fop/fo/flow/DisplayGraphic.java index 327d42b01..b480ff833 100644 --- a/src/org/apache/fop/fo/flow/DisplayGraphic.java +++ b/src/org/apache/fop/fo/flow/DisplayGraphic.java @@ -54,6 +54,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.Area; import org.apache.fop.layout.BlockArea; @@ -169,7 +170,7 @@ public class DisplayGraphic extends FObj { } else if (width == 0) { width = (int) ((imgWidth * ((double) height)) / imgHeight); } -//System.err.println("DisplayGraphic: imgW=" + imgWidth + " imgH=" + imgHeight + " w=" + width + " h=" + height); +//MessageHandler.errorln("DisplayGraphic: imgW=" + imgWidth + " imgH=" + imgHeight + " w=" + width + " h=" + height); } if (area.spaceLeft() < (height + spaceBefore)) { @@ -208,10 +209,10 @@ public class DisplayGraphic extends FObj { } catch (MalformedURLException urlex) { // bad URL -System.err.println("Error while creating area : " + urlex.getMessage()); +MessageHandler.errorln("Error while creating area : " + urlex.getMessage()); } catch (FopImageException imgex) { // image error -System.err.println("Error while creating area : " + imgex.getMessage()); +MessageHandler.errorln("Error while creating area : " + imgex.getMessage()); } if (area instanceof BlockArea) { diff --git a/src/org/apache/fop/fo/flow/InlineGraphic.java b/src/org/apache/fop/fo/flow/InlineGraphic.java index 4b3073cb2..3a721d879 100644 --- a/src/org/apache/fop/fo/flow/InlineGraphic.java +++ b/src/org/apache/fop/fo/flow/InlineGraphic.java @@ -54,6 +54,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.Area; import org.apache.fop.layout.BlockArea; @@ -172,7 +173,7 @@ public class InlineGraphic extends FObj { } else if (width == 0) { width = (int) ((imgWidth * ((double) height)) / imgHeight); } -//System.err.println("DisplayGraphic: imgW=" + imgWidth + " imgH=" + imgHeight + " w=" + width + " h=" + height); +//MessageHandler.errorln("DisplayGraphic: imgW=" + imgWidth + " imgH=" + imgHeight + " w=" + width + " h=" + height); } if (area.spaceLeft() < (height + spaceBefore)) { @@ -211,10 +212,10 @@ public class InlineGraphic extends FObj { } catch (MalformedURLException urlex) { // bad URL -System.err.println("Error while creating area : " + urlex.getMessage()); +MessageHandler.errorln("Error while creating area : " + urlex.getMessage()); } catch (FopImageException imgex) { // image error -System.err.println("Error while creating area : " + imgex.getMessage()); +MessageHandler.errorln("Error while creating area : " + imgex.getMessage()); } if (area instanceof BlockArea) { diff --git a/src/org/apache/fop/fo/flow/ListBlock.java b/src/org/apache/fop/fo/flow/ListBlock.java index 76357c650..91e927cb6 100644 --- a/src/org/apache/fop/fo/flow/ListBlock.java +++ b/src/org/apache/fop/fo/flow/ListBlock.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.datatypes.*; import org.apache.fop.layout.Area; @@ -171,7 +172,7 @@ public class ListBlock extends FObj { int numChildren = this.children.size(); for (int i = this.marker; i < numChildren; i++) { if (!(children.elementAt(i) instanceof ListItem)) { - System.err.println("WARNING: This version of FOP requires list-items inside list-blocks"); + MessageHandler.errorln("WARNING: This version of FOP requires list-items inside list-blocks"); return new Status(Status.OK); } ListItem listItem = (ListItem) children.elementAt(i); diff --git a/src/org/apache/fop/fo/flow/PageNumber.java b/src/org/apache/fop/fo/flow/PageNumber.java index fb37c4811..95bebb675 100644 --- a/src/org/apache/fop/fo/flow/PageNumber.java +++ b/src/org/apache/fop/fo/flow/PageNumber.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.datatypes.*; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.*; @@ -88,7 +89,7 @@ public class PageNumber extends FObj { public Status layout(Area area) throws FOPException { if (!(area instanceof BlockArea)) { - System.err.println("WARNING: page-number outside block area"); + MessageHandler.errorln("WARNING: page-number outside block area"); return new Status(Status.OK); } if (this.marker == START) { diff --git a/src/org/apache/fop/fo/flow/PageNumberCitation.java b/src/org/apache/fop/fo/flow/PageNumberCitation.java index 94054bd97..7f00a6efc 100644 --- a/src/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/org/apache/fop/fo/flow/PageNumberCitation.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.pagination.*; import org.apache.fop.datatypes.*; import org.apache.fop.fo.properties.*; @@ -170,7 +171,7 @@ public class PageNumberCitation extends FObj { if(!(area instanceof BlockArea)) { - System.err.println("WARNING: page-number-citation outside block area"); + MessageHandler.errorln("WARNING: page-number-citation outside block area"); return new Status(Status.OK); } this.area = area; @@ -202,7 +203,7 @@ public class PageNumberCitation extends FObj { FObj root; refId = this.properties.get("ref-id").getString(); -//System.out.println("PageNumberCitation.layout() ref-id: "+refId); +//MessageHandler.logln("PageNumberCitation.layout() ref-id: "+refId); // find the reference number citation here, what to do if not found? // to do this, get the root document, and do a search for the id that matches ref-id @@ -217,7 +218,7 @@ public class PageNumberCitation extends FObj citation = searchForId(root); if(citation != null) { -//System.out.println("PageNumberCitation.layout() found citation"); +//MessageHandler.logln("PageNumberCitation.layout() found citation"); Status s = resolvePageNumber(); if(s.isIncomplete()) { @@ -228,7 +229,7 @@ public class PageNumberCitation extends FObj } else { -//System.out.println("PageNumberCitation.layout() found citation"); +//MessageHandler.logln("PageNumberCitation.layout() found citation"); Status s = resolvePageNumber(); if(s.isIncomplete()) { @@ -248,7 +249,7 @@ public class PageNumberCitation extends FObj public Status resolvePageNumber() { idPageNumber = citation.getPageNumber(); -//System.out.println("PageNumberCitation: citation page #: "+idPageNumber); +//MessageHandler.logln("PageNumberCitation: citation page #: "+idPageNumber); if(idPageNumber <0) return new Status(Status.AREA_FULL_NONE); return new Status(Status.OK); diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index f4ffeb68a..81f8b6e2c 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.*; import org.apache.fop.datatypes.*; @@ -201,7 +202,7 @@ public class Table extends FObj { offset += c.getColumnWidth(); } else if (fo instanceof TableBody) { if (columns.size() == 0) { - System.err.println("WARNING: current implementation of tables requires a table-column for each column, indicating column-width"); + MessageHandler.errorln("WARNING: current implementation of tables requires a table-column for each column, indicating column-width"); return new Status(Status.OK); } diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java index e9ebc8bc5..efeef4142 100644 --- a/src/org/apache/fop/fo/flow/TableRow.java +++ b/src/org/apache/fop/fo/flow/TableRow.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.flow; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.datatypes.*; import org.apache.fop.layout.*; @@ -163,7 +164,7 @@ public class TableRow extends FObj { int numChildren = this.children.size(); if (numChildren != columns.size()) { - System.err.println("WARNING: Number of children under table-row not equal to number of table-columns"); + MessageHandler.errorln("WARNING: Number of children under table-row not equal to number of table-columns"); return new Status(Status.OK); } diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java index 9f5197303..4db265d52 100644 --- a/src/org/apache/fop/fo/pagination/PageSequence.java +++ b/src/org/apache/fop/fo/pagination/PageSequence.java @@ -53,6 +53,7 @@ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.fo.flow.Flow; import org.apache.fop.fo.flow.StaticContent; @@ -217,7 +218,7 @@ public class PageSequence extends FObj currentPage.setNumber(++this.currentPageNumber); this.runningPageNumberCounter=this.currentPageNumber; - System.err.print(" [" + currentPageNumber); + MessageHandler.log(" [" + currentPageNumber); if ( (this.staticBefore != null) && (currentPage.getBefore() != null) ) { @@ -246,10 +247,10 @@ public class PageSequence extends FObj bodyArea.setIDReferences(areaTree.getIDReferences()); status = this.flow.layout(bodyArea); } - System.err.print("]"); + MessageHandler.log("]"); areaTree.addPage(currentPage); } while ( status.isIncomplete() ); - System.err.println(); + MessageHandler.errorln(""); } public void setFlow(Flow flow) { @@ -272,7 +273,7 @@ public class PageSequence extends FObj } else { - System.err.println("WARNING: this version of FOP only supports " + MessageHandler.errorln("WARNING: this version of FOP only supports " + "static-content in region-before and region-after"); } } diff --git a/src/org/apache/fop/fo/pagination/Root.java b/src/org/apache/fop/fo/pagination/Root.java index 8022fca78..7c5a025bd 100644 --- a/src/org/apache/fop/fo/pagination/Root.java +++ b/src/org/apache/fop/fo/pagination/Root.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.flow.*; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.AreaTree; @@ -104,7 +105,7 @@ public class Root extends FObj { public void format(AreaTree areaTree) throws FOPException { -// System.err.println(" Root[" + marker + "] "); +// MessageHandler.errorln(" Root[" + marker + "] "); if(layoutMasterSet == null) { throw new FOPException("No layout master set."); diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java index 8ccfc38d0..52338b250 100644 --- a/src/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -52,6 +52,7 @@ package org.apache.fop.fo.pagination; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.PageMaster; import org.apache.fop.layout.Region; @@ -86,7 +87,7 @@ public class SimplePageMaster extends FObj { this.layoutMasterSet = (LayoutMasterSet) parent; String pm = this.properties.get("page-master-name").getString(); if (pm == null) { - System.err.println("WARNING: simple-page-master does not have " + MessageHandler.errorln("WARNING: simple-page-master does not have " + "a page-master-name and so is being ignored"); } else { this.layoutMasterSet.addLayoutMaster(pm, this); diff --git a/src/org/apache/fop/image/FopImageConsumer.java b/src/org/apache/fop/image/FopImageConsumer.java index 5954dc9e4..843fd7e7c 100644 --- a/src/org/apache/fop/image/FopImageConsumer.java +++ b/src/org/apache/fop/image/FopImageConsumer.java @@ -56,6 +56,7 @@ package org.apache.fop.image; // Java import java.util.Hashtable; +import org.apache.fop.messaging.MessageHandler; import java.awt.image.*; import java.awt.*; @@ -77,25 +78,25 @@ public class FopImageConsumer implements ImageConsumer { public void imageComplete(int status) { /* -System.err.print("Status "); +MessageHandler.error("Status "); if (status == ImageConsumer.COMPLETESCANLINES) { - System.err.println("CompleteScanLines"); + MessageHandler.errorln("CompleteScanLines"); } else if (status == ImageConsumer.IMAGEABORTED) { - System.err.println("ImageAborted"); + MessageHandler.errorln("ImageAborted"); } else if (status == ImageConsumer.IMAGEERROR) { - System.err.println("ImageError"); + MessageHandler.errorln("ImageError"); } else if (status == ImageConsumer.RANDOMPIXELORDER) { - System.err.println("RandomPixelOrder"); + MessageHandler.errorln("RandomPixelOrder"); } else if (status == ImageConsumer.SINGLEFRAME) { - System.err.println("SingleFrame"); + MessageHandler.errorln("SingleFrame"); } else if (status == ImageConsumer.SINGLEFRAMEDONE) { - System.err.println("SingleFrameDone"); + MessageHandler.errorln("SingleFrameDone"); } else if (status == ImageConsumer.SINGLEPASS) { - System.err.println("SinglePass"); + MessageHandler.errorln("SinglePass"); } else if (status == ImageConsumer.STATICIMAGEDONE) { - System.err.println("StaticImageDone"); + MessageHandler.errorln("StaticImageDone"); } else if (status == ImageConsumer.TOPDOWNLEFTRIGHT) { - System.err.println("TopDownLeftRight"); + MessageHandler.errorln("TopDownLeftRight"); } */ synchronized(this.imageStatus) { @@ -106,23 +107,23 @@ if (status == ImageConsumer.COMPLETESCANLINES) { } public void setColorModel(ColorModel model) { -//System.err.println("setColorModel: " + model); +//MessageHandler.errorln("setColorModel: " + model); this.cm = model; } public void setDimensions(int width, int height) { -//System.err.println("setDimension: w=" + width + " h=" + height); +//MessageHandler.errorln("setDimension: w=" + width + " h=" + height); this.width = width; this.height = height; } public void setHints(int hintflags) { -//System.err.println("setHints: " + hintflags); +//MessageHandler.errorln("setHints: " + hintflags); this.hints = hintflags; } public void setProperties(Hashtable props) { -//System.err.println("setProperties: " + props); +//MessageHandler.errorln("setProperties: " + props); this.properties = props; } diff --git a/src/org/apache/fop/image/FopImageFactory.java b/src/org/apache/fop/image/FopImageFactory.java index cb6a2077f..a6cbb490e 100644 --- a/src/org/apache/fop/image/FopImageFactory.java +++ b/src/org/apache/fop/image/FopImageFactory.java @@ -56,6 +56,7 @@ package org.apache.fop.image; // Java import java.io.IOException; +import org.apache.fop.messaging.MessageHandler; import java.net.*; import java.lang.reflect.*; import java.util.Hashtable; @@ -82,13 +83,13 @@ public class FopImageFactory { } catch (MalformedURLException e_abs) { // not found - System.err.println("Invalid Image URL : " + e_abs.getMessage() + "(base URL " + context_url.toString() + ")"); + MessageHandler.errorln("Invalid Image URL : " + e_abs.getMessage() + "(base URL " + context_url.toString() + ")"); return null; } } catch (MalformedURLException e_context) { // pb context url - System.err.println("Invalid Image URL - error on relative URL : " + e_context.getMessage()); + MessageHandler.errorln("Invalid Image URL - error on relative URL : " + e_context.getMessage()); return null; } } diff --git a/src/org/apache/fop/layout/FontInfo.java b/src/org/apache/fop/layout/FontInfo.java index e651baa2a..869a54e98 100644 --- a/src/org/apache/fop/layout/FontInfo.java +++ b/src/org/apache/fop/layout/FontInfo.java @@ -51,6 +51,7 @@ package org.apache.fop.layout; import java.util.Hashtable; +import org.apache.fop.messaging.MessageHandler; import java.util.Enumeration; import org.apache.fop.apps.FOPException; @@ -104,9 +105,9 @@ public class FontInfo { if (f == null) { throw new FOPException("no default font defined by OutputConverter"); } - System.err.println("WARNING: defaulted font to any,normal,normal"); + MessageHandler.errorln("WARNING: defaulted font to any,normal,normal"); } - System.err.println("WARNING: unknown font "+family+" so defaulted font to any"); + MessageHandler.errorln("WARNING: unknown font "+family+" so defaulted font to any"); } return f; } diff --git a/src/org/apache/fop/layout/LineArea.java b/src/org/apache/fop/layout/LineArea.java index 4c1c5a42d..6540ed2c6 100644 --- a/src/org/apache/fop/layout/LineArea.java +++ b/src/org/apache/fop/layout/LineArea.java @@ -52,6 +52,7 @@ package org.apache.fop.layout; import org.apache.fop.render.Renderer; +import org.apache.fop.messaging.MessageHandler; import java.util.Vector; import java.util.Enumeration; @@ -172,7 +173,7 @@ public class LineArea extends Area { if (d != 0) { c = data[i] = d; } else { - System.err.print("ch" + MessageHandler.error("ch" + (int)c + "?"); c = data[i] = '#'; } @@ -311,7 +312,7 @@ public class LineArea extends Area { if ((finalWidth + spaceWidth + wordWidth) > this.getContentWidth()) { if (overrun) - System.err.print(">"); + MessageHandler.error(">"); if (this.wrapOption == WrapOption.WRAP) return i; } @@ -373,7 +374,7 @@ public class LineArea extends Area { } if (overrun) - System.err.print(">"); + MessageHandler.error(">"); return -1; } diff --git a/src/org/apache/fop/pdf/PDFPages.java b/src/org/apache/fop/pdf/PDFPages.java index 70b63b23c..b707660dc 100644 --- a/src/org/apache/fop/pdf/PDFPages.java +++ b/src/org/apache/fop/pdf/PDFPages.java @@ -52,6 +52,7 @@ package org.apache.fop.pdf; // Java import java.io.PrintWriter; +import org.apache.fop.messaging.MessageHandler; import java.util.Vector; /** @@ -107,7 +108,7 @@ public class PDFPages extends PDFObject { */ public void incrementCount() { this.count++; - // System.out.println("Incrementing count to " + this.getCount()); + // MessageHandler.logln("Incrementing count to " + this.getCount()); } /** diff --git a/src/org/apache/fop/pdf/PDFXObject.java b/src/org/apache/fop/pdf/PDFXObject.java index f311bbb3b..039f28ea1 100644 --- a/src/org/apache/fop/pdf/PDFXObject.java +++ b/src/org/apache/fop/pdf/PDFXObject.java @@ -55,6 +55,7 @@ package org.apache.fop.pdf; // Java import java.io.IOException; +import org.apache.fop.messaging.MessageHandler; import java.io.PrintWriter; // FOP @@ -83,7 +84,7 @@ public class PDFXObject extends PDFObject { super(number); this.Xnum=Xnumber; if (img == null) - System.err.println("FISH"); + MessageHandler.errorln("FISH"); fopimage=img; } @@ -137,9 +138,9 @@ public class PDFXObject extends PDFObject { writer.write(p); length += p.length(); } catch (FopImageException imgex) { -System.err.println("Error in XObject : " + imgex.getMessage()); +MessageHandler.errorln("Error in XObject : " + imgex.getMessage()); } catch (PDFFilterException filterex) { -System.err.println("Error in XObject : " + filterex.getMessage()); +MessageHandler.errorln("Error in XObject : " + filterex.getMessage()); } return length; } diff --git a/src/org/apache/fop/render/awt/AWTRenderer.java b/src/org/apache/fop/render/awt/AWTRenderer.java index 87ff9633b..1318049a6 100644 --- a/src/org/apache/fop/render/awt/AWTRenderer.java +++ b/src/org/apache/fop/render/awt/AWTRenderer.java @@ -10,6 +10,7 @@ package org.apache.fop.render.awt; */ import org.apache.fop.layout.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.datatypes.*; import org.apache.fop.image.*; import org.apache.fop.svg.*; @@ -450,7 +451,7 @@ public class AWTRenderer implements Renderer, Printable, Pageable { FopImage img = area.getImage(); if (img == null) { - System.out.println("area.getImage() is null"); + MessageHandler.logln("area.getImage() is null"); } try { @@ -470,7 +471,7 @@ public class AWTRenderer implements Renderer, Printable, Pageable { currentYPosition -= h; } catch (FopImageException imgex) { // ? - System.out.println("Error while loading image : " + imgex.getMessage()); + MessageHandler.logln("Error while loading image : " + imgex.getMessage()); } } diff --git a/src/org/apache/fop/render/pdf/FontSetup.java b/src/org/apache/fop/render/pdf/FontSetup.java index 4d801f51a..68841f8b3 100644 --- a/src/org/apache/fop/render/pdf/FontSetup.java +++ b/src/org/apache/fop/render/pdf/FontSetup.java @@ -52,6 +52,7 @@ package org.apache.fop.render.pdf; // FOP import org.apache.fop.render.pdf.fonts.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.layout.FontInfo; import org.apache.fop.pdf.PDFDocument; import org.apache.fop.pdf.PDFResources; @@ -77,7 +78,7 @@ public class FontSetup { * @param fontInfo the font info object to set up */ public static void setup(FontInfo fontInfo) { - System.err.println("setting up fonts"); + MessageHandler.logln("setting up fonts"); fontInfo.addMetrics("F1", new Helvetica()); fontInfo.addMetrics("F2", new HelveticaOblique()); diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index 986ebcd7c..db68fe764 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -53,6 +53,7 @@ package org.apache.fop.render.pdf; // FOP import org.apache.fop.render.Renderer; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.image.ImageArea; import org.apache.fop.image.FopImage; import org.apache.fop.apps.FOPException; @@ -143,7 +144,7 @@ public class PDFRenderer implements Renderer { */ public void render(AreaTree areaTree, PrintWriter writer) throws IOException, FOPException { - System.err.println("rendering areas to PDF"); + MessageHandler.logln("rendering areas to PDF"); IDReferences idReferences=areaTree.getIDReferences(); this.pdfResources = this.pdfDoc.getResources(); this.pdfDoc.setIDReferences(idReferences); @@ -156,7 +157,7 @@ public class PDFRenderer implements Renderer { throw new FOPException("The id \""+idReferences.getNextInvalidId()+"\" was referenced but does not exist\n"); } - System.err.println("writing out PDF"); + MessageHandler.logln("writing out PDF"); this.pdfDoc.output(writer); } diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java index 9bc8fa702..77a40bd69 100644 --- a/src/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/org/apache/fop/render/xml/XMLRenderer.java @@ -52,6 +52,7 @@ package org.apache.fop.render.xml; // FOP import org.apache.fop.svg.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.render.Renderer; import org.apache.fop.image.ImageArea; import org.apache.fop.layout.*; @@ -93,7 +94,7 @@ public class XMLRenderer implements Renderer { */ public void render(AreaTree areaTree, PrintWriter writer) throws IOException { - System.err.println("rendering areas to XML"); + MessageHandler.logln("rendering areas to XML"); this.writer = writer; this.writer.write("\n\n"); @@ -104,7 +105,7 @@ public class XMLRenderer implements Renderer { } writeEndTag(""); this.writer.flush(); - System.err.println("written out XML"); + MessageHandler.errorln("written out XML"); } /** diff --git a/src/org/apache/fop/svg/Line.java b/src/org/apache/fop/svg/Line.java index 3deb3a32e..75a021e5a 100644 --- a/src/org/apache/fop/svg/Line.java +++ b/src/org/apache/fop/svg/Line.java @@ -53,6 +53,7 @@ package org.apache.fop.svg; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.Area; import org.apache.fop.layout.FontState; @@ -123,7 +124,7 @@ public class Line extends FObj { ((SVGArea) area).addGraphic(new LineGraphic(x1, y1, x2, y2)); } else { /* otherwise generate a warning */ - System.err.println("WARNING: svg:line outside svg:svg"); + MessageHandler.errorln("WARNING: svg:line outside svg:svg"); } /* return status */ diff --git a/src/org/apache/fop/svg/Rect.java b/src/org/apache/fop/svg/Rect.java index dcce4145c..6213144a7 100644 --- a/src/org/apache/fop/svg/Rect.java +++ b/src/org/apache/fop/svg/Rect.java @@ -53,6 +53,7 @@ package org.apache.fop.svg; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.Area; import org.apache.fop.layout.FontState; @@ -123,7 +124,7 @@ public class Rect extends FObj { ((SVGArea) area).addGraphic(new RectGraphic(x, y, width, height)); } else { /* otherwise generate a warning */ - System.err.println("WARNING: svg:rect outside svg:svg"); + MessageHandler.errorln("WARNING: svg:rect outside svg:svg"); } /* return status */ diff --git a/src/org/apache/fop/svg/Text.java b/src/org/apache/fop/svg/Text.java index db91846fa..f695bb96c 100644 --- a/src/org/apache/fop/svg/Text.java +++ b/src/org/apache/fop/svg/Text.java @@ -53,6 +53,7 @@ package org.apache.fop.svg; // FOP import org.apache.fop.fo.*; +import org.apache.fop.messaging.MessageHandler; import org.apache.fop.fo.properties.*; import org.apache.fop.layout.Area; import org.apache.fop.layout.FontState; @@ -137,7 +138,7 @@ public class Text extends FObjMixed { ((SVGArea) area).addGraphic(new TextGraphic(x, y, text)); } else { /* otherwise generate a warning */ - System.err.println("WARNING: svg:text outside svg:svg"); + MessageHandler.errorln("WARNING: svg:text outside svg:svg"); } /* return status */ diff --git a/src/org/apache/fop/viewer/Command.java b/src/org/apache/fop/viewer/Command.java index ecfa9fbef..fac40424a 100644 --- a/src/org/apache/fop/viewer/Command.java +++ b/src/org/apache/fop/viewer/Command.java @@ -6,6 +6,7 @@ package org.apache.fop.viewer; */ import java.awt.event.ActionEvent; +import org.apache.fop.messaging.MessageHandler; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import java.net.*; @@ -39,7 +40,7 @@ public class Command extends AbstractAction { String path = IMAGE_DIR + iconName + ".gif"; URL url = getClass().getResource(path); if (url == null) { - System.err.println("Icon not found: " + path); + MessageHandler.errorln("Icon not found: " + path); } else putValue(SMALL_ICON, new ImageIcon(url)); @@ -51,10 +52,10 @@ public class Command extends AbstractAction { } public void doit() { - System.err.println("Not implemented."); + MessageHandler.errorln("Not implemented."); } public void undoit() { - System.err.println("Not implemented."); + MessageHandler.errorln("Not implemented."); } } diff --git a/src/org/apache/fop/viewer/LoadableProperties.java b/src/org/apache/fop/viewer/LoadableProperties.java index 1a6e957a7..9de062037 100644 --- a/src/org/apache/fop/viewer/LoadableProperties.java +++ b/src/org/apache/fop/viewer/LoadableProperties.java @@ -1,6 +1,7 @@ package org.apache.fop.viewer; import java.io.*; +import org.apache.fop.messaging.MessageHandler; import java.util.*; /** @@ -60,7 +61,7 @@ public class LoadableProperties extends Hashtable { return true; } else { - System.out.println(getClass().getName() + ": load(): invalid line " + + MessageHandler.logln(getClass().getName() + ": load(): invalid line " + str + "." + " Character '=' missed."); return false; } diff --git a/src/org/apache/fop/viewer/SecureResourceBundle.java b/src/org/apache/fop/viewer/SecureResourceBundle.java index 186b247ad..41c997183 100644 --- a/src/org/apache/fop/viewer/SecureResourceBundle.java +++ b/src/org/apache/fop/viewer/SecureResourceBundle.java @@ -1,6 +1,7 @@ package org.apache.fop.viewer; import java.util.*; +import org.apache.fop.messaging.MessageHandler; import java.io.*; @@ -35,7 +36,7 @@ public class SecureResourceBundle extends ResourceBundle implements Translator { try { lookup.load(in); } catch(Exception ex) { - System.out.println("Abgefangene Exception: " + ex.getMessage()); + MessageHandler.logln("Abgefangene Exception: " + ex.getMessage()); isSourceFound = false; } } @@ -70,7 +71,7 @@ public class SecureResourceBundle extends ResourceBundle implements Translator { return obj; else { if (isMissingEmphasized) { - System.out.println(getClass().getName() + ": missing key: " + key); + MessageHandler.logln(getClass().getName() + ": missing key: " + key); return getMissedRepresentation(key.toString()); } else diff --git a/src/org/apache/fop/viewer/UserMessage.java b/src/org/apache/fop/viewer/UserMessage.java index d10580f7e..1cdda30d8 100644 --- a/src/org/apache/fop/viewer/UserMessage.java +++ b/src/org/apache/fop/viewer/UserMessage.java @@ -1,6 +1,7 @@ package org.apache.fop.viewer; import java.awt.*; +import org.apache.fop.messaging.MessageHandler; import java.io.*; import java.awt.event.*; import java.util.*; @@ -33,7 +34,7 @@ public class UserMessage { public static void setTranslator(Translator aRes) { res = aRes; if (res == null) { - System.out.println("UserMessage: setTranslator(null) !"); + MessageHandler.logln("UserMessage: setTranslator(null) !"); res = new SecureResourceBundle(null); } @@ -112,18 +113,18 @@ public class UserMessage { * Ersetzt die eventuellen Platzhalter durch die übergebenen Parameter */ static String prepareMessage(String rawText, String[] par) { - System.out.println("prepareMessage(): " + rawText + ", parameter: " + par); + MessageHandler.logln("prepareMessage(): " + rawText + ", parameter: " + par); int index = rawText.indexOf(PARAMETER_TAG); String composedMess = ""; if ((index == -1) && (par == null)) return rawText; if ((index != -1) && (par == null)) { - System.out.println("Message " + actMessId+ " erwartet Parameter. Aufgerufen ohne Parameter"); + MessageHandler.logln("Message " + actMessId+ " erwartet Parameter. Aufgerufen ohne Parameter"); return rawText; } if ((index == -1) && (par != null)) { - System.out.println("Message " + actMessId + " erwartet keine Parameter. Aufgerufen mit folgenden Parametern:"); + MessageHandler.logln("Message " + actMessId + " erwartet keine Parameter. Aufgerufen mit folgenden Parametern:"); for(int i = 0; i < par.length; ++i) - System.out.println(par[i].toString()); + MessageHandler.logln(par[i].toString()); return rawText; } int tagCount = 0; @@ -132,7 +133,7 @@ public class UserMessage { try { composedMess += rawText.substring(0, index) + par[tagCount]; } catch(ArrayIndexOutOfBoundsException ex) { - System.out.println("Anzahl der übergebenen Parameter zu der Meldung " + actMessId + " ist weniger als erwartet."); + MessageHandler.logln("Anzahl der übergebenen Parameter zu der Meldung " + actMessId + " ist weniger als erwartet."); ex.printStackTrace(); return composedMess + rawText; } @@ -141,7 +142,7 @@ public class UserMessage { } composedMess += rawText; if (tagCount != par.length) - System.out.println("Die zu der Meldung " + actMessId + " übergebenen Parameter sind mehr als die Meldung vorsieht."); + MessageHandler.logln("Die zu der Meldung " + actMessId + " übergebenen Parameter sind mehr als die Meldung vorsieht."); return composedMess; } @@ -218,11 +219,11 @@ public class UserMessage { translatedMes = translatedMes.substring(translatedMes.indexOf(':')+1); } catch(Exception ex) { - System.out.println("FALSCHES FORMAT: MESSAGE: " + textID); + MessageHandler.logln("FALSCHES FORMAT: MESSAGE: " + textID); } } else { // Message not found - System.out.println("UserMessage: textID '" + textID + "' not found. Return " + + MessageHandler.logln("UserMessage: textID '" + textID + "' not found. Return " + "value 'CANCEL' = " + CANCEL); //return CANCEL; @@ -260,7 +261,7 @@ public class UserMessage { else { if (optionTypeIndex == STYLE_NOBUTTON) { // Wird nicht mehr unterstützt - System.out.println("UserMessage: STYLE_NOBUTTON wird nicht unterstützt"); + MessageHandler.logln("UserMessage: STYLE_NOBUTTON wird nicht unterstützt"); return result; } else {