jeremias    2002/11/28 07:43:17

  Modified:    src/org/apache/fop/apps Tag: fop-0_20_2-maintain Driver.java
  Log:
  Good error messages when Driver is not initialized properly.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.36.2.8  +9 -7      xml-fop/src/org/apache/fop/apps/Driver.java
  
  Index: Driver.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Driver.java,v
  retrieving revision 1.36.2.7
  retrieving revision 1.36.2.8
  diff -u -r1.36.2.7 -r1.36.2.8
  --- Driver.java       19 Nov 2002 01:03:57 -0000      1.36.2.7
  +++ Driver.java       28 Nov 2002 15:43:17 -0000      1.36.2.8
  @@ -1,6 +1,6 @@
   /*
    * $Id$
  - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  + * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
    */
  @@ -193,9 +193,9 @@
   
       private Logger getLogger() {
           if(log == null) {
  -         log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  -         log.error("Logger not set");
  -     }
  +             log = new ConsoleLogger(ConsoleLogger.LEVEL_INFO);
  +         log.error("Logger not set");
  +     }
   
           return log;
       }
  @@ -433,6 +433,8 @@
        * events but isn't a SAX Parser itself.
        */
       public ContentHandler getContentHandler() {
  +        if (_stream == null) throw new NullPointerException("OutputStream has not 
been set. Set before getting the ContentHandler");
  +        if (_renderer == null) throw new NullPointerException("The renderer has not 
been set. Set before getting the ContentHandler");
           StreamRenderer streamRenderer = new StreamRenderer(_stream, _renderer);
           streamRenderer.setLogger(getLogger());
           _treeBuilder.setLogger(getLogger());
  @@ -446,7 +448,7 @@
        * SAX InputSource
        */
       public synchronized void render(XMLReader parser, InputSource source)
  -    throws FOPException {
  +                throws FOPException {
           parser.setContentHandler(getContentHandler());
           try {
               parser.parse(source);
  @@ -466,7 +468,7 @@
        * Build the formatting object tree using the given DOM Document
        */
       public synchronized void render(Document document)
  -    throws FOPException {
  +                throws FOPException {
            DocumentInputSource source = new DocumentInputSource(document);
            DocumentReader reader = new DocumentReader();
            render(reader, source);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to