costin 01/01/07 11:24:30
Modified: src/share/org/apache/jasper CommandLineContext.java
EmbededServletOptions.java JspC.java
JspEngineContext.java Options.java
src/share/org/apache/jasper/compiler Compiler.java
IncludeGenerator.java JspCompiler.java
JspParseEventListener.java JspReader.java
JspUtil.java Parser.java PluginGenerator.java
TagBeginGenerator.java TagGeneratorBase.java
TagLibraryInfoImpl.java
src/share/org/apache/jasper/resources messages.properties
messages_es.properties
src/share/org/apache/jasper/runtime JspRuntimeLibrary.java
PageContextImpl.java
src/share/org/apache/jasper/servlet JspServlet.java
Added: src/share/org/apache/jasper/resources messages_fr.properties
Log:
Merged the jasper changes from the release branch (3.2.1+).
This is an automated merge ( cvs update -j ), with just a bit of manual conflict
resolutions. From what I can tell it worked pretty well - and probably this is the
best way to go to keep jasper in sync.
For tomcat we still need to check the remaining commits that were not yet merged into
the main branch - this can't be automated because of the code reorganization and
refactoring.
For people making changes into 3.2.1 -> PLEASE TRY TO MERGE THE FIX INTO THE MAIN
BRANCH TOO !
Revision Changes Path
1.7 +0 -4
jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java
Index: CommandLineContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CommandLineContext.java 2000/07/11 00:15:04 1.6
+++ CommandLineContext.java 2001/01/07 19:24:12 1.7
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java,v 1.6
2000/07/11 00:15:04 shemnon Exp $
- * $Revision: 1.6 $
- * $Date: 2000/07/11 00:15:04 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
1.6 +11 -5
jakarta-tomcat/src/share/org/apache/jasper/EmbededServletOptions.java
Index: EmbededServletOptions.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/EmbededServletOptions.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- EmbededServletOptions.java 2000/09/29 07:00:00 1.5
+++ EmbededServletOptions.java 2001/01/07 19:24:12 1.6
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/EmbededServletOptions.java,v 1.5
2000/09/29 07:00:00 costin Exp $
- * $Revision: 1.5 $
- * $Date: 2000/09/29 07:00:00 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -135,6 +131,11 @@
*/
public String jspCompilerPath = null;
+ /**
+ * Java platform encoding to generate the JSP
+ * page servlet.
+ */
+ private String javaEncoding;
/**
* Are we keeping generated code around?
@@ -207,6 +208,10 @@
return jspCompilerPath;
}
+ public String getJavaEncoding() {
+ return javaEncoding;
+ }
+
/**
* Create an EmbededServletOptions object using data available from
* ServletConfig and ServletContext.
@@ -309,7 +314,8 @@
Logger.FATAL);
}
}
-
+
+ this.javaEncoding = config.getInitParameter("javaEncoding");
}
}
1.18 +4 -4 jakarta-tomcat/src/share/org/apache/jasper/JspC.java
Index: JspC.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- JspC.java 2000/09/29 07:00:01 1.17
+++ JspC.java 2001/01/07 19:24:13 1.18
@@ -1,8 +1,4 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v 1.17
2000/09/29 07:00:01 costin Exp $
- * $Revision: 1.17 $
- * $Date: 2000/09/29 07:00:01 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -197,6 +193,10 @@
public String getJspCompilerPath() {
// we don't compile, so this is meanlingless
return null;
+ }
+
+ public String getJavaEncoding() {
+ return "UTF-8";
}
public String getClassPath() {
1.11 +0 -3 jakarta-tomcat/src/share/org/apache/jasper/JspEngineContext.java
Index: JspEngineContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspEngineContext.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- JspEngineContext.java 2000/09/29 07:00:02 1.10
+++ JspEngineContext.java 2001/01/07 19:24:13 1.11
@@ -1,7 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspEngineContext.java,v 1.10
2000/09/29 07:00:02 costin Exp $
- * $Revision: 1.10 $
- * $Date: 2000/09/29 07:00:02 $
*
* ====================================================================
*
1.12 +6 -4 jakarta-tomcat/src/share/org/apache/jasper/Options.java
Index: Options.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/Options.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Options.java 2000/05/26 18:55:10 1.11
+++ Options.java 2001/01/07 19:24:13 1.12
@@ -1,8 +1,4 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/Options.java,v
1.11 2000/05/26 18:55:10 costin Exp $
- * $Revision: 1.11 $
- * $Date: 2000/05/26 18:55:10 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -125,4 +121,10 @@
* ProtectionDomain for this JSP Context when using a SecurityManager
*/
public Object getProtectionDomain();
+
+ /**
+ * Java platform encoding to generate the JSP
+ * page servlet.
+ */
+ public String getJavaEncoding();
}
1.21 +58 -12
jakarta-tomcat/src/share/org/apache/jasper/compiler/Compiler.java
Index: Compiler.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Compiler.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Compiler.java 2000/09/29 07:00:26 1.20
+++ Compiler.java 2001/01/07 19:24:16 1.21
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Compiler.java,v 1.20
2000/09/29 07:00:26 costin Exp $
- * $Revision: 1.20 $
- * $Date: 2000/09/29 07:00:26 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -66,6 +62,7 @@
import java.io.PrintWriter;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
import org.apache.jasper.JspCompilationContext;
import org.apache.jasper.Constants;
@@ -143,7 +140,10 @@
// XXX - There are really three encodings of interest.
String jspEncoding = "8859_1"; // default per JSP spec
- String javaEncoding = "UTF8"; // perhaps debatable?
+
+ // We try UTF8 by default. If it fails, we use the java encoding
+ // specified for JspServlet init parameter "javaEncoding".
+ String javaEncoding = "UTF8";
// This seems to be a reasonable point to scan the JSP file
// for a 'contentType' directive. If it found then the set
@@ -166,11 +166,34 @@
jspEncoding
);
- ServletWriter writer =
- (new ServletWriter
- (new PrintWriter
- (new java.io.OutputStreamWriter(
- new FileOutputStream(javaFileName),javaEncoding))));
+ OutputStreamWriter osw;
+ try {
+ osw = new OutputStreamWriter(
+ new FileOutputStream(javaFileName),javaEncoding);
+ } catch (java.io.UnsupportedEncodingException ex) {
+ // Try to get the java encoding from the "javaEncoding"
+ // init parameter for JspServlet.
+ javaEncoding = ctxt.getOptions().getJavaEncoding();
+ if (javaEncoding != null) {
+ try {
+ osw = new OutputStreamWriter(
+ new FileOutputStream(javaFileName),javaEncoding);
+ } catch (java.io.UnsupportedEncodingException ex2) {
+ // no luck :-(
+ throw new JasperException(
+ Constants.getString("jsp.error.invalid.javaEncoding",
+ new Object[] {
+ "UTF8",
+ javaEncoding,
+ }));
+ }
+ } else {
+ throw new JasperException(
+ Constants.getString("jsp.error.needAlternateJavaEncoding",
+ new Object[] { "UTF8" }));
+ }
+ }
+ ServletWriter writer = new ServletWriter(new PrintWriter(osw));
ctxt.setReader(reader);
ctxt.setWriter(writer);
@@ -189,14 +212,19 @@
// System.getProperty("jsp.class.path", ".")
// business. If anyone badly needs this we can talk. -akv
+ // I'm adding tc_path_add because it solves a real problem
+ // and nobody has yet to come up with a better alternative.
+ // Note: this is in two places. Search for tc_path_add below.
+ // If you have one, please let me know. -Sam Ruby
+
String sep = System.getProperty("path.separator");
String[] argv = new String[]
{
"-encoding",
javaEncoding,
"-classpath",
- System.getProperty("java.class.path")+ sep + classpath
- + sep + ctxt.getOutputDir(),
+ System.getProperty("java.class.path")+ sep + classpath + sep +
+ System.getProperty("tc_path_add") + sep + ctxt.getOutputDir(),
"-d", ctxt.getOutputDir(),
javaFileName
};
@@ -225,9 +253,11 @@
/**
* Configure the compiler object
+ * See comment above: re tc_path_add
*/
javac.setEncoding(javaEncoding);
javac.setClasspath( System.getProperty("java.class.path")+ sep +
+ System.getProperty("tc_path_add") + sep +
classpath + sep + ctxt.getOutputDir());
javac.setOutputDir(ctxt.getOutputDir());
javac.setMsgOutput(out);
@@ -340,6 +370,22 @@
}
return null;
}
+
+ /**
+ * Remove generated files
+ */
+ public void removeGeneratedFiles()
+ {
+ try{
+ // XXX Should we delete the generated .java file too?
+ String classFileName = mangler.getClassFileName();
+ if(classFileName != null){
+ File classFile = new File(classFileName);
+ classFile.delete();
+ }
+ }catch(Exception e){
+ }
+ }
}
1.6 +0 -5
jakarta-tomcat/src/share/org/apache/jasper/compiler/IncludeGenerator.java
Index: IncludeGenerator.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/IncludeGenerator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- IncludeGenerator.java 2000/09/14 03:11:05 1.5
+++ IncludeGenerator.java 2001/01/07 19:24:17 1.6
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/IncludeGenerator.java,v
1.5 2000/09/14 03:11:05 larryi Exp $
- * $Revision: 1.5 $
- * $Date: 2000/09/14 03:11:05 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -138,7 +134,6 @@
writer.println("_jspx_qStr = _jspx_qStr + \"" + sep +
key + "=\" + \"" + value[0] + "\";");
} else {
- writer.println("String [] _tmpS = new String[" + value.length
+"];");
for (int i = 0; i < value.length; i++) {
if (!JspUtil.isExpression(value[i]))
writer.println("_jspx_qStr = _jspx_qStr + \"" + sep +
1.18 +10 -4
jakarta-tomcat/src/share/org/apache/jasper/compiler/JspCompiler.java
Index: JspCompiler.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspCompiler.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- JspCompiler.java 2000/09/29 07:00:27 1.17
+++ JspCompiler.java 2001/01/07 19:24:17 1.18
@@ -135,8 +135,6 @@
public final String getRealClassName() {
if( realClassName!=null ) return realClassName;
- // loghelper.log("JspCompiler: extract class name and version ",
- // null, Logger.DEBUG);
try {
realClassName = ClassName.getClassName( getClassFileName() );
} catch( JasperException ex) {
@@ -309,9 +307,17 @@
public boolean isOutDated() {
File jspReal = null;
- jspReal = new File(ctxt.getRealPath(jsp.getPath()));
+ String realPath = ctxt.getRealPath(jsp.getPath());
+ if (realPath == null)
+ return true;
- File classFile = new File(getClassFileName());
+ jspReal = new File(realPath);
+
+ if(!jspReal.exists()){
+ return true;
+ }
+
+ File classFile = new File(getClassFileName());
if (classFile.exists()) {
outDated = classFile.lastModified() < jspReal.lastModified();
} else {
1.21 +5 -10
jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java
Index: JspParseEventListener.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- JspParseEventListener.java 2000/09/29 07:00:27 1.20
+++ JspParseEventListener.java 2001/01/07 19:24:18 1.21
@@ -1,7 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
1.20 2000/09/29 07:00:27 costin Exp $
- * $Revision: 1.20 $
- * $Date: 2000/09/29 07:00:27 $
*
* ====================================================================
*
@@ -348,18 +345,18 @@
//writer.println("} catch (Throwable t) {");
writer.println("} catch (Exception ex) {");
writer.pushIndent();
- writer.println("if (out.getBufferSize() != 0)");
+ writer.println("if (out != null && out.getBufferSize() != 0)");
writer.pushIndent();
writer.println("out.clearBuffer();");
writer.popIndent();
- writer.println("pageContext.handlePageException(ex);");
+ writer.println("if (pageContext != null)
pageContext.handlePageException(ex);");
writer.popIndent();
writer.println("} finally {");
writer.pushIndent();
/* Do stuff here for finally actions... */
//writer.println("out.close();");
- writer.println("out.flush();");
- writer.println("_jspxFactory.releasePageContext(pageContext);");
+ writer.println("if (out != null) out.flush();");
+ writer.println("if (_jspxFactory != null)
_jspxFactory.releasePageContext(pageContext);");
writer.popIndent();
writer.println("}");
// Close the service method:
@@ -716,15 +713,13 @@
if (directive.equals("include")) {
String file = (String) attrs.get("file");
- String encoding = (String) attrs.get("encoding");
-
if (file == null)
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);
+ reader.pushFile(file);
} catch (FileNotFoundException fnfe) {
throw new CompileException(start,
Constants.getString("jsp.error.include.bad.file"));
1.22 +29 -5
jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java
Index: JspReader.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspReader.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- JspReader.java 2000/11/08 13:11:06 1.21
+++ JspReader.java 2001/01/07 19:24:18 1.22
@@ -94,7 +94,15 @@
private JspCompilationContext context;
Log loghelper = new Log("JASPER_LOG", "JspReader");
+ // LogHelper loghelper = new LogHelper("JASPER_LOG", "JspReader");
+ /*
+ * Default encoding used. The JspReader is created with the
+ * "top file" encoding. This is then the encoding used for the
+ * included files (same translation unit).
+ */
+ private String encoding = null;
+
public String getFile(int fileid) {
return (String) sourceFiles.elementAt(fileid);
}
@@ -132,6 +140,17 @@
* Push a new file onto the stack.
* The name of the file is resolved to a fully qualified filename.
* @param name The name of the file.
+ */
+ public void pushFile(String name)
+ throws ParseException, FileNotFoundException
+ {
+ pushFile(name, this.encoding);
+ }
+
+ /**
+ * Push a new file onto the stack.
+ * The name of the file is resolved to a fully qualified filename.
+ * @param name The name of the file.
* @param encoding The optional encoding for the file.
*/
public void pushFile(String name, String encoding)
@@ -160,7 +179,7 @@
{
// Default encoding if needed:
if (encoding == null) {
- encoding = "8859_1";
+ encoding = this.encoding;
// XXX - longer term, this should really be:
// System.getProperty("file.encoding", "8859_1");
// but this doesn't work right now, so we stick with ASCII
@@ -171,6 +190,9 @@
? file.getAbsolutePath()
: context.getRealPath(file.toString());
+ if (longName == null)
+ throw new FileNotFoundException(file.toString());
+
int fileid = registerSourceFile(longName);
if (fileid == -1)
@@ -246,16 +268,18 @@
(Constants.getString("jsp.error.file.not.registered",
new Object[] {fName}));
- boolean result = current.popStream();
- if (result)
- master = current.baseDir;
- return (result);
+ boolean r = current.popStream();
+ if (r)
+ master = current.baseDir;
+ return r;
}
protected JspReader(String file, JspCompilationContext ctx, String encoding)
throws ParseException, FileNotFoundException
{
this.context = ctx;
+ this.encoding = encoding;
+ if (this.encoding == null) this.encoding = "8859_1";
pushFile(file, encoding);
}
1.20 +0 -4 jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java
Index: JspUtil.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- JspUtil.java 2000/11/08 13:11:07 1.19
+++ JspUtil.java 2001/01/07 19:24:19 1.20
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspUtil.java,v 1.19
2000/11/08 13:11:07 larryi Exp $
- * $Revision: 1.19 $
- * $Date: 2000/11/08 13:11:07 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
1.27 +1 -1 jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/Parser.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Parser.java 2000/11/08 13:11:08 1.26
+++ Parser.java 2001/01/07 19:24:19 1.27
@@ -838,7 +838,7 @@
start,
Constants.getString("jsp.error.unterminated.user.tag",
new Object[]{JspUtil.escapeXml(tagEnd)}));
- }
+ }
listener.setTemplateInfo(parser.tmplStart,
parser.tmplStop);
listener.handleTagEnd(parser.tmplStop, reader.mark(),
prefix,
shortTagName, attrs, tli, ti);
1.9 +0 -4
jakarta-tomcat/src/share/org/apache/jasper/compiler/PluginGenerator.java
Index: PluginGenerator.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/PluginGenerator.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PluginGenerator.java 2000/07/25 01:11:38 1.8
+++ PluginGenerator.java 2001/01/07 19:24:20 1.9
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/PluginGenerator.java,v
1.8 2000/07/25 01:11:38 craigmcc Exp $
- * $Revision: 1.8 $
- * $Date: 2000/07/25 01:11:38 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
1.17 +5 -8
jakarta-tomcat/src/share/org/apache/jasper/compiler/TagBeginGenerator.java
Index: TagBeginGenerator.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagBeginGenerator.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- TagBeginGenerator.java 2000/07/11 22:31:58 1.16
+++ TagBeginGenerator.java 2001/01/07 19:24:20 1.17
@@ -193,6 +193,11 @@
if (attrValue != null) {
String attrName = attributes[i].getName();
Method m = tc.getSetterMethod(attrName);
+ if (m == null)
+ throw new CompileException
+ (start, Constants.getString
+ ("jsp.error.unable.to_find_method",
+ new Object[] { attrName }));
Class c[] = m.getParameterTypes();
// assert(c.length > 0)
@@ -203,14 +208,6 @@
attrValue = convertString(c[0], attrValue, writer,
attrName);
} else
attrValue = convertString(c[0], attrValue, writer, attrName);
-
-
- if (m == null)
- throw new CompileException
- (start, Constants.getString
- ("jsp.error.unable.to_find_method",
- new Object[] { attrName }));
-
writer.println(thVarName+"."+m.getName()+"("+attrValue+");");
}
}
1.5 +0 -4
jakarta-tomcat/src/share/org/apache/jasper/compiler/TagGeneratorBase.java
Index: TagGeneratorBase.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagGeneratorBase.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TagGeneratorBase.java 2000/07/03 09:11:17 1.4
+++ TagGeneratorBase.java 2001/01/07 19:24:21 1.5
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagGeneratorBase.java,v
1.4 2000/07/03 09:11:17 bergsten Exp $
- * $Revision: 1.4 $
- * $Date: 2000/07/03 09:11:17 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
1.30 +23 -25
jakarta-tomcat/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
Index: TagLibraryInfoImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- TagLibraryInfoImpl.java 2000/10/06 11:10:15 1.29
+++ TagLibraryInfoImpl.java 2001/01/07 19:24:21 1.30
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
1.29 2000/10/06 11:10:15 larryi Exp $
- * $Revision: 1.29 $
- * $Date: 2000/10/06 11:10:15 $
- *
* The Apache Software License, Version 1.1
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
@@ -228,12 +224,14 @@
if (in == null)
throw new
JasperException(Constants.getString("jsp.error.tld_not_found",
- new Object[] {TLD}));
+ new Object[] {uri}));
// Now parse the tld.
parseTLD(in);
}
// FIXME Take this stuff out when taglib changes are thoroughly tested.
+ // 2000.11.15 commented out the 'copy to work dir' section,
+ // which I believe is what this FIXME comment referred to. (pierred)
if (uri.endsWith("jar")) {
if (!isRelativeURI(uri)) {
@@ -248,6 +246,7 @@
this.jarEntries = new Hashtable();
this.ctxt = ctxt;
+ /* NOT COMPILED
// First copy this file into our work directory!
{
File jspFile = new File(ctxt.getJspFile());
@@ -278,8 +277,7 @@
ctxt.addJar(jarFileName);
}
-
-
+ */ // END NOT COMPILED
boolean tldFound = false;
ZipEntry entry;
while ((entry = zin.getNextEntry()) != null) {
@@ -362,23 +360,23 @@
if (tname.equals("tlibversion")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- this.tlibversion = t.getData();
+ this.tlibversion = t.getData().trim();
} else if (tname.equals("jspversion")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- this.jspversion = t.getData();
+ this.jspversion = t.getData().trim();
} else if (tname.equals("shortname")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- this.shortname = t.getData();
+ this.shortname = t.getData().trim();
} else if (tname.equals("uri")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- this.urn = t.getData();
+ this.urn = t.getData().trim();
} else if (tname.equals("info")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- this.info = t.getData();
+ this.info = t.getData().trim();
} else if (tname.equals("tag"))
tagVector.addElement(createTagInfo(e));
else
@@ -409,23 +407,23 @@
if (tname.equals("name")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- name = t.getData();
+ name = t.getData().trim();
} else if (tname.equals("tagclass")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- tagclass = t.getData();
+ tagclass = t.getData().trim();
} else if (tname.equals("teiclass")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- teiclass = t.getData();
+ teiclass = t.getData().trim();
} else if (tname.equals("bodycontent")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- bodycontent = t.getData();
+ bodycontent = t.getData().trim();
} else if (tname.equals("info")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- info = t.getData();
+ info = t.getData().trim();
} else if (tname.equals("attribute"))
attributeVector.addElement(createAttribute(e));
else
@@ -490,25 +488,25 @@
if (tname.equals("name")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- name = t.getData();
+ name = t.getData().trim();
} else if (tname.equals("required")) {
Text t = (Text) e.getFirstChild();
if (t != null) {
- required = Boolean.valueOf(t.getData()).booleanValue();
- if( t.getData().equalsIgnoreCase("yes") )
- required = true;
- }
+ required = Boolean.valueOf(t.getData().trim()).booleanValue();
+ if( t.getData().equalsIgnoreCase("yes") )
+ required = true;
+ }
} else if (tname.equals("rtexprvalue")) {
Text t = (Text) e.getFirstChild();
if (t != null) {
- rtexprvalue = Boolean.valueOf(t.getData()).booleanValue();
+ rtexprvalue =
Boolean.valueOf(t.getData().trim()).booleanValue();
if( t.getData().equalsIgnoreCase("yes") )
rtexprvalue = true;
- }
+ }
} else if (tname.equals("type")) {
Text t = (Text) e.getFirstChild();
if (t != null)
- type = t.getData();
+ type = t.getData().trim();
} else
Constants.message("jsp.warning.unknown.element.in.attribute",
new Object[] {
1.23 +5 -3
jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties
Index: messages.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/messages.properties,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- messages.properties 2000/11/08 13:11:14 1.22
+++ messages.properties 2001/01/07 19:24:24 1.23
@@ -1,4 +1,3 @@
-# $Id: messages.properties,v 1.22 2000/11/08 13:11:14 larryi Exp $
#
# Default localized string information
# Localized this the Default Locale as is en_US
@@ -123,7 +122,8 @@
jsp.error.parse.error.in.TLD=Parse Error in the tag library descriptor: {0}
jsp.error.unable.to.open.TLD=Unable to open the tag library descriptor: {0}
jsp.buffer.size.zero=Buffer size <= 0
-jsp.error.file.not.found=JSP file \"{0}\" not found
+jsp.error.file.not.found.TMI=JSP file \"{0}\" not found
+jsp.error.file.not.found=JSP file not found
jsp.message.copyinguri=Copying {0} into {1}
jsp.message.htmlcomment=\nStripping Comment: \t{0}
jsp.message.handling_directive=\nHandling Directive: {0}\t{1}
@@ -209,4 +209,6 @@
jspc.error.fileDoesNotExist=The file argument ''{0}'' does not exist
jspc.error.emptyWebApp=-webapp requires a trailing file argument
jsp.error.no.more.content=End of content reached while more parsing required:
unterminated tag or tag nesting error?
-jsp.error.unterminated.user.tag=Unterminated user-defined tag: ending tag {0} not
found or incorrectly nested
+jsp.error.unterminated.user.tag=Unterminated user-defined tag: ending tag {0} not
found or incorrectly nested
+jsp.error.invalid.javaEncoding=Invalid java encodings. Tried {0} and then {1}. Both
failed.
+jsp.error.needAlternateJavaEncoding=Default java encoding {0} is invalid on your
java platform. An alternate can be specified via the 'javaEncoding' parameter of
JspServlet.
1.8 +2 -2
jakarta-tomcat/src/share/org/apache/jasper/resources/messages_es.properties
Index: messages_es.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/resources/messages_es.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- messages_es.properties 2000/11/08 13:11:15 1.7
+++ messages_es.properties 2001/01/07 19:24:25 1.8
@@ -1,4 +1,3 @@
-# $Id: messages_es.properties,v 1.7 2000/11/08 13:11:15 larryi Exp $
#
# Default localized string information
# Localized para Locale es_ES
@@ -118,7 +117,8 @@
jsp.error.parse.error.in.TLD=Error de analisis en el descriptor de libreria de
tags: {0}
jsp.error.unable.to.open.TLD=No se puede abrir el descriptor de libreria de tags:
{0}
jsp.buffer.size.zero=Tamaņo de buffer <= 0
-jsp.error.file.not.found=Archivo JSP \"{0}\" no encontrado
+jsp.error.file.not.found.TMI=Archivo JSP \"{0}\" no encontrado
+jsp.error.file.not.found=Archivo JSP no encontrado
jsp.message.copyinguri=Copiando {0} en {1}
jsp.message.htmlcomment=\nQuitando comentario: \t{0}
jsp.message.handling_directive=\nResolviando directiva: {0}\t{1}
1.2 +209 -0
jakarta-tomcat/src/share/org/apache/jasper/resources/messages_fr.properties
1.8 +0 -4
jakarta-tomcat/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java
Index: JspRuntimeLibrary.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JspRuntimeLibrary.java 2000/11/21 00:47:15 1.7
+++ JspRuntimeLibrary.java 2001/01/07 19:24:27 1.8
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspRuntimeLibrary.java,v
1.7 2000/11/21 00:47:15 larryi Exp $
- * $Revision: 1.7 $
- * $Date: 2000/11/21 00:47:15 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
1.18 +5 -9
jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java
Index: PageContextImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- PageContextImpl.java 2000/11/21 03:09:55 1.17
+++ PageContextImpl.java 2001/01/07 19:24:27 1.18
@@ -1,8 +1,4 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
1.17 2000/11/21 03:09:55 larryi Exp $
- * $Revision: 1.17 $
- * $Date: 2000/11/21 03:09:55 $
- *
* ====================================================================
*
* The Apache Software License, Version 1.1
@@ -445,11 +441,11 @@
request.setAttribute("javax.servlet.jsp.jspException", e);
if (errorPageURL != null && !errorPageURL.equals("")) {
- try {
- forward(errorPageURL);
- } catch (IllegalStateException ise) {
- include(errorPageURL);
- }
+ try {
+ forward(errorPageURL);
+ } catch (IllegalStateException ise) {
+ include(errorPageURL);
+ }
} // Otherwise throw the exception wrapped inside a ServletException.
else {
// Set the exception as the root cause in the ServletException
1.6 +31 -8
jakarta-tomcat/src/share/org/apache/jasper/servlet/JspServlet.java
Index: JspServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/servlet/JspServlet.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JspServlet.java 2000/09/29 07:00:48 1.5
+++ JspServlet.java 2001/01/07 19:24:28 1.6
@@ -181,19 +181,38 @@
} catch (FileNotFoundException ex) {
try {
- response.sendError(HttpServletResponse.SC_NOT_FOUND,
- Constants.getString
- ("jsp.error.file.not.found",
- new Object[] {
- ex.getMessage()
- }));
+ if (insecure_TMI) {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND,
+ Constants.getString
+ ("jsp.error.file.not.found.TMI",
+ new Object[] {
+ ex.getMessage()
+ }));
+ } else {
+ response.sendError(HttpServletResponse.SC_NOT_FOUND,
+ Constants.getString
+ ("jsp.error.file.not.found",
+ new Object[] {
+ // Too Much Information --
ex.getMessage()
+ }));
+ }
} catch (IllegalStateException ise) {
+ // logs are presumed to be secure, thus the TMI info can be
logged
Constants.jasperLog.log(Constants.getString
- ("jsp.error.file.not.found",
+ ("jsp.error.file.not.found.TMI",
new Object[] {
ex.getMessage()
}), ex,
Logger.ERROR);
+ // rethrow FileNotFoundException so someone higher up can handle
+ if (insecure_TMI)
+ throw ex;
+ else
+ throw new FileNotFoundException(Constants.getString
+ ("jsp.error.file.not.found",
+ new Object[] {
+ // Too Much Information --
ex.getMessage()
+ }));
}
return;
}
@@ -215,6 +234,9 @@
protected ClassLoader parentClassLoader;
protected ServletEngine engine;
protected String serverInfo;
+
+ /** Set to true to provide Too Much Information on errors */
+ private final boolean insecure_TMI = false;
static boolean firstTime = true;
static boolean jdk12=false;
@@ -430,7 +452,7 @@
}
// Class jspClass = (Class) loadedJSPs.get(jspUri);
boolean firstTime = jsw.servletClass == null;
- JspCompilationContext ctxt = new JspEngineContext(loader, classpath,
+ JspCompilationContext ctxt = new JspEngineContext(loader, classpath,
context, jspUri,
isErrorPage, options,
req, res);
@@ -449,6 +471,7 @@
}
}
} catch (FileNotFoundException ex) {
+ compiler.removeGeneratedFiles();
throw ex;
} catch (JasperException ex) {
throw ex;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]