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/31 21:15:35 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler JspDocumentParser.java PageInfo.java Parser.java TldLocationsCache.java Validator.java
luehe 2003/03/31 11:15:34
Modified: jasper2/src/share/org/apache/jasper/compiler
JspDocumentParser.java PageInfo.java Parser.java
TldLocationsCache.java Validator.java
Log:
Fixed 18236 ("An xmlns declaration that doesn't denote a tag library
causes translation error")
Revision Changes Path
1.50 +15 -8 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.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- JspDocumentParser.java 28 Mar 2003 02:13:02 -0000 1.49
+++ JspDocumentParser.java 31 Mar 2003 19:15:34 -0000 1.50
@@ -104,7 +104,7 @@
// Document locator
private Locator locator;
- private Hashtable taglibs;
+ private HashMap taglibs;
// Flag indicating whether we are inside DTD declarations
private boolean inDTD;
@@ -773,16 +773,23 @@
tagdir, err);
} else {
// uri references TLD file
+ boolean isPlainUri = false;
if (uri.startsWith(URN_JSPTLD)) {
// uri is of the form "urn:jsptld:path"
uri = uri.substring(URN_JSPTLD.length());
+ } else {
+ isPlainUri = true;
}
TldLocationsCache cache = ctxt.getOptions().getTldLocationsCache();
- result = cache.getTagLibraryInfo(uri);
- if (result == null) {
- // get the location
- String[] location = ctxt.getTldLocation(uri);
+ String[] location = cache.getLocation(uri);
+ if (location != null || !isPlainUri) {
+ /*
+ * If the uri value is a plain uri, a translation error must
+ * not be generated if the uri is not found in the taglib map.
+ * Instead, any actions in the namespace defined by the uri
+ * value must be treated as uninterpreted.
+ */
result = new TagLibraryInfoImpl(ctxt, parserController, prefix,
uri, location, err);
}
1.28 +7 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java
Index: PageInfo.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- PageInfo.java 25 Mar 2003 00:57:46 -0000 1.27
+++ PageInfo.java 31 Mar 2003 19:15:34 -0000 1.28
@@ -76,7 +76,7 @@
private Vector dependants;
private BeanRepository beanRepository;
- private Hashtable tagLibraries;
+ private HashMap taglibsMap;
private Hashtable prefixMapper;
private String language = "java";
@@ -113,7 +113,7 @@
PageInfo(BeanRepository beanRepository) {
this.beanRepository = beanRepository;
- this.tagLibraries = new Hashtable();
+ this.taglibsMap = new HashMap();
this.prefixMapper = new Hashtable();
this.imports = new Vector();
this.dependants = new Vector();
@@ -163,8 +163,8 @@
return beanRepository;
}
- public Hashtable getTagLibraries() {
- return tagLibraries;
+ public HashMap getTagLibraries() {
+ return taglibsMap;
}
/*
1.71 +5 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- Parser.java 28 Mar 2003 02:13:02 -0000 1.70
+++ Parser.java 31 Mar 2003 19:15:34 -0000 1.71
@@ -63,6 +63,7 @@
import java.io.FileNotFoundException;
import java.io.CharArrayWriter;
import java.util.Hashtable;
+import java.util.HashMap;
import java.util.List;
import java.util.Iterator;
import java.util.jar.JarFile;
@@ -94,7 +95,7 @@
private JspReader reader;
private String currentFile;
private Mark start;
- private Hashtable taglibs;
+ private HashMap taglibs;
private Hashtable prefixMapper;
private ErrorDispatcher err;
private int scriptlessCount;
1.15 +18 -29 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TldLocationsCache.java 26 Mar 2003 20:40:15 -0000 1.14
+++ TldLocationsCache.java 31 Mar 2003 19:15:34 -0000 1.15
@@ -137,8 +137,6 @@
*/
private Hashtable mappings;
- private Hashtable tlds;
-
private boolean initialized;
private ServletContext ctxt;
private boolean redeployMode;
@@ -164,29 +162,30 @@
this.ctxt = ctxt;
this.redeployMode = redeployMode;
mappings = new Hashtable();
- tlds = new Hashtable();
initialized = false;
}
/**
- * Get the 'location' of the TLD associated with
- * a given taglib 'uri'.
+ * Gets the 'location' of the TLD associated with the given taglib 'uri'.
+ *
+ * Returns null if the uri is not associated with any tag library 'exposed'
+ * in the web application. A tag library is 'exposed' either explicitly in
+ * web.xml or implicitly 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 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).
+ * @param uri The taglib uri
+ *
+ * @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 uri is not associated with any tag library 'exposed'
+ * in the web application.
*/
- public String[] getLocation(String uri)
- throws JasperException
- {
- if( ! initialized ) init();
- return (String[])mappings.get(uri);
+ public String[] getLocation(String uri) throws JasperException {
+ if (!initialized) {
+ init();
+ }
+ return (String[]) mappings.get(uri);
}
/**
@@ -203,16 +202,6 @@
} else {
return NOROOT_REL_URI;
}
- }
-
- public TagLibraryInfo getTagLibraryInfo(String uri) {
- if (!initialized) init();
- return (TagLibraryInfo) tlds.get(uri);
- }
-
- public void addTagLibraryInfo(String uri, TagLibraryInfo tld) {
- if (!initialized) init();
- tlds.put(uri, tld);
}
private void init() {
1.101 +16 -14 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java
Index: Validator.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- Validator.java 31 Mar 2003 17:54:30 -0000 1.100
+++ Validator.java 31 Mar 2003 19:15:34 -0000 1.101
@@ -375,7 +375,7 @@
private ErrorDispatcher err;
private TagInfo tagInfo;
private ClassLoader loader;
- private Hashtable taglibs;
+ private HashMap taglibs;
private static final JspUtil.ValidAttribute[] jspRootAttrs = {
new JspUtil.ValidAttribute("version", true) };
@@ -1492,14 +1492,16 @@
StringBuffer errMsg = null;
ErrorDispatcher errDisp = compiler.getErrorDispatcher();
- Enumeration enum = compiler.getPageInfo().getTagLibraries().elements();
- while (enum.hasMoreElements()) {
- TagLibraryInfo tli = (TagLibraryInfo) enum.nextElement();
- if (!(tli instanceof TagLibraryInfoImpl))
+ Object[] objs
+ = compiler.getPageInfo().getTagLibraries().values().toArray();
+
+ for (int i=0; i<objs.length; i++) {
+
+ if (!(objs[i] instanceof TagLibraryInfoImpl))
continue;
+ TagLibraryInfoImpl tli = (TagLibraryInfoImpl) objs[i];
- ValidationMessage[] errors
- = ((TagLibraryInfoImpl) tli).validate(xmlView);
+ ValidationMessage[] errors = tli.validate(xmlView);
if ((errors != null) && (errors.length != 0)) {
if (errMsg == null) {
errMsg = new StringBuffer();
@@ -1508,12 +1510,12 @@
errMsg.append(Localizer.getMessage("jsp.error.tlv.invalid.page",
tli.getShortName()));
errMsg.append("</h3>");
- for (int i=0; i<errors.length; i++) {
- if (errors[i] != null) {
+ for (int j=0; j<errors.length; j++) {
+ if (errors[j] != null) {
errMsg.append("<p>");
- errMsg.append(errors[i].getId());
+ errMsg.append(errors[j].getId());
errMsg.append(": ");
- errMsg.append(errors[i].getMessage());
+ errMsg.append(errors[j].getMessage());
errMsg.append("</p>");
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org