You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2003/09/03 14:51:55 UTC

cvs commit: xml-xalan/java/src/org/apache/xalan/res XSLTErrorResources.java

zongaro     2003/09/03 05:51:55

  Modified:    java/src/org/apache/xalan/extensions
                        ExtensionHandlerExsltFunction.java
               java/src/org/apache/xalan/res XSLTErrorResources.java
  Log:
  Applied patch for bug 15090 from Joanne Tong (joannet@ca.ibm.com).  Added code
  to handle the case in which a referenced function is not found by reporting an
  error.  Previously, a NullPointerException was the result.
  
  Revision  Changes    Path
  1.6       +24 -15    xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerExsltFunction.java
  
  Index: ExtensionHandlerExsltFunction.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerExsltFunction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExtensionHandlerExsltFunction.java	30 Jan 2003 18:45:41 -0000	1.5
  +++ ExtensionHandlerExsltFunction.java	3 Sep 2003 12:51:54 -0000	1.6
  @@ -61,6 +61,8 @@
   
   import javax.xml.transform.TransformerException;
   
  +import org.apache.xalan.res.XSLMessages;
  +import org.apache.xalan.res.XSLTErrorResources;
   import org.apache.xalan.templates.Constants;
   import org.apache.xalan.templates.ElemExsltFuncResult;
   import org.apache.xalan.templates.ElemExsltFunction;
  @@ -234,25 +236,32 @@
         }
         
         ElemExsltFunction elemFunc = getFunction(extFunction.getFunctionName());
  -      XPathContext context = exprContext.getXPathContext();
  -      TransformerImpl transformer = (TransformerImpl)context.getOwnerObject();
         
  -      // Reset the frame bottom before calling the EXSLT function.
  -      if (callerTemplate != null)
  -        elemFunc.setCallerFrameSize(callerTemplate.m_frameSize);
  -      else
  -        elemFunc.setCallerFrameSize(0);
  +      if (null != elemFunc) {
  +        XPathContext context = exprContext.getXPathContext();
  +        TransformerImpl transformer = (TransformerImpl)context.getOwnerObject();
         
  -      elemFunc.execute(transformer, methodArgs);
  +        // Reset the frame bottom before calling the EXSLT function.
  +        if (callerTemplate != null)
  +          elemFunc.setCallerFrameSize(callerTemplate.m_frameSize);
  +        else
  +          elemFunc.setCallerFrameSize(0);
  +       
  +        elemFunc.execute(transformer, methodArgs);
         
  -      XObject val = new XString(""); // value returned if no result element.
  -      if (elemFunc.isResultSet())
  -      {
  -        val = elemFunc.getResult();
  -        elemFunc.clearResult();
  -      }
  +        XObject val = new XString(""); // value returned if no result element.
  +        if (elemFunc.isResultSet())
  +        {
  +          val = elemFunc.getResult();
  +          elemFunc.clearResult();
  +        }
                 
  -      return val;
  +        return val;
  +      
  +      }
  +      else {
  +      	throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_FUNCTION_NOT_FOUND, new Object[] {extFunction.getFunctionName()}));
  +      }
       }
       catch (TransformerException e)
       {
  
  
  
  1.40      +14 -4     xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java
  
  Index: XSLTErrorResources.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- XSLTErrorResources.java	17 Jun 2003 20:06:29 -0000	1.39
  +++ XSLTErrorResources.java	3 Sep 2003 12:51:54 -0000	1.40
  @@ -430,6 +430,8 @@
     public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH";
     public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX";
     public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET";
  +  public static final String ER_FUNCTION_NOT_FOUND = 
  +	 "ER_FUNCTION_NOT_FOUND"; 
   
     public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE";
     public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = 
  @@ -2123,16 +2125,24 @@
       { ER_INVALID_PREFIX,
        "Prefix in exclude-result-prefixes is not valid: {0}"},
   
  -    // Note to translators:  An "attribute set" is a set of attributes that can be
  -    // added to an element in the output document as a group.  The message indicates
  -    // that there was a reference to an attribute set named {0} that was never
  -    // defined.
  +    // Note to translators:  An "attribute set" is a set of attributes that can
  +    // be added to an element in the output document as a group.  The message
  +    // indicates that there was a reference to an attribute set named {0} that
  +    // was never defined.
       // ER_NO_ATTRIB_SET - new error message for bugzilla #782
   
     // attribute-set named {0} does not exist
   //  public static final int ER_NO_ATTRIB_SET           = 253;
       { ER_NO_ATTRIB_SET,
        "attribute-set named {0} does not exist"},
  +     
  +    // Note to translators:  This message indicates that there was a reference
  +    // to a function named {0} for which no function definition could be found.
  +//ER_FUNCTION_NOT_FOUND
  +//  public static final int ER_FUNCTION_NOT_FOUND = 254;
  +
  +    { ER_FUNCTION_NOT_FOUND,
  +     "The function named {0} does not exist"},
   
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org