sboag       00/07/30 15:42:49

  Modified:    java/src/org/apache/xpath XPath.java
  Log:
  Fixed error handling bugs.
  
  Revision  Changes    Path
  1.2       +15 -2     xml-xalan/java/src/org/apache/xpath/XPath.java
  
  Index: XPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPath.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XPath.java        2000/07/05 14:44:26     1.1
  +++ XPath.java        2000/07/30 22:42:48     1.2
  @@ -140,17 +140,19 @@
                  PrefixResolver prefixResolver, int type)
       throws org.xml.sax.SAXException
     {
  -    m_locator = locator;
  +    // TODO: would like not to clone the locator...
  +    m_locator = new org.xml.sax.helpers.LocatorImpl(locator); 
       m_patternString = exprString;
       XPathParser parser = new XPathParser();
       
  -    Compiler compiler = new Compiler();
  +    Compiler compiler = new Compiler(null, locator);
       if(SELECT == type)
         parser.initXPath(compiler, exprString, prefixResolver);
       else if(MATCH == type)
         parser.initMatchPattern(compiler, exprString, prefixResolver);
       else
         throw new RuntimeException("Can not deal with XPath type: "+type);
  +    // System.out.println("----------------");
       Expression expr = compiler.compile(0);
       // System.out.println("expr: "+expr);
       this.setExpression(expr);
  @@ -192,6 +194,17 @@
       try
       {
         xobj = m_mainExp.execute(xctxt);
  +    }
  +    catch(Exception e)
  +    {
  +      if(e instanceof trax.TransformException)
  +        throw (trax.TransformException)e;
  +      else
  +      {
  +        // System.out.println("m_locator.getSystemId(): 
"+m_locator.getSystemId());
  +        // System.out.println("m_locator.getLineNumber(): 
"+m_locator.getLineNumber());
  +        throw new trax.TransformException("Error in XPath", m_locator, e);
  +      }
       }
       finally
       {
  
  
  

Reply via email to