You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2003/03/06 21:21:49 UTC

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime JspRuntimeLibrary.java

luehe       2003/03/06 12:21:47

  Modified:    jasper2/src/share/org/apache/jasper/compiler Localizer.java
                        TldLocationsCache.java
               jasper2/src/share/org/apache/jasper/resources
                        messages.properties
               jasper2/src/share/org/apache/jasper/runtime
                        JspRuntimeLibrary.java
  Log:
  Replaced error messages with localizable error codes
  
  Revision  Changes    Path
  1.2       +23 -3     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Localizer.java
  
  Index: Localizer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Localizer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Localizer.java	22 Jan 2003 20:08:24 -0000	1.1
  +++ Localizer.java	6 Mar 2003 20:21:45 -0000	1.2
  @@ -149,6 +149,26 @@
   	return getMessage(errCode, new Object[] {arg1, arg2, arg3});
       }
   
  +    /* 
  +     * Returns the localized error message corresponding to the given error
  +     * code.
  +     *
  +     * If the given error code is not defined in the resource bundle for
  +     * localized error messages, it is used as the error message.
  +     *
  +     * @param errCode Error code to localize
  +     * @param arg1 First argument for parametric replacement
  +     * @param arg2 Second argument for parametric replacement
  +     * @param arg3 Third argument for parametric replacement
  +     * @param arg4 Fourth argument for parametric replacement
  +     *
  +     * @return Localized error message
  +     */
  +    public static String getMessage(String errCode, String arg1, String arg2,
  +				    String arg3, String arg4) {
  +	return getMessage(errCode, new Object[] {arg1, arg2, arg3, arg4});
  +    }
  +
       /*
        * Returns the localized error message corresponding to the given error
        * code.
  
  
  
  1.13      +3 -1      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java
  
  Index: TldLocationsCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TldLocationsCache.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TldLocationsCache.java	5 Mar 2003 17:58:44 -0000	1.12
  +++ TldLocationsCache.java	6 Mar 2003 20:21:45 -0000	1.13
  @@ -319,7 +319,9 @@
        * an implicit map entry to the taglib map for any TLD that has a <uri>
        * element.
        */
  -    private void processTldsInFileSystem(String startPath) throws JasperException {
  +    private void processTldsInFileSystem(String startPath)
  +	    throws JasperException {
  +
   	Set dirList = ctxt.getResourcePaths(startPath);
   	if (dirList != null) {
   	    Iterator it = dirList.iterator();
  
  
  
  1.104     +4 -1      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
  retrieving revision 1.103
  retrieving revision 1.104
  diff -u -r1.103 -r1.104
  --- messages.properties	3 Mar 2003 18:19:59 -0000	1.103
  +++ messages.properties	6 Mar 2003 20:21:46 -0000	1.104
  @@ -97,6 +97,8 @@
   jsp.error.beans.nomethod.setproperty=Can''t find a method to write property ''{0}'' of type ''{1}'' in a bean of type ''{2}''
   jsp.error.beans.noproperty=Cannot find any information on property ''{0}'' in a bean of type ''{1}''
   jsp.error.beans.setproperty.noindexset=Cannot set indexed property
  +jsp.error.beans.property.conversion=Unable to convert string \"{0}\" to class \"{1}\" for attribute \"{2}\": {3}
  +jsp.error.beans.propertyeditor.notregistered=Property Editor not registered with the PropertyEditorManager
   jsp.error.include.tag=Invalid jsp:include tag
   jsp.error.include.noflush=jsp:include needs to have \"flush=true\"
   jsp.error.include.badflush=jsp:include page=\"...\" flush=\"true\" is the only valid combination in JSP 1.0
  @@ -372,3 +374,4 @@
   jsp.error.attribute.null_name=Null attribute name
   jsp.error.jsptext.badcontent=\'&lt;\', when appears in the body of &lt;jsp:text&gt;, must be encapsulated within a CDATA
   jsp.error.jsproot.version.invalid=Invalid version number: \"{0}\", must be \"1.2\" or \"2.0\"
  +
  
  
  
  1.17      +11 -10    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java
  
  Index: JspRuntimeLibrary.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- JspRuntimeLibrary.java	8 Feb 2003 00:07:32 -0000	1.16
  +++ JspRuntimeLibrary.java	6 Mar 2003 20:21:46 -0000	1.17
  @@ -876,9 +876,9 @@
   	    return pe.getValue();
   	} catch (Exception ex) {
   	    throw new JasperException(
  -	        "Unable to convert string '" + attrValue + "' to class " +
  -		attrClass.getName() + " for attribute " + attrName +
  -		": " + ex);
  +                Localizer.getMessage("jsp.error.beans.property.conversion",
  +				     attrValue, attrClass.getName(), attrName,
  +				     ex.getMessage()));
   	}
       }
   
  @@ -893,13 +893,14 @@
   		propEditor.setAsText(attrValue);
   		return propEditor.getValue();
   	    } else {
  -		throw new IllegalArgumentException("Property Editor not registered with the PropertyEditorManager");
  +		throw new IllegalArgumentException(
  +                    Localizer.getMessage("jsp.error.beans.propertyeditor.notregistered"));
   	    }
   	} catch (IllegalArgumentException ex) {
   	    throw new JasperException(
  -		"Unable to convert string '" + attrValue + "' to class " +
  -		attrClass.getName() + " for attribute " + attrName +
  -		": " + ex);
  +                Localizer.getMessage("jsp.error.beans.property.conversion",
  +				     attrValue, attrClass.getName(), attrName,
  +				     ex.getMessage()));
   	}
       }
   
  
  
  

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