tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler DefaultErrorHandler.java ErrorDispatcher.java ErrorHandler.java
Date Tue, 05 Nov 2002 20:30:25 GMT
luehe       2002/11/05 12:30:25

  Modified:    jasper2/src/share/org/apache/jasper/compiler Tag:
                        tomcat_4_branch DefaultErrorHandler.java
                        ErrorDispatcher.java ErrorHandler.java
  Log:
  Fixed Bugzilla 14195: NPE from dispatch() when no errCode
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.1.1.2.1 +15 -5     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/DefaultErrorHandler.java
  
  Index: DefaultErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/DefaultErrorHandler.java,v
  retrieving revision 1.1.1.1
  retrieving revision 1.1.1.1.2.1
  diff -u -r1.1.1.1 -r1.1.1.1.2.1
  --- DefaultErrorHandler.java	28 Mar 2002 18:46:18 -0000	1.1.1.1
  +++ DefaultErrorHandler.java	5 Nov 2002 20:30:25 -0000	1.1.1.1.2.1
  @@ -90,9 +90,19 @@
        * @param exception Parse exception
        */
       public void jspError(String fname, int line, int column, String errMsg,
  -			 Exception exception) throws JasperException {
  +			 Exception ex) throws JasperException {
   	throw new JasperException(fname + "(" + line + "," + column + ")"
  -				  + " " + errMsg);
  +				  + " " + errMsg, ex);
  +    }
  +
  +    /*
  +     * Processes the given JSP parse error.
  +     *
  +     * @param errMsg Parse error message
  +     * @param exception Parse exception
  +     */
  +    public void jspError(String errMsg, Exception ex) throws JasperException {
  +	throw new JasperException(errMsg, ex);
       }
   
       /*
  
  
  
  1.2.2.1   +20 -6     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java
  
  Index: ErrorDispatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- ErrorDispatcher.java	15 May 2002 20:42:03 -0000	1.2
  +++ ErrorDispatcher.java	5 Nov 2002 20:30:25 -0000	1.2.2.1
  @@ -391,30 +391,44 @@
       private void dispatch(Mark where, String errCode, Object[] args,
   			  Exception e) throws JasperException {
   	String file = null;
  +	String errMsg = null;
   	int line = -1;
   	int column = -1;
  +	boolean hasLocation = false;
   
   	// Localize
  -	String errMsg = getString(errCode, args);
  +	if (errCode != null) {
  +	    errMsg = getString(errCode, args);
  +	} else if (e != null) {
  +	    // give a hint about what's wrong
  +	    errMsg = e.getMessage();
  +	}
   
   	// Get error location
   	if (where != null) {
   	    file = where.getFile();
   	    line = where.getLineNumber();
   	    column = where.getColumnNumber();
  +	    hasLocation = true;
   	} else if (e instanceof SAXParseException) {
   	    file = ((SAXParseException) e).getSystemId();
   	    line = ((SAXParseException) e).getLineNumber();
   	    column = ((SAXParseException) e).getColumnNumber();
  +	    hasLocation = true;
   	}
   
   	// Get nested exception
   	Exception nestedEx = e;
  -	if (e instanceof SAXException) {
  +	if ((e instanceof SAXException)
  +	        && (((SAXException) e).getException() != null)) {
   	    nestedEx = ((SAXException) e).getException();
   	}
   
  -	errHandler.jspError(file, line, column, errMsg, nestedEx);
  +	if (hasLocation) {
  +	    errHandler.jspError(file, line, column, errMsg, nestedEx);
  +	} else {
  +	    errHandler.jspError(errMsg, nestedEx);
  +	}
       }
   
       /*
  
  
  
  1.1.1.1.2.1 +12 -3     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorHandler.java
  
  Index: ErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorHandler.java,v
  retrieving revision 1.1.1.1
  retrieving revision 1.1.1.1.2.1
  diff -u -r1.1.1.1 -r1.1.1.1.2.1
  --- ErrorHandler.java	28 Mar 2002 18:46:18 -0000	1.1.1.1
  +++ ErrorHandler.java	5 Nov 2002 20:30:25 -0000	1.1.1.1.2.1
  @@ -88,6 +88,15 @@
   			 Exception exception) throws JasperException;
   
       /**
  +     * Processes the given JSP parse error.
  +     *
  +     * @param errMsg Parse error message
  +     * @param exception Parse exception
  +     */
  +    public void jspError(String msg, Exception exception)
  +	throws JasperException;
  +
  +    /**
        * Processes the given javac compilation errors.
        *
        * @param details Array of JavacErrorDetail instances corresponding to the
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message