sboag       01/07/30 10:12:00

  Modified:    java/src/org/apache/xpath/compiler OpMap.java
  Log:
  Throw real error instead of runtime error in getFirstPredicateOpPos
  for better error reporting.
  
  Revision  Changes    Path
  1.9       +27 -3     xml-xalan/java/src/org/apache/xpath/compiler/OpMap.java
  
  Index: OpMap.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/OpMap.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- OpMap.java        2001/01/02 03:47:16     1.8
  +++ OpMap.java        2001/07/30 17:12:00     1.9
  @@ -306,6 +306,7 @@
      * @return position of predicate in FROM_stepType structure.
      */
     public int getFirstPredicateOpPos(int opPos)
  +     throws javax.xml.transform.TransformerException
     {
   
       int stepType = m_opMap[opPos];
  @@ -322,11 +323,34 @@
       }
       else
       {
  -      throw new RuntimeException(
  -        "Programmer's assertion in getNextStepPos: unknown stepType: "
  -        + stepType);
  +      error(org.apache.xpath.res.XPATHErrorResources.ER_UNKNOWN_OPCODE,
  +            new Object[]{ String.valueOf(stepType) });  //"ERROR! Unknown op 
code: "+m_opMap[opPos]);
  +      return -1;
       }
     }
  +  
  +  /**
  +   * Tell the user of an error, and probably throw an
  +   * exception.
  +   *
  +   * @param msg An error number that corresponds to one of the numbers found 
  +   *            in [EMAIL PROTECTED] 
org.apache.xpath.res.XPATHErrorResources}, which is 
  +   *            a key for a format string.
  +   * @param args An array of arguments represented in the format string, 
which 
  +   *             may be null.
  +   *
  +   * @throws TransformerException if the current ErrorListoner determines to 
  +   *                              throw an exception.
  +   */
  +  public void error(int msg, Object[] args) throws 
javax.xml.transform.TransformerException
  +  {
  +
  +    java.lang.String fmsg = 
org.apache.xalan.res.XSLMessages.createXPATHMessage(msg, args);
  +    
  +
  +    throw new javax.xml.transform.TransformerException(fmsg);
  +  }
  +
   
     /**
      * Go to the first child of a given operation.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to