You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by fo...@locus.apache.org on 2000/08/02 00:36:28 UTC

cvs commit: xml-fop/lib Fop.class Fop.java

fotis       00/08/01 15:36:28

  Modified:    lib      Fop.class Fop.java
  Log:
  update: use Messagehandler instead of System.err.println
  
  Revision  Changes    Path
  1.3       +67 -43    xml-fop/lib/Fop.class
  
  	<<Binary file>>
  
  
  1.3       +16 -13    xml-fop/lib/Fop.java
  
  Index: Fop.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/lib/Fop.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Fop.java	2000/07/15 20:41:07	1.2
  +++ Fop.java	2000/08/01 22:36:28	1.3
  @@ -52,7 +52,7 @@
   // Ant
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.BuildException;
  -import org.apache.fop.apps.*;
  +
   
   // SAX
   import org.xml.sax.XMLReader;
  @@ -69,6 +69,9 @@
   import java.io.FileNotFoundException;
   import java.net.URL;
   
  +// FOP
  +import org.apache.fop.messaging.MessageHandler;
  +import org.apache.fop.apps.*;
   
   /**
    * extension to Ant which allows usage of Fop in the 
  @@ -110,20 +113,20 @@
       if (parserClassName == null) {
           parserClassName = "org.apache.xerces.parsers.SAXParser";
       }
  -    System.out.println("using SAX parser " + parserClassName);
  +    MessageHandler.logln("using SAX parser " + parserClassName);
   
       try {
           return (XMLReader)
             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;
     }  // end: createParser
  @@ -160,18 +163,18 @@
     public void execute () throws BuildException {
       boolean errors = false;
       String version = Version.getVersion();
  -    System.out.println("=======================\nTask " + version + 
  +    MessageHandler.logln("=======================\nTask " + version + 
                          "\nconverting file " + fofile + " to " + pdffile);
     
       if (!(new File(fofile).exists())) {
         errors = true;
  -      System.err.println("Task Fop - ERROR: Formatting objects file " + fofile + " missing.");
  +      MessageHandler.errorln("Task Fop - ERROR: Formatting objects file " + fofile + " missing.");
       }
     
       XMLReader parser = createParser();
     
       if (parser == null) {
  -        System.err.println("Task Fop - ERROR: Unable to create SAX parser");
  +        MessageHandler.errorln("Task Fop - ERROR: Unable to create SAX parser");
           errors = true;
       }
   
  @@ -179,8 +182,8 @@
       try {
         parser.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
       } catch (SAXException e) {
  -      System.err.println("Error in setting up parser feature namespace-prefixes");
  -      System.err.println("You need a parser which supports SAX version 2");  
  +      MessageHandler.errorln("Error in setting up parser feature namespace-prefixes");
  +      MessageHandler.errorln("You need a parser which supports SAX version 2");  
         System.exit(1);  
       }
   
  @@ -195,11 +198,11 @@
           driver.format();
           driver.render();
         } catch (Exception e) {
  -        System.err.println("Task Fop - FATAL ERROR: " + e.getMessage());
  +        MessageHandler.errorln("Task Fop - FATAL ERROR: " + e.getMessage());
           System.exit(1);
         }
       }
  -    System.out.println("=======================\n");  
  +    MessageHandler.logln("=======================\n");  
     } // end: execute
   }