Browse Source

this patch does not fix the failing of jspc test, it fixes two other bugs in bugzilla -NPE on inclusion of non jsp file, and webapp attr broken.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273214 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 23 years ago
parent
commit
94182a1dfa
1 changed files with 34 additions and 19 deletions
  1. +34
    -19
      src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java

+ 34
- 19
src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java View File

@@ -228,7 +228,12 @@ public class JspC extends MatchingTask {
public void setIeplugin(String iepluginid_) { public void setIeplugin(String iepluginid_) {
iepluginid = iepluginid_; iepluginid = iepluginid_;
} }
/* ------------------------------------------------------------ */

/**
* If true, generate separate write() calls for each HTML line
* in the JSP.
* @return mapping status
*/
public boolean isMapped() { public boolean isMapped() {
return mapped; return mapped;
} }
@@ -270,7 +275,6 @@ public class JspC extends MatchingTask {
} }




/* ------------------------------------------------------------ */
/** /**
* Set the classpath to be used for this compilation. * Set the classpath to be used for this compilation.
*/ */
@@ -302,7 +306,6 @@ public class JspC extends MatchingTask {
return classpath; return classpath;
} }


/* ------------------------------------------------------------ */
/** /**
* Set the classpath to be used to find this compiler adapter * Set the classpath to be used to find this compiler adapter
*/ */
@@ -340,6 +343,10 @@ public class JspC extends MatchingTask {
this.webxml = webxml; this.webxml = webxml;
} }


/**
* Filename for web.xml.
* @return
*/
public File getWebxml() { public File getWebxml() {
return this.webxml; return this.webxml;
} }
@@ -396,17 +403,6 @@ public class JspC extends MatchingTask {
*/ */
public void execute() public void execute()
throws BuildException { throws BuildException {
// first off, make sure that we've got a srcdir
if (src == null) {
throw new BuildException("srcdir attribute must be set!",
getLocation());
}
String [] list = src.list();
if (list.length == 0) {
throw new BuildException("srcdir attribute must be set!",
getLocation());
}

if (destDir != null && !destDir.isDirectory()) { if (destDir != null && !destDir.isDirectory()) {
throw new throw new
BuildException("destination directory \"" + destDir + BuildException("destination directory \"" + destDir +
@@ -421,6 +417,24 @@ public class JspC extends MatchingTask {
JspCompilerAdapterFactory.getCompiler(compilerName, this, JspCompilerAdapterFactory.getCompiler(compilerName, this,
new AntClassLoader(getProject(), compilerClasspath)); new AntClassLoader(getProject(), compilerClasspath));


//if we are a webapp, hand off to the compiler, which had better handle it
if(webApp!=null) {
doCompilation(compiler);
return;
}
// make sure that we've got a srcdir
if (src == null) {
throw new BuildException("srcdir attribute must be set!",
location);
}
String [] list = src.list();
if (list.length == 0) {
throw new BuildException("srcdir attribute must be set!",
location);
}


// if the compiler does its own dependency stuff, we just call it right now // if the compiler does its own dependency stuff, we just call it right now
if (compiler.implementsOwnDependencyChecking()) { if (compiler.implementsOwnDependencyChecking()) {
doCompilation(compiler); doCompilation(compiler);
@@ -501,7 +515,6 @@ public class JspC extends MatchingTask {
} }
} }


/* ------------------------------------------------------------ */
/** /**
* Clear the list of files to be compiled and copied.. * Clear the list of files to be compiled and copied..
*/ */
@@ -509,7 +522,6 @@ public class JspC extends MatchingTask {
compileList.removeAllElements(); compileList.removeAllElements();
} }


/* ------------------------------------------------------------ */
/** /**
* Scans the directory looking for source files to be compiled. * Scans the directory looking for source files to be compiled.
* The results are returned in the class variable compileList * The results are returned in the class variable compileList
@@ -522,6 +534,9 @@ public class JspC extends MatchingTask {
String filename = files[i]; String filename = files[i];
File srcFile = new File(srcDir, filename); File srcFile = new File(srcDir, filename);
File javaFile = mapToJavaFile(mangler, srcFile, srcDir, dest); File javaFile = mapToJavaFile(mangler, srcFile, srcDir, dest);
if(javaFile==null) {
continue;
}


if (srcFile.lastModified() > now) { if (srcFile.lastModified() > now) {
log("Warning: file modified in the future: " + filename, log("Warning: file modified in the future: " + filename,
@@ -628,9 +643,9 @@ public class JspC extends MatchingTask {
return directory; return directory;
} }


/**
* set directory; alternate syntax
*/
/**
* set directory; alternate syntax
*/
public void setBaseDir(File directory) { public void setBaseDir(File directory) {
this.directory = directory; this.directory = directory;
} }


Loading…
Cancel
Save