You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/05/18 00:39:44 UTC

cvs commit: xml-xalan/src/org/apache/xalan/xpath SimpleNodeLocator.java

sboag       00/05/17 15:39:42

  Modified:    src/org/apache/xalan/xpath SimpleNodeLocator.java
  Log:
  Fix for bug: "Null Pointer Exception if variable reference is first item in union" and "Null Pointer Exception if function is first item in a union; function not evalutated if second"  Both of these were the same bug... the variable and function weren't being evaluated as LocationPaths.
  
  Revision  Changes    Path
  1.23      +28 -4     xml-xalan/src/org/apache/xalan/xpath/SimpleNodeLocator.java
  
  Index: SimpleNodeLocator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/src/org/apache/xalan/xpath/SimpleNodeLocator.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- SimpleNodeLocator.java	2000/04/07 19:13:20	1.22
  +++ SimpleNodeLocator.java	2000/05/17 22:39:40	1.23
  @@ -235,14 +235,38 @@
       
       opPos = xpath.getFirstChildPos(opPos); 
   
  -    while((xpath.m_opMap[opPos] & XPath.LOCATIONPATHEX_MASK) == XPath.OP_LOCATIONPATH)
  +    // while((xpath.m_opMap[opPos] & XPath.LOCATIONPATHEX_MASK) == XPath.OP_LOCATIONPATH)
  +    while(xpath.m_opMap[opPos] > 0)
       {
         int nextOpPos = xpath.getNextOpPos(opPos);
   
         // XNodeSet expr = (XNodeSet)xpath.execute(execContext, context, opPos);
  -      opPos = xpath.getFirstChildPos(opPos);
  -      MutableNodeList mnl = step(xpath, execContext, context, opPos,
  -                                 callback, callbackInfo, false, false);
  +      MutableNodeList mnl;
  +      int steptype = xpath.m_opMap[opPos];
  +      if((steptype & XPath.LOCATIONPATHEX_MASK) == XPath.OP_LOCATIONPATH)
  +      {
  +        opPos = xpath.getFirstChildPos(opPos);
  +        mnl = step(xpath, execContext, context, opPos,
  +                   callback, callbackInfo, false, false);
  +      }
  +      else
  +      {
  +        switch(steptype)
  +        {
  +        case XPath.OP_VARIABLE:
  +        case XPath.OP_EXTFUNCTION:
  +        case XPath.OP_FUNCTION:
  +        case XPath.OP_GROUP:
  +          mnl = new MutableNodeListImpl();
  +          findNodeSet(xpath, execContext, context, opPos, 
  +                      steptype, mnl, false, false);
  +          break;
  +        default:
  +          xpath.error(context, XPATHErrorResources.ER_UNKNOWN_AXIS, 
  +                      new Object[] {Integer.toString(steptype)}); 
  +          mnl = null; // shut up compiler.
  +        }
  +      }
         XNodeSet expr = (null != mnl) ? new XNodeSet(mnl) : emptyNodeList;
   
         if(null == resultNodeSet)