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/04/01 05:14:53 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet JspServlet.java
luehe 2003/03/31 19:14:53
Modified: jasper2/src/share/org/apache/jasper
JspCompilationContext.java
jasper2/src/share/org/apache/jasper/compiler
JspDocumentParser.java TagLibraryInfoImpl.java
TldLocationsCache.java
jasper2/src/share/org/apache/jasper/resources
messages.properties messages_es.properties
messages_fr.properties messages_ja.properties
jasper2/src/share/org/apache/jasper/servlet JspServlet.java
Log:
- Fixed regression caused by fix to 15875 ("Automatic Recognition of
Tag Library TLDs")
- Expose any errors occurring during initialization of TLD locations cache
Revision Changes Path
1.36 +10 -17 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java
Index: JspCompilationContext.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- JspCompilationContext.java 27 Feb 2003 22:51:38 -0000 1.35
+++ JspCompilationContext.java 1 Apr 2003 03:14:52 -0000 1.36
@@ -517,18 +517,13 @@
}
/**
- * Get the 'location' of the TLD associated with
- * a given taglib 'uri'.
+ * Gets the 'location' of the TLD associated with the given taglib 'uri'.
*
- * @return An array of two Strings. The first one is
- * real path to the TLD. If the path to the TLD points
- * to a jar file, then the second string is the
- * name of the entry for the TLD in the jar file.
- * Returns null if the uri is not associated to
- * a tag library 'exposed' in the web application.
- * A tag library is 'exposed' either explicitely in
- * web.xml or implicitely via the uri tag in the TLD
- * of a taglib deployed in a jar file (WEB-INF/lib).
+ * @return An array of two Strings: The first element denotes the real
+ * path to the TLD. If the path to the TLD points to a jar file, then the
+ * second element denotes the name of the TLD entry in the jar file.
+ * Returns null if the given uri is not associated with any tag library
+ * 'exposed' in the web application.
*/
public String[] getTldLocation(String uri) throws JasperException {
String[] location =
@@ -554,7 +549,6 @@
removed++;
}
-
public boolean isRemoved() {
if (removed > 1 ) {
return true;
@@ -597,8 +591,7 @@
if (isTagFile()) {
name = tagInfo.getTagClassName();
} else {
- name = getServletPackageName() + "." +
- getServletClassName();
+ name = getServletPackageName() + "." + getServletClassName();
}
servletClass = jspLoader.loadClass(name);
} catch (ClassNotFoundException cex) {
1.51 +4 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java
Index: JspDocumentParser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- JspDocumentParser.java 31 Mar 2003 19:15:34 -0000 1.50
+++ JspDocumentParser.java 1 Apr 2003 03:14:52 -0000 1.51
@@ -781,8 +781,7 @@
isPlainUri = true;
}
- TldLocationsCache cache = ctxt.getOptions().getTldLocationsCache();
- String[] location = cache.getLocation(uri);
+ String[] location = ctxt.getTldLocation(uri);
if (location != null || !isPlainUri) {
/*
* If the uri value is a plain uri, a translation error must
1.37 +7 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
Index: TagLibraryInfoImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- TagLibraryInfoImpl.java 26 Mar 2003 20:40:15 -0000 1.36
+++ TagLibraryInfoImpl.java 1 Apr 2003 03:14:52 -0000 1.37
@@ -167,8 +167,8 @@
boolean relativeURL = false;
if (location == null) {
- // The URI points to the TLD itself or to a jar
- // file where the TLD is located
+ // The URI points to the TLD itself or to a jar file where the TLD
+ // is stored
int uriType = TldLocationsCache.uriType(uri);
if (uriType == TldLocationsCache.ABS_URI) {
err.jspError("jsp.error.taglibDirective.absUriCannotBeResolved",
@@ -232,7 +232,8 @@
} catch (Throwable t) {}
}
*/
- throw new JasperException(ex);
+ err.jspError("jsp.error.tld.unable_to_read", location[0],
+ location[1], ex.toString());
}
}
}
1.16 +15 -9 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- TldLocationsCache.java 31 Mar 2003 19:15:34 -0000 1.15
+++ TldLocationsCache.java 1 Apr 2003 03:14:52 -0000 1.16
@@ -127,7 +127,9 @@
public static final int NOROOT_REL_URI = 2;
private static final String WEB_XML = "/WEB-INF/web.xml";
-
+ private static final String FILE_PROTOCOL = "file:";
+ private static final String JAR_FILE_SUFFIX = ".jar";
+
/**
* The mapping of the 'global' tag library URI to the location (resource
* path) of the TLD associated with that tag library. The location is
@@ -204,7 +206,7 @@
}
}
- private void init() {
+ private void init() throws JasperException {
if (initialized) return;
try {
processWebDotXml();
@@ -213,14 +215,15 @@
processTldsInGlobalJars();
initialized = true;
} catch (Exception ex) {
- log.error(Localizer.getMessage("jsp.error.internal.tldinit"), ex);
+ throw new JasperException(Localizer.getMessage("jsp.error.internal.tldinit",
+ ex.getMessage()));
}
}
/*
* Populates taglib map described in web.xml.
*/
- private void processWebDotXml() throws JasperException {
+ private void processWebDotXml() throws Exception {
// Acquire an input stream to the web application deployment descriptor
InputStream is = ctxt.getResourceAsStream(WEB_XML);
@@ -235,7 +238,7 @@
// Parse the web application deployment descriptor
TreeNode webtld = new ParserUtils().parseXMLDocument(WEB_XML, is);
- // Allow taglib be an element of the root or jsp-config (JSP2.0)
+ // Allow taglib to be an element of the root or jsp-config (JSP2.0)
TreeNode jspConfig = webtld.findChild("jsp-config");
if (jspConfig != null) {
webtld = jspConfig;
@@ -260,9 +263,11 @@
if (uriType(tagLoc) == NOROOT_REL_URI)
tagLoc = "/WEB-INF/" + tagLoc;
String tagLoc2 = null;
- if (tagLoc.endsWith(".jar"))
+ if (tagLoc.endsWith(JAR_FILE_SUFFIX)) {
+ tagLoc = ctxt.getResource(tagLoc).toString();
tagLoc2 = "META-INF/taglib.tld";
- mappings.put(tagUri, new String[] {tagLoc, tagLoc2});
+ }
+ mappings.put(tagUri, new String[] { tagLoc, tagLoc2 });
}
}
@@ -277,7 +282,7 @@
Iterator it = libSet.iterator();
while (it.hasNext()) {
String resourcePath = (String) it.next();
- if (resourcePath.endsWith(".jar")) {
+ if (resourcePath.endsWith(JAR_FILE_SUFFIX)) {
URL url = ctxt.getResource(resourcePath);
if (url == null)
return;
@@ -440,7 +445,8 @@
processTldsInJar((JarURLConnection) conn);
} else {
String urlStr = urls[i].toString();
- if (urlStr.startsWith("file:") && urlStr.endsWith(".jar")) {
+ if (urlStr.startsWith(FILE_PROTOCOL)
+ && urlStr.endsWith(JAR_FILE_SUFFIX)) {
URL jarURL = new URL("jar:" + urlStr + "!/");
processTldsInJar((JarURLConnection)
jarURL.openConnection());
1.111 +3 -3 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.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- messages.properties 27 Mar 2003 22:51:45 -0000 1.110
+++ messages.properties 1 Apr 2003 03:14:53 -0000 1.111
@@ -168,7 +168,7 @@
jsp.message.template_text=template text
jsp.error.missing_attribute=According to the TLD attribute {0} is mandatory for tag {1}
jsp.error.bad_attribute=Attribute {0} invalid for tag {1} according to TLD
-jsp.error.tld_not_found=Could not locate TLD {0}
+jsp.error.tld.unable_to_read=Unable to read TLD \"{1}\" from JAR file \"{0}\": {2}
jsp.error.webxml_not_found=Could not locate web.xml
jsp.cmd_line.usage=Usage: jsptoservlet [-dd <path/to/outputDirectory>] [-keepgenerated] \
<.jsp files>
@@ -255,7 +255,7 @@
jsp.error.parse.xml=XML parsing error on file {0}
jsp.error.parse.xml.line=XML parsing error on file {0}: (line {1}, col {2})
jsp.error.parse.xml.scripting.invalid.body=Body of {0} element must not contain any XML elements
-jsp.error.internal.tldinit=Exception initializing TldLocationsCache
+jsp.error.internal.tldinit=Unable to initialize TldLocationsCache: {0}
jsp.error.internal.filenotfound=Internal Error: File {0} not found
jsp.error.internal.evaluator_not_found=Internal error: unable to load expression evaluator
jsp.error.parse.xml.invalidPublicId=Invalid PUBLIC ID: {0}
1.37 +1 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties
Index: messages_es.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- messages_es.properties 28 Feb 2003 00:12:41 -0000 1.36
+++ messages_es.properties 1 Apr 2003 03:14:53 -0000 1.37
@@ -126,7 +126,6 @@
jsp.message.compiling_with=Compilado con: {0}
jsp.error.missing_attribute=De acuerdo el TLD el atributo {0} es obligatorio para el tag {1}
jsp.error.bad_attribute=atributo {0} no es valido de acuerdo con el TLD especificado
-jsp.error.tld_not_found=No puedo localizar el TLD {0}
jsp.error.webxml_not_found=No puedo localizar web.xml
jsp.cmd_line.usage=Uso: jsptoservlet [-dd <ruta/a/DirectorioSalida>] [-keepgenerated] <Archivos .jsp>
jsp.message.cp_is=classpath {0} es: {1}
1.22 +2 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_fr.properties
Index: messages_fr.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_fr.properties,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- messages_fr.properties 27 Mar 2003 00:16:39 -0000 1.21
+++ messages_fr.properties 1 Apr 2003 03:14:53 -0000 1.22
@@ -150,7 +150,6 @@
jsp.message.template_text=texte template
jsp.error.missing_attribute=D''apr�s le TLD l''attribut {0} est obligatoire pour le tag {1}
jsp.error.bad_attribute=L''attribut {0} est incorrect pour le tag {1} d''apr�s la TLD indiqu�e
-sjsp.error.tld_not_found=Impossible de localiser la TLD {0}
jsp.error.webxml_not_found=Impossible de localiser le fichier web.xml
jsp.cmd_line.usage=Usage: jsptoservlet [-dd <path/to/outputDirectory>] [-keepgenerated] \
<.jsp files>
@@ -235,7 +234,7 @@
jsp.error.parse.xml=Erreur d''�valuation XML sur le fichier {0}
jsp.error.parse.xml.line=Erreur d''�valuation XML sur le fichier {0}: (ligne {1}, col {2})
jsp.error.parse.xml.scripting.invalid.body=Le corps de l''�l�ment {0} ne doit contenir aucun �l�ments XML
-jsp.error.internal.tldinit=Exception lors de l'initialisation de TldLocationsCache
+jsp.error.internal.tldinit=Exception lors de l'initialisation de TldLocationsCache: {0}
jsp.error.internal.filenotfound=Erreur interne: Fichier {0} introuvable
jsp.error.internal.evaluator_not_found=Erreur interne: Impossible de charger l''�valuateur d''expression
jsp.error.parse.xml.invalidPublicId=PUBLIC ID invalide: {0}
1.38 +2 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties
Index: messages_ja.properties
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- messages_ja.properties 4 Mar 2003 17:32:39 -0000 1.37
+++ messages_ja.properties 1 Apr 2003 03:14:53 -0000 1.38
@@ -164,7 +164,6 @@
jsp.message.template_text=\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30c6\u30ad\u30b9\u30c8
jsp.error.missing_attribute=TLD\u306b\u3088\u308b\u3068\u3001\u5c5e\u6027 {0} \u306f\u30bf\u30b0 {1} \u306b\u306f\u5fc5\u9808\u3067\u3059
jsp.error.bad_attribute=TLD\u306b\u3088\u308b\u3068\u3001\u30bf\u30b0 {1} \u306e\u5c5e\u6027 {0} \u306f\u7121\u52b9\u3067\u3059
-jsp.error.tld_not_found=TLD {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093
jsp.error.webxml_not_found=web.xml\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093
jsp.cmd_line.usage=\u4f7f\u7528\u6cd5: [-dd <\u51fa\u529b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u30d1\u30b9>] [-keepgenerated] \
<.jsp\u30d5\u30a1\u30a4\u30eb\u7fa4>
@@ -250,7 +249,7 @@
jsp.error.parse.xml=\u30d5\u30a1\u30a4\u30eb{0}\u306eXML\u89e3\u6790\u30a8\u30e9\u30fc
jsp.error.parse.xml.line=\u30d5\u30a1\u30a4\u30eb{0}\u306eXML\u89e3\u6790\u30a8\u30e9\u30fc: (\u884c {1}, \u5217 {2})
jsp.error.parse.xml.scripting.invalid.body={0} \u8981\u7d20\u306e\u30dc\u30c7\u30a3\u306fXML\u8981\u7d20\u3092\u542b\u3093\u3067\u306f\u3044\u3051\u307e\u305b\u3093
-jsp.error.internal.tldinit=TldLocationsCache\u3092\u521d\u671f\u5316\u4e2d\u306e\u4f8b\u5916\u3067\u3059
+jsp.error.internal.tldinit=TldLocationsCache\u3092\u521d\u671f\u5316\u4e2d\u306e\u4f8b\u5916\u3067\u3059: {0}
jsp.error.internal.filenotfound=\u5185\u90e8\u30a8\u30e9\u30fc: \u30d5\u30a1\u30a4\u30eb {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093
jsp.error.internal.evaluator_not_found=\u5185\u90e8\u30a8\u30e9\u30fc: \u5f0f\u691c\u8a3c\u5668\u3092\u30ed\u30fc\u30c9\u3067\u304d\u307e\u305b\u3093
jsp.error.parse.xml.invalidPublicId=\u7121\u52b9\u306aPUBLIC ID: {0}
1.25 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java
Index: JspServlet.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- JspServlet.java 29 Mar 2003 02:15:18 -0000 1.24
+++ JspServlet.java 1 Apr 2003 03:14:53 -0000 1.25
@@ -126,7 +126,7 @@
if (log.isDebugEnabled()) {
log.debug(Localizer.getMessage("jsp.message.scratch.dir.is",
- options.getScratchDir().toString()));
+ options.getScratchDir().toString()));
log.debug(Localizer.getMessage("jsp.message.dont.modify.servlets"));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org