You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Petr Jiricka <pe...@netbeans.com> on 2000/05/07 16:29:59 UTC
[PATCH] Error lines in JSP translator
Hello,
I would like to propose the following harmless patch. The problem with the
JSP compiler now is that it does not always report a line on which a
compilation error occurred (by throwing ParseException rather than
JasperException. It only throws ParseException during parsing, not during
generation of JSP (*Generator classes). This can be fixed by throwing
exception which contains information about line numbers (Mark). Following is
a patch which adds one new class (CompileException) and modifies compiler
classes to throw this exception rather than JasperException.
As it is not possible to produce a diff for files not existing in the CVS, I
am posting CompileException as text, and then a diff for the other files.
Thank you in advance for incorporating this or a similar patch.
Petr
============================================================
package org.apache.jasper.compiler;
import org.apache.jasper.JasperException;
/**
* Class for parser exceptions.
*
* @author Petr Jiricka
*/
public class CompileException extends JasperException {
public CompileException(Mark m,String reason) {
super(m + " " + reason);
}
public CompileException(Mark m,String reason, Throwable exception) {
super(m + " " + reason, exception);
}
public CompileException(String reason) {
super(reason);
}
}
W:\Development\src_jakarta\jakarta-tomcat\jakarta-tomcat\src\share\org\apach
e\jasper\compiler>cvs diff -u *.java
Index: BeanGenerator.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/BeanGene
rator.java,v
retrieving revision 1.6
diff -u -r1.6 BeanGenerator.java
--- BeanGenerator.java 2000/04/25 00:07:54 1.6
+++ BeanGenerator.java 2000/05/07 14:09:15
@@ -78,12 +78,14 @@
BeanRepository beanInfo;
boolean genSession;
boolean beanRT = false;
+ Mark start;
public BeanGenerator (Mark start, Hashtable attrs, BeanRepository
beanInfo,
boolean genSession) {
this.attrs = attrs;
this.beanInfo = beanInfo;
this.genSession = genSession;
+ this.start = start;
}
public void generate (ServletWriter writer, Class phase)
@@ -108,33 +110,33 @@
// Check for mandatory attributes:
if ( name == null ) {
String m =
Constants.getString("jsp.error.usebean.missing.attribute");
- throw new JasperException(m);
+ throw new CompileException(start, m);
}
if (clsname == null && type == null) {
String m =
Constants.getString("jsp.error.usebean.missing.type",
new Object[] {name});
- throw new JasperException (m);
+ throw new CompileException (start, m);
}
if (beanInfo.checkVariable(name) == true) {
String m =
Constants.getString("jsp.error.usebean.duplicate",
new Object[] {name});
- throw new JasperException (m);
+ throw new CompileException (start, m);
}
if (scope != null && scope.equalsIgnoreCase ("session")) {
if (genSession != true) {
String m =
Constants.getString("jsp.error.usebean.prohibited.as.session",
new Object[] {name});
- throw new JasperException (m);
+ throw new CompileException (start, m);
}
}
if (clsname != null && beanName != null) {
String m = Constants.getString("jsp.error.usebean.not.both",
new Object[] {name});
- throw new JasperException (m);
+ throw new CompileException (start, m);
}
if (clsname == null) clsname = type;
@@ -149,7 +151,7 @@
} else {
String m =
Constants.getString("jsp.error.usebean.invalid.scope",
new Object[] {name, scope});
- throw new JasperException (m);
+ throw new CompileException (start, m);
}
}
cvs.real server: I know nothing about CompileException.java
Index: ForwardGenerator.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/ForwardG
enerator.java,v
retrieving revision 1.2
diff -u -r1.2 ForwardGenerator.java
--- ForwardGenerator.java 1999/10/19 21:34:49 1.2
+++ ForwardGenerator.java 2000/05/07 14:09:15
@@ -80,13 +80,13 @@
boolean isExpression = false;
Hashtable params;
- public ForwardGenerator(Hashtable attrs, Hashtable param) throws
JasperException {
+ public ForwardGenerator(Mark start, Hashtable attrs, Hashtable param)
throws JasperException {
if (attrs.size() != 1)
throw new
JasperException(Constants.getString("jsp.error.invalid.forward"));
page = (String) attrs.get("page");
if (page == null)
- throw new
JasperException(Constants.getString("jsp.error.invalid.forward"));
+ throw new CompileException(start,
Constants.getString("jsp.error.invalid.forward"));
this.params = param;
isExpression = JspUtil.isExpression (page);
Index: IncludeGenerator.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/IncludeG
enerator.java,v
retrieving revision 1.3
diff -u -r1.3 IncludeGenerator.java
--- IncludeGenerator.java 1999/10/19 21:34:50 1.3
+++ IncludeGenerator.java 2000/05/07 14:09:15
@@ -88,22 +88,22 @@
boolean isExpression = false;
Hashtable params;
- public IncludeGenerator(Hashtable attrs, Hashtable param)
+ public IncludeGenerator(Mark start, Hashtable attrs, Hashtable param)
throws JasperException
{
if (attrs.size() != 2)
- throw new
JasperException(Constants.getString("jsp.error.include.tag"));
+ throw new CompileException(start,
Constants.getString("jsp.error.include.tag"));
page = (String) attrs.get("page");
if (page == null)
- throw new
JasperException(Constants.getString("jsp.error.include.tag"));
+ throw new CompileException(start,
Constants.getString("jsp.error.include.tag"));
String flush = (String) attrs.get("flush");
if (flush == null)
- throw new
JasperException(Constants.getString("jsp.error.include.noflush"));
+ throw new CompileException(start,
Constants.getString("jsp.error.include.noflush"));
if (!flush.equals("true"))
- throw new
JasperException(Constants.getString("jsp.error.include.badflush"));
+ throw new CompileException(start,
Constants.getString("jsp.error.include.badflush"));
this.params = param;
isExpression = JspUtil.isExpression (page);
Index: JspParseEventListener.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParse
EventListener.java,v
retrieving revision 1.15
diff -u -r1.15 JspParseEventListener.java
--- JspParseEventListener.java 2000/04/08 22:16:24 1.15
+++ JspParseEventListener.java 2000/05/07 14:09:16
@@ -411,10 +411,10 @@
throws JasperException
{
if (listener.contentTypeDir == true)
- throw new
JasperException(Constants.getString("jsp.error.page.multiple.contenttypes"))
;
+ throw new CompileException(start,
Constants.getString("jsp.error.page.multiple.contenttypes"));
listener.contentTypeDir = true;
if (contentType == null)
- throw new
JasperException(Constants.getString("jsp.error.page.invalid.contenttype"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.invalid.contenttype"));
listener.servletContentType = contentType;
}
}
@@ -426,16 +426,16 @@
throws JasperException
{
if (listener.sessionDir == true)
- throw new JasperException
(Constants.getString("jsp.error.page.multiple.session"));
+ throw new CompileException (start,
Constants.getString("jsp.error.page.multiple.session"));
listener.sessionDir = true;
if (session == null)
- throw new JasperException
(Constants.getString("jsp.error.page.invalid.session"));
+ throw new CompileException (start,
Constants.getString("jsp.error.page.invalid.session"));
if (session.equalsIgnoreCase("true"))
listener.genSessionVariable = true;
else if (session.equalsIgnoreCase("false"))
listener.genSessionVariable = false;
else
- throw new JasperException("Invalid value for session");
+ throw new CompileException(start, "Invalid value for
session");
}
}
@@ -446,7 +446,7 @@
throws JasperException
{
if (listener.bufferDir == true)
- throw new
JasperException(Constants.getString("jsp.error.page.multiple.buffer"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.multiple.buffer"));
listener.bufferDir = true;
if (buffer != null) {
if (buffer.equalsIgnoreCase("none"))
@@ -462,14 +462,14 @@
num = buffer.substring(0, ind);
i = new Integer(num);
} catch (NumberFormatException n) {
- throw new JasperException(Constants.getString(
+ throw new CompileException(start,
Constants.getString(
"jsp.error.page.invalid.buffer"),
n);
}
listener.bufferSize = i.intValue()*1024;
}
}
else
- throw new
JasperException(Constants.getString("jsp.error.page.invalid.buffer"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.invalid.buffer"));
}
}
@@ -480,18 +480,18 @@
throws JasperException
{
if (listener.autoFlushDir == true)
- throw new
JasperException(Constants.getString("jsp.error.page.multiple.autoflush"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.multiple.autoflush"));
listener.autoFlushDir = true;
if (autoflush == null)
- throw new
JasperException(Constants.getString("jsp.error.page.invalid.autoflush"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.invalid.autoflush"));
if (autoflush.equalsIgnoreCase("true"))
listener.autoFlush = true;
else if (autoflush.equalsIgnoreCase("false"))
listener.autoFlush = false;
else
- throw new
JasperException(Constants.getString("jsp.error.page.invalid.autoflush"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.invalid.autoflush"));
}
}
@@ -502,18 +502,18 @@
throws JasperException
{
if (listener.threadsafeDir == true)
- throw new
JasperException(Constants.getString("jsp.error.page.multiple.threadsafe"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.multiple.threadsafe"));
listener.threadsafeDir = true;
if (threadsafe == null)
- throw new JasperException
(Constants.getString("jsp.error.page.invalid.threadsafe"));
+ throw new CompileException (start,
Constants.getString("jsp.error.page.invalid.threadsafe"));
if (threadsafe.equalsIgnoreCase("true"))
listener.singleThreaded = false;
else if (threadsafe.equalsIgnoreCase("false"))
listener.singleThreaded = true;
else
- throw new JasperException
(Constants.getString("jsp.error.page.invalid.threadsafe"));
+ throw new CompileException (start,
Constants.getString("jsp.error.page.invalid.threadsafe"));
}
}
@@ -524,11 +524,11 @@
throws JasperException
{
if (listener.infoDir == true)
- throw new JasperException
(Constants.getString("jsp.error.page.multiple.info"));
+ throw new CompileException (start,
Constants.getString("jsp.error.page.multiple.info"));
listener.infoDir = true;
if (info == null)
- throw new
JasperException(Constants.getString("jsp.error.page.invalid.info"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.invalid.info"));
GeneratorWrapper gen = listener. new GeneratorWrapper(new
InfoGenerator(info),
start,
stop);
@@ -543,18 +543,18 @@
throws JasperException
{
if (listener.iserrorpageDir == true)
- throw new JasperException
(Constants.getString("jsp.error.page.multiple.iserrorpage"));
+ throw new CompileException (start,
Constants.getString("jsp.error.page.multiple.iserrorpage"));
listener.iserrorpageDir = true;
if (iserrorpage == null)
- throw new
JasperException(Constants.getString("jsp.error.page.invalid.iserrorpage"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.invalid.iserrorpage"));
if (iserrorpage.equalsIgnoreCase("true"))
listener.ctxt.setErrorPage(true);
else if (iserrorpage.equalsIgnoreCase("false"))
listener.ctxt.setErrorPage(false);
else
- throw new
JasperException(Constants.getString("jsp.error.page.invalid.iserrorpage"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.invalid.iserrorpage"));
}
}
@@ -565,7 +565,7 @@
throws JasperException
{
if (listener.errorpageDir == true)
- throw new
JasperException(Constants.getString("jsp.error.page.multiple.errorpage"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.multiple.errorpage"));
listener.errorpageDir = true;
if (errorpage != null)
@@ -580,12 +580,12 @@
throws JasperException
{
if (listener.languageDir == true)
- throw new
JasperException(Constants.getString("jsp.error.page.multiple.language"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.multiple.language"));
listener.languageDir = true;
if (language != null)
if (!language.equalsIgnoreCase("java"))
- throw new
JasperException(Constants.getString("jsp.error.page.nomapping.language")+lan
guage);
+ throw new CompileException(start,
Constants.getString("jsp.error.page.nomapping.language")+language);
}
}
@@ -610,7 +610,7 @@
throws JasperException
{
if (listener.extendsDir == true)
- throw new
JasperException(Constants.getString("jsp.error.page.multiple.extends"));
+ throw new CompileException(start,
Constants.getString("jsp.error.page.multiple.extends"));
listener.extendsDir = true;
if (extendsClzz != null) {
@@ -655,7 +655,7 @@
// Do some validations...
if (bufferSize == 0 && autoFlush == false)
- throw new JasperException(Constants.getString(
+ throw new CompileException(start, Constants.getString(
"jsp.error.page.bad_b_and_a_combo"));
if (directive.equals("taglib")) {
@@ -669,7 +669,7 @@
} catch (Exception ex) {
ex.printStackTrace();
Object[] args = new Object[] { uri, ex.getMessage() };
- throw new
JasperException(Constants.getString("jsp.error.badtaglib",
+ throw new CompileException(start,
Constants.getString("jsp.error.badtaglib",
args));
}
}
@@ -679,13 +679,13 @@
String encoding = (String) attrs.get("encoding");
if (file == null)
- throw new
JasperException(Constants.getString("jsp.error.include.missing.file"));
+ throw new CompileException(start,
Constants.getString("jsp.error.include.missing.file"));
// jsp.error.include.bad.file needs taking care of here??
try {
reader.pushFile(file, encoding);
} catch (FileNotFoundException fnfe) {
- throw new
JasperException(Constants.getString("jsp.error.include.bad.file"));
+ throw new CompileException(start,
Constants.getString("jsp.error.include.bad.file"));
}
}
}
@@ -812,7 +812,7 @@
new Object[] { attrs },
Logger.DEBUG);
- Generator gen = new GeneratorWrapper (new PluginGenerator (attrs,
+ Generator gen = new GeneratorWrapper (new PluginGenerator (start,
attrs,
param, fallback), start,
stop);
addGenerator (gen);
}
@@ -821,7 +821,7 @@
throws JasperException
{
Generator gen
- = new GeneratorWrapper(new ForwardGenerator(attrs, param),
+ = new GeneratorWrapper(new ForwardGenerator(start, attrs,
param),
start, stop);
addGenerator(gen);
@@ -831,7 +831,7 @@
throws JasperException
{
Generator gen
- = new GeneratorWrapper(new IncludeGenerator(attrs, param),
+ = new GeneratorWrapper(new IncludeGenerator(start, attrs,
param),
start, stop);
addGenerator(gen);
@@ -862,7 +862,7 @@
throws JasperException
{
Generator gen
- = new GeneratorWrapper(new TagBeginGenerator(prefix,
shortTagName, attrs,
+ = new GeneratorWrapper(new TagBeginGenerator(start, prefix,
shortTagName, attrs,
tli, ti),
start, stop);
Index: JspUtil.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.
java,v
retrieving revision 1.11
diff -u -r1.11 JspUtil.java
--- JspUtil.java 2000/04/05 18:49:27 1.11
+++ JspUtil.java 2000/05/07 14:09:16
@@ -168,7 +168,7 @@
}
public static void checkAttributes (String typeOfTag, Hashtable attrs,
- ValidAttribute[] validAttributes)
+ ValidAttribute[] validAttributes,
Mark start)
throws JasperException
{
boolean valid = true;
@@ -199,7 +199,7 @@
* If mandatory attribute is missing then the exception is thrown.
*/
if (!valid)
- throw new JasperException(Constants.getString(
+ throw new ParseException(start, Constants.getString(
"jsp.error.mandatory.attribute",
new Object[] { typeOfTag,
missingAttribute}));
@@ -226,7 +226,7 @@
}
}
if (!valid)
- throw new JasperException(Constants.getString(
+ throw new ParseException(start, Constants.getString(
"jsp.error.invalid.attribute",
new Object[] { typeOfTag, attribute }));
}
Index: Parser.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.j
ava,v
retrieving revision 1.19
diff -u -r1.19 Parser.java
--- Parser.java 2000/04/07 22:27:52 1.19
+++ Parser.java 2000/05/07 14:09:17
@@ -192,13 +192,13 @@
Hashtable attrs = reader.parseTagAttributes();
if (match.equals ("page"))
JspUtil.checkAttributes ("Page directive", attrs,
- pageDvalidAttrs);
+ pageDvalidAttrs, start);
else if (match.equals("include"))
JspUtil.checkAttributes ("Include directive", attrs,
- includeDvalidAttrs);
+ includeDvalidAttrs, start);
else if (match.equals("taglib"))
JspUtil.checkAttributes ("Taglib directive", attrs,
- tagDvalidAttrs);
+ tagDvalidAttrs, start);
// Match close.
reader.skipSpaces();
@@ -247,7 +247,7 @@
Mark start = reader.mark();
reader.advance(OPEN_INCLUDE.length());
Hashtable attrs = reader.parseTagAttributes();
- JspUtil.checkAttributes ("Include", attrs, validAttributes);
+ JspUtil.checkAttributes ("Include", attrs, validAttributes,
start);
reader.skipSpaces();
if (!reader.matches(CLOSE_INCLUDE_NO_BODY)) {
@@ -330,7 +330,7 @@
reader.advance(OPEN_FORWARD.length());
Hashtable attrs = reader.parseTagAttributes();
Hashtable param = new Hashtable();
- JspUtil.checkAttributes ("Forward", attrs, validAttributes);
+ JspUtil.checkAttributes ("Forward", attrs, validAttributes,
start);
reader.skipSpaces();
if (!reader.matches(CLOSE_FORWARD_NO_BODY)) {
if (!reader.matches(CLOSE_FORWARD_BODY))
@@ -460,7 +460,7 @@
reader.advance(end_open.length());
reader.skipSpaces();
- JspUtil.checkAttributes("Declaration", attrs,
validAttributes);
+ JspUtil.checkAttributes("Declaration", attrs,
validAttributes, reader.mark());
}
Mark start = reader.mark();
@@ -513,7 +513,7 @@
reader.advance(end_open.length());
reader.skipSpaces();
- JspUtil.checkAttributes("Expression", attrs,
validAttributes);
+ JspUtil.checkAttributes("Expression", attrs,
validAttributes, reader.mark());
}
Mark start = reader.mark();
@@ -565,7 +565,7 @@
reader.advance(end_open.length());
reader.skipSpaces();
- JspUtil.checkAttributes("Scriptlet", attrs,
validAttributes);
+ JspUtil.checkAttributes("Scriptlet", attrs,
validAttributes, reader.mark());
}
Mark start = reader.mark();
@@ -609,7 +609,7 @@
Mark start = reader.mark();
reader.advance(OPEN_BEAN.length());
Hashtable attrs = reader.parseTagAttributesBean();
- JspUtil.checkAttributes ("useBean", attrs, validAttributes);
+ JspUtil.checkAttributes ("useBean", attrs, validAttributes,
start);
reader.skipSpaces();
if (!reader.matches(CLOSE_BEAN)) {
if (!reader.matches(CLOSE_BEAN_3))
@@ -674,7 +674,7 @@
Mark start = reader.mark();
reader.advance(OPEN_GETPROPERTY.length());
Hashtable attrs = reader.parseTagAttributes ();
- JspUtil.checkAttributes ("getProperty", attrs,
validAttributes);
+ JspUtil.checkAttributes ("getProperty", attrs,
validAttributes, start);
reader.skipSpaces();
if (!reader.matches(CLOSE_GETPROPERTY))
throw new ParseException(reader.mark(),
@@ -717,7 +717,7 @@
Mark start = reader.mark();
reader.advance(OPEN_SETPROPERTY.length());
Hashtable attrs = reader.parseTagAttributes ();
- JspUtil.checkAttributes ("setProperty", attrs,
validAttributes);
+ JspUtil.checkAttributes ("setProperty", attrs,
validAttributes, start);
reader.skipSpaces();
if (!reader.matches(CLOSE_SETPROPERTY))
throw new ParseException(reader.mark(),
@@ -904,7 +904,7 @@
Hashtable param = null;
String fallback = null;
- JspUtil.checkAttributes ("plugin", attrs, validAttributes);
+ JspUtil.checkAttributes ("plugin", attrs, validAttributes,
start);
if (reader.matches (OPEN_PARAMS)) {
param = new Hashtable ();
boolean paramsClosed = false;
Index: PluginGenerator.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/PluginGe
nerator.java,v
retrieving revision 1.6
diff -u -r1.6 PluginGenerator.java
--- PluginGenerator.java 2000/04/05 12:16:26 1.6
+++ PluginGenerator.java 2000/05/07 14:09:17
@@ -82,12 +82,14 @@
String fallback;
String ieClassId;
+ Mark start;
- public PluginGenerator(Hashtable attrs, Hashtable param, String
fallback) {
+ public PluginGenerator(Mark start, Hashtable attrs, Hashtable param,
String fallback) {
this.attrs = attrs;
this.param = param;
this.fallback = fallback;
+ this.start = start;
}
public void init(JspCompilationContext ctxt) throws JasperException {
@@ -107,10 +109,10 @@
String iepluginurl = getAttribute ("iepluginurl");
if (type == null)
- throw new JasperException (Constants.getString (
+ throw new CompileException (start, Constants.getString (
"jsp.error.plugin.notype"));
if (code == null)
- throw new JasperException (Constants.getString (
+ throw new CompileException (start, Constants.getString (
"jsp.error.plugin.nocode"));
writer.popIndent ();
Index: SetPropertyGenerator.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/SetPrope
rtyGenerator.java,v
retrieving revision 1.4
diff -u -r1.4 SetPropertyGenerator.java
--- SetPropertyGenerator.java 1999/12/08 23:42:50 1.4
+++ SetPropertyGenerator.java 2000/05/07 14:09:17
@@ -79,11 +79,13 @@
{
Hashtable attrs;
BeanRepository beanInfo;
+ Mark start;
public SetPropertyGenerator (Mark start, Mark stop, Hashtable attrs,
BeanRepository beanInfo) {
this.attrs = attrs;
this.beanInfo = beanInfo;
+ this.start = start;
}
public void generate (ServletWriter writer, Class phase)
@@ -97,7 +99,7 @@
if (value != null) {
String m =
Constants.getString("jsp.error.setproperty.invalidSyantx");
- throw new JasperException(m);
+ throw new CompileException(start, m);
}
// Set all the properties using name-value pairs in the
request.
Index: TagBeginGenerator.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagBegin
Generator.java,v
retrieving revision 1.12
diff -u -r1.12 TagBeginGenerator.java
--- TagBeginGenerator.java 2000/04/06 21:05:22 1.12
+++ TagBeginGenerator.java 2000/05/07 14:09:18
@@ -91,9 +91,10 @@
String baseVarName, thVarName;
TagCache tc;
TagData tagData;
+ Mark start;
- public TagBeginGenerator(String prefix, String shortTagName, Hashtable
attrs,
+ public TagBeginGenerator(Mark start, String prefix, String
shortTagName, Hashtable attrs,
TagLibraryInfoImpl tli, TagInfo ti)
throws JasperException
{
@@ -105,6 +106,7 @@
this.attributes = ti.getAttributes();
this.baseVarName = getTagVarName(prefix, shortTagName);
this.thVarName = "_jspx_th_"+baseVarName;
+ this.start = start;
}
public void init(JspCompilationContext ctxt) throws JasperException {
@@ -118,7 +120,7 @@
try {
clz = cl.loadClass(ti.getTagClassName());
} catch (Exception ex) {
- throw new
JasperException(Constants.getString("jsp.error.unable.loadclass",
+ throw new CompileException(start,
Constants.getString("jsp.error.unable.loadclass",
new Object[]
{ ti.getTagClassName(),
ex.getMessage()
}
@@ -137,7 +139,7 @@
// First make sure all required attributes are indeed present.
for(int i = 0; i < attributes.length; i++)
if (attributes[i].isRequired() &&
attribs.get(attributes[i].getName()) == null)
- throw new
JasperException(Constants.getString("jsp.error.missing_attribute",
+ throw new CompileException(start,
Constants.getString("jsp.error.missing_attribute",
new Object[]
{
attributes[i].getName(),
shortTagName
@@ -157,7 +159,7 @@
}
if (!found)
- throw new
JasperException(Constants.getString("jsp.error.bad_attribute",
+ throw new CompileException(start,
Constants.getString("jsp.error.bad_attribute",
new Object[]
{
attr
}
@@ -166,7 +168,7 @@
tagData = new TagData(attribs);
if (!ti.isValid(tagData))
- throw new
JasperException(Constants.getString("jsp.error.invalid_attributes"));
+ throw new CompileException(start,
Constants.getString("jsp.error.invalid_attributes"));
}
private final void generateSetters(ServletWriter writer, String parent)
@@ -192,8 +194,8 @@
Method m = tc.getSetterMethod(attrName);
if (m == null)
- throw new JasperException
- (Constants.getString
+ throw new CompileException
+ (start, Constants.getString
("jsp.error.unable.to_find_method",
new Object[] { attrName }));