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 pb...@apache.org on 2004/03/08 22:02:28 UTC

cvs commit: xml-fop/src/java/org/apache/fop/apps InputHandler.java FOFileHandler.java XSLTInputHandler.java

pbwest      2004/03/08 13:02:28

  Modified:    src/java/org/apache/fop/apps Tag: FOP_0-20-0_Alt-Design
                        InputHandler.java FOFileHandler.java
                        XSLTInputHandler.java
  Log:
  Dropped createParser back to super class InputHandler.
  Changed related methods from call to instance.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.2.6   +31 -1     xml-fop/src/java/org/apache/fop/apps/InputHandler.java
  
  Index: InputHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/InputHandler.java,v
  retrieving revision 1.4.2.5
  retrieving revision 1.4.2.6
  diff -u -r1.4.2.5 -r1.4.2.6
  --- InputHandler.java	6 Mar 2004 05:53:16 -0000	1.4.2.5
  +++ InputHandler.java	8 Mar 2004 21:02:27 -0000	1.4.2.6
  @@ -24,6 +24,7 @@
   
   // Java
   import java.net.URL;
  +import java.util.logging.Logger;
   import java.io.File;
   
   /**
  @@ -33,6 +34,7 @@
    */
   public abstract class InputHandler {
   
  +    protected Logger log = Logger.getLogger(Fop.fopPackage);
       /**
        * Get the input source associated with this input handler.
        * @return the input source
  @@ -74,6 +76,34 @@
               return new InputSource(new URL("file", null, path).toString());
           } catch (java.net.MalformedURLException e) {
               throw new Error("unexpected MalformedURLException");
  +        }
  +    }
  +
  +    /**
  +     * creates a SAX parser, using the value of org.xml.sax.parser
  +     * defaulting to org.apache.xerces.parsers.SAXParser
  +     *
  +     * @return the created SAX parser
  +     */
  +    protected XMLReader createParser() throws FOPException {
  +        String parserClassName = System.getProperty("org.xml.sax.parser");
  +        if (parserClassName == null) {
  +            parserClassName = "org.apache.xerces.parsers.SAXParser";
  +        }
  +        log.config("using SAX parser " + parserClassName);
  +
  +        try {
  +            return (XMLReader)Class.forName(parserClassName).newInstance();
  +        } catch (ClassNotFoundException e) {
  +            throw new FOPException(e);
  +        } catch (InstantiationException e) {
  +            throw new FOPException("Could not instantiate "
  +                                   + parserClassName, e);
  +        } catch (IllegalAccessException e) {
  +            throw new FOPException("Could not access " + parserClassName, e);
  +        } catch (ClassCastException e) {
  +            throw new FOPException(parserClassName + " is not a SAX driver",
  +                                   e);
           }
       }
   
  
  
  
  1.2.2.2   +3 -31     xml-fop/src/java/org/apache/fop/apps/FOFileHandler.java
  
  Index: FOFileHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/FOFileHandler.java,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- FOFileHandler.java	6 Mar 2004 05:53:16 -0000	1.2.2.1
  +++ FOFileHandler.java	8 Mar 2004 21:02:27 -0000	1.2.2.2
  @@ -29,7 +29,7 @@
    * Manages input if it is an XSL-FO file.
    */
   public class FOFileHandler extends InputHandler {
  -    
  +
       private File fofile = null;
       private URL foURL = null;
   
  @@ -68,39 +68,11 @@
       }
   
       /**
  -     * creates a SAX parser, using the value of org.xml.sax.parser
  -     * defaulting to org.apache.xerces.parsers.SAXParser
  -     *
  -     * @return the created SAX parser
  -     */
  -    protected static XMLReader createParser() throws FOPException {
  -        String parserClassName = System.getProperty("org.xml.sax.parser");
  -        if (parserClassName == null) {
  -            parserClassName = "org.apache.xerces.parsers.SAXParser";
  -        }
  -        Fop.logger.config("using SAX parser " + parserClassName);
  -
  -        try {
  -            return (XMLReader)Class.forName(parserClassName).newInstance();
  -        } catch (ClassNotFoundException e) {
  -            throw new FOPException(e);
  -        } catch (InstantiationException e) {
  -            throw new FOPException("Could not instantiate "
  -                                   + parserClassName, e);
  -        } catch (IllegalAccessException e) {
  -            throw new FOPException("Could not access " + parserClassName, e);
  -        } catch (ClassCastException e) {
  -            throw new FOPException(parserClassName + " is not a SAX driver",
  -                                   e);
  -        }
  -    }
  -
  -    /**
        * Returns the fully qualified classname of the standard XML parser for FOP
        * to use.
        * @return the XML parser classname
        */
  -    public static final String getParserClassName() {
  +    public String getParserClassName() {
           try {
               return createParser().getClass().getName();
           } catch (FOPException e) {
  
  
  
  1.12.2.2  +2 -2      xml-fop/src/java/org/apache/fop/apps/XSLTInputHandler.java
  
  Index: XSLTInputHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/XSLTInputHandler.java,v
  retrieving revision 1.12.2.1
  retrieving revision 1.12.2.2
  diff -u -r1.12.2.1 -r1.12.2.2
  --- XSLTInputHandler.java	6 Mar 2004 05:53:16 -0000	1.12.2.1
  +++ XSLTInputHandler.java	8 Mar 2004 21:02:27 -0000	1.12.2.2
  @@ -122,7 +122,7 @@
        * XMLReaders or XMLFilters
        * @throws FOPException if setting up the XMLFilter fails
        */
  -    public static XMLFilter getXMLFilter(Source xsltSource, Vector inParams)
  +    public XMLFilter getXMLFilter(Source xsltSource, Vector inParams)
       throws FOPException {
           try {
               // Instantiate  a TransformerFactory.
  @@ -150,7 +150,7 @@
   */                  
                   
                   // Create an XMLReader.
  -                XMLReader parser = FOFileHandler.createParser();
  +                XMLReader parser = createParser();
                   if (parser == null) {
                       throw new FOPException("Unable to create SAX parser");
                   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org