You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by js...@apache.org on 2001/05/10 20:35:02 UTC

cvs commit: jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/tags ParseTag.java

jstrachan    01/05/10 11:35:02

  Modified:    xtags/src/org/apache/taglibs/xtags/tags ParseTag.java
  Log:
  Added patch so that XTags works on WebLogic 6.0 SP1. Its a nasty hack but will hopefully be removed later. Basically using dom4j's JAXP loading of SAX parsers seems to SEGV the JVM when running under WebLogic 6 for some wierd reason - no other servlet engine seems to suffer the same problem. Will investigate further and remove the hack ASAP
  
  Revision  Changes    Path
  1.7       +19 -14    jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/tags/ParseTag.java
  
  Index: ParseTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/xtags/src/org/apache/taglibs/xtags/tags/ParseTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ParseTag.java	2001/05/10 12:12:07	1.6
  +++ ParseTag.java	2001/05/10 18:34:59	1.7
  @@ -58,8 +58,6 @@
   
   package org.apache.taglibs.xtags.tags;
   
  -
  -
   import java.io.IOException;
   import java.io.Reader;
   import java.io.StringReader;
  @@ -81,14 +79,24 @@
   
   import org.apache.log4j.Category;
   
  +import org.xml.sax.SAXException;
  +
   /** A tag which parses its body as an XML Document and defines a variable
     *
     * @author James Strachan
     */
   public class ParseTag extends BodyTagSupport {
   
  +    /** This hack has been added temporarily so that this tag works in 
  +      * WebLogic 6.0 SP1. Otherwise, loading an XML parser using JAXP
  +      * seems to cause a JVM segmentation fault.
  +      *  
  +      *  Remove as soon as WL 6.0 supports JAXP 1.1 and this bug goes away.
  +      */
  +    private static final boolean WEBLOGIC_6_HACK = true;
  +    
       /** Allow tracing to be disabled */
  -    private static final boolean TRACE = false;    
  +    private static final boolean TRACE = true;    
       
       /** Logger */
       private static final Category log = Category.getInstance( ParseTag.class );
  @@ -110,11 +118,7 @@
       // Tag interface
       //------------------------------------------------------------------------- 
       public int doStartTag() throws JspException  {
  -        if ( TRACE ) {
  -            log.info( "doStartTag() !!" );
  -        }
  -        document = null;
  -        
  +        document = null;        
           if ( url != null ) {
               try {
                   // XXXX: check cache here...
  @@ -130,10 +134,6 @@
       }
       
       public int doAfterBody() throws JspException {
  -        if ( TRACE ) {
  -            log.info( "doAfterBody() !!" );
  -        }
  -        
           if ( document == null ) {
               try {
                   if ( reader != null ) {
  @@ -222,8 +222,13 @@
       
       // Implementation methods
       //-------------------------------------------------------------------------                
  -    protected SAXReader getSAXReader() {
  -        return new SAXReader();
  +    protected SAXReader getSAXReader() throws SAXException {
  +        if ( ! WEBLOGIC_6_HACK ) {
  +            return new SAXReader();
  +        }
  +        else {
  +            return new SAXReader( new org.dom4j.io.aelfred.SAXDriver() );
  +        }
       }
       
       protected void defineVariable( Document document ) {