You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sh...@locus.apache.org on 2000/03/04 07:29:11 UTC
cvs commit: jakarta-tomcat/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java
shemnon 00/03/03 22:29:11
Modified: src/share/org/apache/jasper JspC.java
CommandLineContext.java
src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java
Log:
Fixing command line invocatin bugs that create NullPointer, i
ArrayOutOfBounds, and other such exceitons.
initially reported by Kevin Jones <ki...@develop.com>
Revision Changes Path
1.6 +15 -6 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JspC.java 2000/02/23 18:59:31 1.5
+++ JspC.java 2000/03/04 06:29:10 1.6
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v 1.5 2000/02/23 18:59:31 rubys Exp $
- * $Revision: 1.5 $
- * $Date: 2000/02/23 18:59:31 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v 1.6 2000/03/04 06:29:10 shemnon Exp $
+ * $Revision: 1.6 $
+ * $Date: 2000/03/04 06:29:10 $
*
* ====================================================================
*
@@ -241,7 +241,7 @@
} else if (tok.equals(SWITCH_OUTPUT_DIR)) {
tok = nextArg();
if (tok != null) {
- scratchDir = new File(tok);
+ scratchDir = new File(new File(tok).getAbsolutePath());
dirset = true;
} else {
// either an in-java call with an explicit null
@@ -253,7 +253,7 @@
} else if (tok.equals(SWITCH_OUTPUT_SIMPLE_DIR)) {
tok = nextArg();
if (tok != null) {
- scratchDir = new File(tok);
+ scratchDir = new File(new File(tok).getAbsolutePath());
} else {
// either an in-java call with an explicit null
// or a "-d --" sequence should cause this,
@@ -377,7 +377,7 @@
if (temp == null) {
temp = "";
}
- scratchDir = new File(temp);
+ scratchDir = new File(new File(temp).getAbsolutePath());
}
File f = new File(args[argPos]);
@@ -385,6 +385,10 @@
// do web-app conversion
} else if (uriRoot == null) {
// set up the uri root if none is explicitly set
+ String tUriBase = uriBase;
+ if (tUriBase == null) {
+ tUriBase = "/";
+ }
try {
if (f.exists()) {
f = new File(f.getCanonicalPath());
@@ -392,12 +396,17 @@
File g = new File(f, "WEB-INF");
if (g.exists() && g.isDirectory()) {
uriRoot = f.getCanonicalPath();
+ uriBase = tUriBase;
Constants.message("jspc.implicit.uriRoot",
new Object[] { uriRoot },
Logger.INFORMATION);
break;
}
+ if (f.exists() && f.isDirectory()) {
+ tUriBase = "/" + f.getName() + "/" + tUriBase;
+ };
f = new File(f.getParent());
+
// If there is no acceptible candidate, uriRoot will
// remain null to indicate to the CompilerContext to
// use the current working/user dir.
1.4 +6 -6 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CommandLineContext.java 2000/02/27 02:01:23 1.3
+++ CommandLineContext.java 2000/03/04 06:29:10 1.4
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java,v 1.3 2000/02/27 02:01:23 rubys Exp $
- * $Revision: 1.3 $
- * $Date: 2000/02/27 02:01:23 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/CommandLineContext.java,v 1.4 2000/03/04 06:29:10 shemnon Exp $
+ * $Revision: 1.4 $
+ * $Date: 2000/03/04 06:29:10 $
*
* ====================================================================
*
@@ -325,7 +325,7 @@
* uses current file as the base.
*/
public String resolveRelativeUri(String uri) {
- if (uri.charAt(0) == '/') {
+ if (uri.startsWith("/")) {
return uri;
} else {
return uriBase + uri;
@@ -367,8 +367,8 @@
*/
public String getRealPath(String path) {
path = resolveRelativeUri(path);
- if (path.charAt(0) == '/') {
- path.substring(1);
+ if (path.startsWith("/")) {
+ path = path.substring(1);
};
File f = new File(uriRoot, path.replace('/', File.separatorChar));
return f.getAbsolutePath();
1.13 +10 -6 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TagLibraryInfoImpl.java 2000/02/29 15:43:42 1.12
+++ TagLibraryInfoImpl.java 2000/03/04 06:29:11 1.13
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v 1.12 2000/02/29 15:43:42 rubys Exp $
- * $Revision: 1.12 $
- * $Date: 2000/02/29 15:43:42 $
+ * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v 1.13 2000/03/04 06:29:11 shemnon Exp $
+ * $Revision: 1.13 $
+ * $Date: 2000/03/04 06:29:11 $
*
* The Apache Software License, Version 1.1
*
@@ -246,9 +246,13 @@
// First copy this file into our work directory!
{
File jspFile = new File(ctxt.getJspFile());
- String jarFileName = ctxt.getOutputDir()+File.separatorChar+
- jspFile.getParent().toString();
- File jspDir = new File(jarFileName);
+ String parent = jspFile.getParent();
+ String jarFileName = ctxt.getOutputDir();
+ if (parent != null) {
+ jarFileName = jarFileName + File.separatorChar +
+ parent;
+ }
+ File jspDir = new File(jarFileName);
jspDir.mkdirs();
if (relativeURL)