You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by di...@apache.org on 2001/05/30 15:32:31 UTC

cvs commit: xml-cocoon2/src/org/apache/cocoon/xml AbstractXMLPipe.java

dims        01/05/30 06:32:31

  Modified:    src/org/apache/cocoon Cocoon.java
               src/org/apache/cocoon/components/parser JaxpParser.java
               src/org/apache/cocoon/util ClassUtils.java
               src/org/apache/cocoon/xml AbstractXMLPipe.java
  Log:
  WebLogic/WAR - Finally brought up the initial screen /cocoon/welcome.
  
  Revision  Changes    Path
  1.5       +7 -1      xml-cocoon2/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Cocoon.java	2001/05/25 22:00:46	1.4
  +++ Cocoon.java	2001/05/30 13:32:21	1.5
  @@ -53,7 +53,7 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a> (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4 $ $Date: 2001/05/25 22:00:46 $
  + * @version CVS $Revision: 1.5 $ $Date: 2001/05/30 13:32:21 $
    */
   public class Cocoon extends AbstractLoggable implements ThreadSafe, Component, Initializable, Disposable, Modifiable, Processor, Contextualizable {
       /** The application context */
  @@ -269,6 +269,12 @@
               String prop = (String)propEnum.nextElement();
               if (!systemProps.containsKey(prop))
                   systemProps.put(prop, props.getProperty(prop));
  +        }
  +        // FIXME We shouldn't have to specify these. Needed to override jaxp implementation of weblogic.
  +        if(systemProps.containsKey("javax.xml.parsers.DocumentBuilderFactory") && 
  +           systemProps.getProperty("javax.xml.parsers.DocumentBuilderFactory").startsWith("weblogic")) {
  +            systemProps.put("javax.xml.parsers.DocumentBuilderFactory", "org.apache.xerces.jaxp.DocumentBuilderFactoryImpl");
  +            systemProps.put("javax.xml.parsers.SAXParserFactory","org.apache.xerces.jaxp.SAXParserFactoryImpl");
           }
           System.setProperties(systemProps);
       }
  
  
  
  1.3       +7 -1      xml-cocoon2/src/org/apache/cocoon/components/parser/JaxpParser.java
  
  Index: JaxpParser.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/parser/JaxpParser.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JaxpParser.java	2001/05/10 21:16:43	1.2
  +++ JaxpParser.java	2001/05/30 13:32:25	1.3
  @@ -13,6 +13,7 @@
   import javax.xml.parsers.ParserConfigurationException;
   import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.SAXParserFactory;
  +import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.xml.AbstractXMLProducer;
   import org.apache.cocoon.xml.dom.DOMFactory;
   import org.w3c.dom.DOMImplementation;
  @@ -29,7 +30,7 @@
    * If only we can get rid of the need for the Document...
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/10 21:16:43 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/05/30 13:32:25 $
    */
   public class JaxpParser extends AbstractXMLProducer
   implements Parser, ErrorHandler, SingleThreaded {
  @@ -49,8 +50,12 @@
       throws SAXException, IOException {
           SAXParser parser = null;
   
  +        getLogger().debug("SAXParserFactory: " + ClassUtils.which("javax.xml.parsers.SAXParserFactory"));
  +        getLogger().debug("DocumentBuilderFactory: " + ClassUtils.which("javax.xml.parsers.DocumentBuilderFactory"));
  +
           try {
               parser = this.factory.newSAXParser();
  +            getLogger().debug("SAXParser: " + ClassUtils.which(parser.getClass().getName()));
           } catch (Exception e) {
               getLogger().error("Cannot produce a valid parser", e);
               throw new SAXException("Could not get valid parser" + e.getMessage());
  @@ -75,6 +80,7 @@
   
           try {
               builder = this.docfactory.newDocumentBuilder();
  +            getLogger().debug("DocumentBuilder: " + ClassUtils.which(builder.getClass().getName()));
           } catch (ParserConfigurationException pce) {
               getLogger().error("Could not create DocumentBuilder", pce);
               return null;
  
  
  
  1.5       +28 -1     xml-cocoon2/src/org/apache/cocoon/util/ClassUtils.java
  
  Index: ClassUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/ClassUtils.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ClassUtils.java	2001/05/23 21:27:37	1.4
  +++ ClassUtils.java	2001/05/30 13:32:27	1.5
  @@ -18,7 +18,7 @@
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4 $ $Date: 2001/05/23 21:27:37 $
  + * @version CVS $Revision: 1.5 $ $Date: 2001/05/30 13:32:27 $
    */
   public class ClassUtils {
   
  @@ -120,5 +120,32 @@
           File file = new File(directory.getCanonicalPath() + File.separator + basename + ".class");
   
           return file.lastModified();
  +    }
  +
  +    /**
  +     * Gets the absolute pathname of the class file
  +     * containing the specified class name, as prescribed
  +     * by the current classpath.
  +     *
  +     * @param className Name of the class.
  +     */
  +     public static String which(String className) {
  +        String path = null;
  +        String classPath = className;
  +        if (!classPath.startsWith("/")) {
  +          classPath = "/" + classPath;
  +        }
  +        classPath = classPath.replace('.', '/');
  +        classPath = classPath + ".class";
  +
  +        try {
  +            Class clazz = loadClass(className);
  +            java.net.URL classUrl = getResource(classPath);
  +            if(classUrl != null)
  +                path = classUrl.toString();
  +        } catch (Exception e){
  +        }
  +
  +        return path;
       }
   }
  
  
  
  1.3       +8 -2      xml-cocoon2/src/org/apache/cocoon/xml/AbstractXMLPipe.java
  
  Index: AbstractXMLPipe.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/xml/AbstractXMLPipe.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractXMLPipe.java	2001/05/10 21:17:07	1.2
  +++ AbstractXMLPipe.java	2001/05/30 13:32:29	1.3
  @@ -21,7 +21,7 @@
    * handlers and lexical handlers.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/10 21:17:07 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/05/30 13:32:29 $
    */
   public class AbstractXMLPipe extends AbstractXMLProducer implements XMLPipe, Recyclable {
   
  @@ -48,7 +48,13 @@
        */
       public void endDocument()
       throws SAXException {
  -        if (contentHandler != null) contentHandler.endDocument();
  +        try {
  +            if (contentHandler != null) contentHandler.endDocument();
  +        } catch (SAXException e){
  +            throw e;
  +        } catch (Exception e){
  +            getLogger().debug("Exception in endDocument",e);
  +        }
       }
   
       /**
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org