bruno       2003/10/28 13:21:43

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/util
                        DomHelper.java
  Log:
  Avoid a NPE when there's an older Xerces on the classpath.
  
  Revision  Changes    Path
  1.7       +6 -0      
cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/DomHelper.java
  
  Index: DomHelper.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/DomHelper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DomHelper.java    24 Sep 2003 20:47:07 -0000      1.6
  +++ DomHelper.java    28 Oct 2003 21:21:43 -0000      1.7
  @@ -294,6 +294,12 @@
           }
   
           private final void setLocation() {
  +            // Older versions of Xerces had a different signature for the 
startDocument method. If such a
  +            // version is used, the startDocument method above will not be 
called and locator will hence be null.
  +            // Tell the users this so that they don't get a stupid NPE.
  +            if (this.locator == null)
  +                throw new RuntimeException("Error: locator is null. Check 
that you have the correct version of Xerces (such as the one that comes with 
Cocoon) in your endorsed library path.");
  +
               NodeImpl node = null;
               try {
                   node = (NodeImpl) 
this.getProperty("http://apache.org/xml/properties/dom/current-element-node";);
  
  
  

Reply via email to