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/05/01 18:42:13 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler ELFunctionMapper.java Generator.java PageDataImpl.java TagPluginManager.java Validator.java
luehe 2003/05/01 09:42:12
Modified: jasper2/src/share/org/apache/jasper/compiler
ELFunctionMapper.java Generator.java
PageDataImpl.java TagPluginManager.java
Validator.java
Log:
Added more checks for NULL attributes
Revision Changes Path
1.12 +2 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ELFunctionMapper.java
Index: ELFunctionMapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ELFunctionMapper.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- ELFunctionMapper.java 1 May 2003 02:35:20 -0000 1.11
+++ ELFunctionMapper.java 1 May 2003 16:42:12 -0000 1.12
@@ -136,7 +136,7 @@
public void visit(Node.JspElement n) throws JasperException {
Node.JspAttribute[] attrs = n.getJspAttributes();
- for (int i = 0; i < attrs.length; i++) {
+ for (int i = 0; attrs != null && i < attrs.length; i++) {
doMap(attrs[i]);
}
doMap(n.getNameAttribute());
@@ -146,7 +146,7 @@
public void visit(Node.UninterpretedTag n) throws JasperException {
Node.JspAttribute[] attrs = n.getJspAttributes();
- for (int i = 0; i < attrs.length; i++) {
+ for (int i = 0; attrs != null && i < attrs.length; i++) {
doMap(attrs[i]);
}
visitBody(n);
1.185 +23 -24 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java
Index: Generator.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -r1.184 -r1.185
--- Generator.java 1 May 2003 02:35:20 -0000 1.184
+++ Generator.java 1 May 2003 16:42:12 -0000 1.185
@@ -1574,26 +1574,25 @@
out.print(n.getQName());
Attributes attrs = n.getAttributes();
Node.JspAttribute[] jspAttrs = n.getJspAttributes();
- if (attrs != null) {
- int attrsLength = attrs.getLength();
- for (int i=0; i<attrsLength; i++) {
- out.print(" ");
- out.print(attrs.getQName(i));
- out.print("=");
- if (jspAttrs[i].isELInterpreterInput()) {
- out.print("\\\"\" + ");
- out.print(attributeValue(jspAttrs[i], false, Object.class));
- out.print(" + \"\\\"");
- } else {
- String quote = DOUBLE_QUOTE;
- String value = attrs.getValue(i);
- if (value.indexOf('"') != -1) {
- quote = SINGLE_QUOTE;
- }
- out.print(quote);
- out.print(value);
- out.print(quote);
+ int attrsLength = (attrs == null) ? 0 : attrs.getLength();
+ for (int i=0; i<attrsLength; i++) {
+ out.print(" ");
+ out.print(attrs.getQName(i));
+ out.print("=");
+ if (jspAttrs[i].isELInterpreterInput()) {
+ out.print("\\\"\" + ");
+ out.print(attributeValue(jspAttrs[i], false,
+ Object.class));
+ out.print(" + \"\\\"");
+ } else {
+ String quote = DOUBLE_QUOTE;
+ String value = attrs.getValue(i);
+ if (value.indexOf('"') != -1) {
+ quote = SINGLE_QUOTE;
}
+ out.print(quote);
+ out.print(value);
+ out.print(quote);
}
}
@@ -1620,7 +1619,7 @@
// attributes
Hashtable map = new Hashtable();
Node.JspAttribute[] attrs = n.getJspAttributes();
- for (int i=0; i<attrs.length; i++) {
+ for (int i=0; attrs != null && i<attrs.length; i++) {
String attrStr = null;
if (attrs[i].isNamedAttribute()) {
attrStr = generateNamedAttributeValue(
@@ -1818,7 +1817,7 @@
public void visit(Node.AttributeGenerator n) throws JasperException {
Node.CustomTag tag = n.getTag();
Node.JspAttribute[] attrs = tag.getJspAttributes();
- for (int i=0; i<attrs.length; i++) {
+ for (int i=0; attrs != null && i<attrs.length; i++) {
if (attrs[i].getName().equals(n.getName())) {
out.print(evaluateAttribute(getTagHandlerInfo(tag),
attrs[i], tag, null));
1.30 +11 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java
Index: PageDataImpl.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- PageDataImpl.java 9 Apr 2003 00:23:51 -0000 1.29
+++ PageDataImpl.java 1 May 2003 16:42:12 -0000 1.30
@@ -492,7 +492,7 @@
private void appendPageDirective(Node.PageDirective n) {
boolean append = false;
Attributes attrs = n.getAttributes();
- int len = attrs.getLength();
+ int len = (attrs == null) ? 0 : attrs.getLength();
for (int i=0; i<len; i++) {
String attrName = attrs.getQName(i);
if (!"pageEncoding".equals(attrName)
@@ -583,7 +583,7 @@
boolean append = false;
Attributes attrs = n.getAttributes();
- int len = attrs.getLength();
+ int len = (attrs == null) ? 0 : attrs.getLength();
for (int i=0; i<len; i++) {
String attrName = attrs.getQName(i);
if (!"pageEncoding".equals(attrName)) {
@@ -684,14 +684,12 @@
}
attrs = n.getAttributes();
- if (attrs != null) {
- int len = attrs.getLength();
- for (int i=0; i<len; i++) {
- String name = attrs.getQName(i);
- String value = attrs.getValue(i);
- buf.append(" ").append(name).append("=\"");
- buf.append(JspUtil.getExprInXml(value)).append("\"\n");
- }
+ int len = (attrs == null) ? 0 : attrs.getLength();
+ for (int i=0; i<len; i++) {
+ String name = attrs.getQName(i);
+ String value = attrs.getValue(i);
+ buf.append(" ").append(name).append("=\"");
+ buf.append(JspUtil.getExprInXml(value)).append("\"\n");
}
}
1.17 +4 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagPluginManager.java
Index: TagPluginManager.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagPluginManager.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- TagPluginManager.java 5 Mar 2003 01:32:45 -0000 1.16
+++ TagPluginManager.java 1 May 2003 16:42:12 -0000 1.17
@@ -273,7 +273,7 @@
private Node.JspAttribute getNodeAttribute(String attribute) {
Node.JspAttribute[] attrs = node.getJspAttributes();
- for (int i=0; i < attrs.length; i++) {
+ for (int i=0; attrs != null && i < attrs.length; i++) {
if (attrs[i].getName().equals(attribute)) {
return attrs[i];
}
1.105 +7 -16 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.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- Validator.java 1 May 2003 02:35:20 -0000 1.104
+++ Validator.java 1 May 2003 16:42:12 -0000 1.105
@@ -728,6 +728,7 @@
TagAttributeInfo[] tldAttrs = tagInfo.getAttributes();
String customActionUri = n.getURI();
Attributes attrs = n.getAttributes();
+ int attrsSize = (attrs == null) ? 0 : attrs.getLength();
for (int i=0; i<tldAttrs.length; i++) {
String attr = null;
if (attrs != null) {
@@ -751,25 +752,15 @@
}
Node.Nodes naNodes = n.getNamedAttributeNodes();
- int jspAttrsSize = naNodes.size();
- if (attrs != null) {
- jspAttrsSize += attrs.getLength();
- }
+ int jspAttrsSize = naNodes.size() + attrsSize;
Node.JspAttribute[] jspAttrs = null;
if (jspAttrsSize > 0) {
jspAttrs = new Node.JspAttribute[jspAttrsSize];
}
- Hashtable tagDataAttrs = null;
- if (attrs != null) {
- tagDataAttrs = new Hashtable(attrs.getLength());
- } else {
- tagDataAttrs = new Hashtable(0);
- }
+ Hashtable tagDataAttrs = new Hashtable(attrsSize);
checkXmlAttributes(n, jspAttrs, tagDataAttrs);
- checkNamedAttributes(n, jspAttrs,
- (attrs!=null) ? attrs.getLength():0,
- tagDataAttrs);
+ checkNamedAttributes(n, jspAttrs, attrsSize, tagDataAttrs);
TagData tagData = new TagData(tagDataAttrs);
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org