Yay - down to 180 errors!!!!!!!!!!!!!!!!!!!!! git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270169 13f79535-47bb-0310-9956-ffa450edef68master
@@ -1086,17 +1086,10 @@ public class AntClassLoader extends ClassLoader implements BuildListener | |||||
while( ( pathElementsIndex < pathComponents.size() ) && | while( ( pathElementsIndex < pathComponents.size() ) && | ||||
( url == null ) ) | ( url == null ) ) | ||||
{ | { | ||||
try | |||||
{ | |||||
File pathComponent | |||||
= (File)pathComponents.elementAt( pathElementsIndex ); | |||||
url = getResourceURL( pathComponent, this.resourceName ); | |||||
pathElementsIndex++; | |||||
} | |||||
catch( TaskException e ) | |||||
{ | |||||
// ignore path elements which are not valid relative to the project | |||||
} | |||||
File pathComponent | |||||
= (File)pathComponents.elementAt( pathElementsIndex ); | |||||
url = getResourceURL( pathComponent, this.resourceName ); | |||||
pathElementsIndex++; | |||||
} | } | ||||
this.nextResource = url; | this.nextResource = url; | ||||
} | } | ||||
@@ -103,6 +103,7 @@ public class Launcher | |||||
} | } | ||||
private static void addToolsJar( AntClassLoader antLoader ) | private static void addToolsJar( AntClassLoader antLoader ) | ||||
throws TaskException | |||||
{ | { | ||||
String javaHome = System.getProperty( "java.home" ); | String javaHome = System.getProperty( "java.home" ); | ||||
if( javaHome.endsWith( "jre" ) ) | if( javaHome.endsWith( "jre" ) ) | ||||
@@ -38,11 +38,6 @@ public class Chmod extends ExecuteOn | |||||
super.setSkipEmptyFilesets( true ); | super.setSkipEmptyFilesets( true ); | ||||
} | } | ||||
public void setCommand( String e ) | |||||
{ | |||||
throw new TaskException( taskType + " doesn\'t support the command attribute" ); | |||||
} | |||||
/** | /** | ||||
* Sets whether default exclusions should be used or not. | * Sets whether default exclusions should be used or not. | ||||
* | * | ||||
@@ -50,12 +45,14 @@ public class Chmod extends ExecuteOn | |||||
* should be used, "false"|"off"|"no" when they shouldn't be used. | * should be used, "false"|"off"|"no" when they shouldn't be used. | ||||
*/ | */ | ||||
public void setDefaultexcludes( boolean useDefaultExcludes ) | public void setDefaultexcludes( boolean useDefaultExcludes ) | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
defaultSet.setDefaultexcludes( useDefaultExcludes ); | defaultSet.setDefaultexcludes( useDefaultExcludes ); | ||||
} | } | ||||
public void setDir( File src ) | public void setDir( File src ) | ||||
throws TaskException | |||||
{ | { | ||||
defaultSet.setDir( src ); | defaultSet.setDir( src ); | ||||
} | } | ||||
@@ -67,17 +64,20 @@ public class Chmod extends ExecuteOn | |||||
* @param excludes the string containing the exclude patterns | * @param excludes the string containing the exclude patterns | ||||
*/ | */ | ||||
public void setExcludes( String excludes ) | public void setExcludes( String excludes ) | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
defaultSet.setExcludes( excludes ); | defaultSet.setExcludes( excludes ); | ||||
} | } | ||||
public void setExecutable( String e ) | public void setExecutable( String e ) | ||||
throws TaskException | |||||
{ | { | ||||
throw new TaskException( taskType + " doesn\'t support the executable attribute" ); | throw new TaskException( taskType + " doesn\'t support the executable attribute" ); | ||||
} | } | ||||
public void setFile( File src ) | public void setFile( File src ) | ||||
throws TaskException | |||||
{ | { | ||||
FileSet fs = new FileSet(); | FileSet fs = new FileSet(); | ||||
fs.setDir( new File( src.getParent() ) ); | fs.setDir( new File( src.getParent() ) ); | ||||
@@ -92,6 +92,7 @@ public class Chmod extends ExecuteOn | |||||
* @param includes the string containing the include patterns | * @param includes the string containing the include patterns | ||||
*/ | */ | ||||
public void setIncludes( String includes ) | public void setIncludes( String includes ) | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
defaultSet.setIncludes( includes ); | defaultSet.setIncludes( includes ); | ||||
@@ -104,6 +105,7 @@ public class Chmod extends ExecuteOn | |||||
} | } | ||||
public void setSkipEmptyFilesets( boolean skip ) | public void setSkipEmptyFilesets( boolean skip ) | ||||
throws TaskException | |||||
{ | { | ||||
throw new TaskException( taskType + " doesn\'t support the skipemptyfileset attribute" ); | throw new TaskException( taskType + " doesn\'t support the skipemptyfileset attribute" ); | ||||
} | } | ||||
@@ -114,6 +116,7 @@ public class Chmod extends ExecuteOn | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet.NameEntry createExclude() | public PatternSet.NameEntry createExclude() | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
return defaultSet.createExclude(); | return defaultSet.createExclude(); | ||||
@@ -125,6 +128,7 @@ public class Chmod extends ExecuteOn | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet.NameEntry createInclude() | public PatternSet.NameEntry createInclude() | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
return defaultSet.createInclude(); | return defaultSet.createInclude(); | ||||
@@ -136,6 +140,7 @@ public class Chmod extends ExecuteOn | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet createPatternSet() | public PatternSet createPatternSet() | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
return defaultSet.createPatternSet(); | return defaultSet.createPatternSet(); | ||||
@@ -176,6 +181,7 @@ public class Chmod extends ExecuteOn | |||||
} | } | ||||
protected void checkConfiguration() | protected void checkConfiguration() | ||||
throws TaskException | |||||
{ | { | ||||
if( !havePerm ) | if( !havePerm ) | ||||
{ | { | ||||
@@ -330,6 +330,7 @@ public class Copy extends Task | |||||
* good method for subclasses to override. | * good method for subclasses to override. | ||||
*/ | */ | ||||
protected void doFileOperations() | protected void doFileOperations() | ||||
throws TaskException | |||||
{ | { | ||||
if( fileCopyMap.size() > 0 ) | if( fileCopyMap.size() > 0 ) | ||||
{ | { | ||||
@@ -223,6 +223,7 @@ public class Delete extends MatchingTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet createPatternSet() | public PatternSet createPatternSet() | ||||
throws TaskException | |||||
{ | { | ||||
usedMatchingTask = true; | usedMatchingTask = true; | ||||
return super.createPatternSet(); | return super.createPatternSet(); | ||||
@@ -355,6 +356,7 @@ public class Delete extends MatchingTask | |||||
//************************************************************************ | //************************************************************************ | ||||
protected void removeDir( File d ) | protected void removeDir( File d ) | ||||
throws TaskException | |||||
{ | { | ||||
String[] list = d.list(); | String[] list = d.list(); | ||||
if( list == null ) | if( list == null ) | ||||
@@ -402,6 +404,7 @@ public class Delete extends MatchingTask | |||||
* @param dirs array of directories to delete; can of zero length | * @param dirs array of directories to delete; can of zero length | ||||
*/ | */ | ||||
protected void removeFiles( File d, String[] files, String[] dirs ) | protected void removeFiles( File d, String[] files, String[] dirs ) | ||||
throws TaskException | |||||
{ | { | ||||
if( files.length > 0 ) | if( files.length > 0 ) | ||||
{ | { | ||||
@@ -79,7 +79,7 @@ public class Ear extends Jar | |||||
} | } | ||||
protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// If the file being added is WEB-INF/web.xml, we warn if it's not the | // If the file being added is WEB-INF/web.xml, we warn if it's not the | ||||
// one specified in the "webxml" attribute - or if it's being added twice, | // one specified in the "webxml" attribute - or if it's being added twice, | ||||
@@ -59,6 +59,7 @@ public class ExecTask extends Task | |||||
* @param d The new Dir value | * @param d The new Dir value | ||||
*/ | */ | ||||
public void setDir( File d ) | public void setDir( File d ) | ||||
throws TaskException | |||||
{ | { | ||||
this.dir = d; | this.dir = d; | ||||
} | } | ||||
@@ -69,6 +70,7 @@ public class ExecTask extends Task | |||||
* @param value The new Executable value | * @param value The new Executable value | ||||
*/ | */ | ||||
public void setExecutable( String value ) | public void setExecutable( String value ) | ||||
throws TaskException | |||||
{ | { | ||||
cmdl.setExecutable( value ); | cmdl.setExecutable( value ); | ||||
} | } | ||||
@@ -64,78 +64,86 @@ public class Execute | |||||
*/ | */ | ||||
static | static | ||||
{ | { | ||||
// Try using a JDK 1.3 launcher | |||||
try | |||||
{ | |||||
vmLauncher = new Java13CommandLauncher(); | |||||
} | |||||
catch( NoSuchMethodException exc ) | |||||
{ | |||||
// Ignore and keep try | |||||
} | |||||
if( Os.isFamily( "mac" ) ) | |||||
{ | |||||
// Mac | |||||
shellLauncher = new MacCommandLauncher( new CommandLauncher() ); | |||||
} | |||||
else if( Os.isFamily( "os/2" ) ) | |||||
{ | |||||
// OS/2 - use same mechanism as Windows 2000 | |||||
shellLauncher = new WinNTCommandLauncher( new CommandLauncher() ); | |||||
} | |||||
else if( Os.isFamily( "windows" ) ) | |||||
try | |||||
{ | { | ||||
// Windows. Need to determine which JDK we're running in | |||||
CommandLauncher baseLauncher; | |||||
if( System.getProperty( "java.version" ).startsWith( "1.1" ) ) | |||||
// Try using a JDK 1.3 launcher | |||||
try | |||||
{ | { | ||||
// JDK 1.1 | |||||
baseLauncher = new Java11CommandLauncher(); | |||||
vmLauncher = new Java13CommandLauncher(); | |||||
} | } | ||||
else | |||||
catch( NoSuchMethodException exc ) | |||||
{ | { | ||||
// JDK 1.2 | |||||
baseLauncher = new CommandLauncher(); | |||||
// Ignore and keep try | |||||
} | } | ||||
// Determine if we're running under 2000/NT or 98/95 | |||||
String osname = | |||||
System.getProperty( "os.name" ).toLowerCase( Locale.US ); | |||||
if( osname.indexOf( "nt" ) >= 0 || osname.indexOf( "2000" ) >= 0 ) | |||||
if( Os.isFamily( "mac" ) ) | |||||
{ | { | ||||
// Windows 2000/NT | |||||
shellLauncher = new WinNTCommandLauncher( baseLauncher ); | |||||
// Mac | |||||
shellLauncher = new MacCommandLauncher( new CommandLauncher() ); | |||||
} | } | ||||
else | |||||
else if( Os.isFamily( "os/2" ) ) | |||||
{ | { | ||||
// Windows 98/95 - need to use an auxiliary script | |||||
shellLauncher = new ScriptCommandLauncher( "bin/antRun.bat", baseLauncher ); | |||||
// OS/2 - use same mechanism as Windows 2000 | |||||
shellLauncher = new WinNTCommandLauncher( new CommandLauncher() ); | |||||
} | } | ||||
} | |||||
else if( ( new Os( "netware" ) ).eval() ) | |||||
{ | |||||
// NetWare. Need to determine which JDK we're running in | |||||
CommandLauncher baseLauncher; | |||||
if( System.getProperty( "java.version" ).startsWith( "1.1" ) ) | |||||
else if( Os.isFamily( "windows" ) ) | |||||
{ | |||||
// Windows. Need to determine which JDK we're running in | |||||
CommandLauncher baseLauncher; | |||||
if( System.getProperty( "java.version" ).startsWith( "1.1" ) ) | |||||
{ | |||||
// JDK 1.1 | |||||
baseLauncher = new Java11CommandLauncher(); | |||||
} | |||||
else | |||||
{ | |||||
// JDK 1.2 | |||||
baseLauncher = new CommandLauncher(); | |||||
} | |||||
// Determine if we're running under 2000/NT or 98/95 | |||||
String osname = | |||||
System.getProperty( "os.name" ).toLowerCase( Locale.US ); | |||||
if( osname.indexOf( "nt" ) >= 0 || osname.indexOf( "2000" ) >= 0 ) | |||||
{ | |||||
// Windows 2000/NT | |||||
shellLauncher = new WinNTCommandLauncher( baseLauncher ); | |||||
} | |||||
else | |||||
{ | |||||
// Windows 98/95 - need to use an auxiliary script | |||||
shellLauncher = new ScriptCommandLauncher( "bin/antRun.bat", baseLauncher ); | |||||
} | |||||
} | |||||
else if( ( new Os( "netware" ) ).eval() ) | |||||
{ | { | ||||
// JDK 1.1 | |||||
baseLauncher = new Java11CommandLauncher(); | |||||
// NetWare. Need to determine which JDK we're running in | |||||
CommandLauncher baseLauncher; | |||||
if( System.getProperty( "java.version" ).startsWith( "1.1" ) ) | |||||
{ | |||||
// JDK 1.1 | |||||
baseLauncher = new Java11CommandLauncher(); | |||||
} | |||||
else | |||||
{ | |||||
// JDK 1.2 | |||||
baseLauncher = new CommandLauncher(); | |||||
} | |||||
shellLauncher = new PerlScriptCommandLauncher( "bin/antRun.pl", baseLauncher ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
// JDK 1.2 | |||||
baseLauncher = new CommandLauncher(); | |||||
// Generic | |||||
shellLauncher = new ScriptCommandLauncher( "bin/antRun", new CommandLauncher() ); | |||||
} | } | ||||
shellLauncher = new PerlScriptCommandLauncher( "bin/antRun.pl", baseLauncher ); | |||||
} | } | ||||
else | |||||
catch( TaskException e ) | |||||
{ | { | ||||
// Generic | |||||
shellLauncher = new ScriptCommandLauncher( "bin/antRun", new CommandLauncher() ); | |||||
e.printStackTrace(); | |||||
} | } | ||||
} | } | ||||
@@ -82,6 +82,7 @@ public class ExecuteOn extends ExecTask | |||||
* @param skip The new SkipEmptyFilesets value | * @param skip The new SkipEmptyFilesets value | ||||
*/ | */ | ||||
public void setSkipEmptyFilesets( boolean skip ) | public void setSkipEmptyFilesets( boolean skip ) | ||||
throws TaskException | |||||
{ | { | ||||
skipEmpty = skip; | skipEmpty = skip; | ||||
} | } | ||||
@@ -130,6 +131,7 @@ public class ExecuteOn extends ExecTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Commandline.Marker createSrcfile() | public Commandline.Marker createSrcfile() | ||||
throws TaskException | |||||
{ | { | ||||
if( srcFilePos != null ) | if( srcFilePos != null ) | ||||
{ | { | ||||
@@ -146,6 +148,7 @@ public class ExecuteOn extends ExecTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Commandline.Marker createTargetfile() | public Commandline.Marker createTargetfile() | ||||
throws TaskException | |||||
{ | { | ||||
if( targetFilePos != null ) | if( targetFilePos != null ) | ||||
{ | { | ||||
@@ -343,6 +346,7 @@ public class ExecuteOn extends ExecTask | |||||
} | } | ||||
protected void checkConfiguration() | protected void checkConfiguration() | ||||
throws TaskException | |||||
{ | { | ||||
super.checkConfiguration(); | super.checkConfiguration(); | ||||
if( filesets.size() == 0 ) | if( filesets.size() == 0 ) | ||||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.InputStream; | import java.io.InputStream; | ||||
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import org.apache.myrmidon.api.TaskException; | |||||
/** | /** | ||||
* Used by <code>Execute</code> to handle input and output stream of | * Used by <code>Execute</code> to handle input and output stream of | ||||
@@ -19,7 +20,6 @@ import java.io.OutputStream; | |||||
*/ | */ | ||||
public interface ExecuteStreamHandler | public interface ExecuteStreamHandler | ||||
{ | { | ||||
/** | /** | ||||
* Install a handler for the input stream of the subprocess. | * Install a handler for the input stream of the subprocess. | ||||
* | * | ||||
@@ -59,5 +59,6 @@ public interface ExecuteStreamHandler | |||||
/** | /** | ||||
* Stop handling of the streams - will not be restarted. | * Stop handling of the streams - will not be restarted. | ||||
*/ | */ | ||||
void stop(); | |||||
void stop() | |||||
throws TaskException; | |||||
} | } |
@@ -12,6 +12,7 @@ import java.io.IOException; | |||||
import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
import org.apache.myrmidon.api.TaskException; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -86,6 +87,7 @@ public class Input extends Task | |||||
* @param msg The feature to be added to the Text attribute | * @param msg The feature to be added to the Text attribute | ||||
*/ | */ | ||||
public void addText( String msg ) | public void addText( String msg ) | ||||
throws TaskException | |||||
{ | { | ||||
message += project.replaceProperties( msg ); | message += project.replaceProperties( msg ); | ||||
} | } | ||||
@@ -73,6 +73,7 @@ public class Jar extends Zip | |||||
} | } | ||||
public void setManifest( File manifestFile ) | public void setManifest( File manifestFile ) | ||||
throws TaskException | |||||
{ | { | ||||
if( !manifestFile.exists() ) | if( !manifestFile.exists() ) | ||||
{ | { | ||||
@@ -124,7 +125,7 @@ public class Jar extends Zip | |||||
} | } | ||||
public void addConfiguredManifest( Manifest newManifest ) | public void addConfiguredManifest( Manifest newManifest ) | ||||
throws ManifestException | |||||
throws ManifestException, TaskException | |||||
{ | { | ||||
if( manifest == null ) | if( manifest == null ) | ||||
{ | { | ||||
@@ -265,7 +266,7 @@ public class Jar extends Zip | |||||
} | } | ||||
protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// If the file being added is META-INF/MANIFEST.MF, we warn if it's not the | // If the file being added is META-INF/MANIFEST.MF, we warn if it's not the | ||||
// one specified in the "manifest" attribute - or if it's being added twice, | // one specified in the "manifest" attribute - or if it's being added twice, | ||||
@@ -284,7 +285,7 @@ public class Jar extends Zip | |||||
} | } | ||||
protected void zipFile( InputStream is, ZipOutputStream zOut, String vPath, long lastModified ) | protected void zipFile( InputStream is, ZipOutputStream zOut, String vPath, long lastModified ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// If the file being added is META-INF/MANIFEST.MF, we merge it with the | // If the file being added is META-INF/MANIFEST.MF, we merge it with the | ||||
// current manifest | // current manifest | ||||
@@ -315,7 +316,7 @@ public class Jar extends Zip | |||||
* and adding it to the zip stream. | * and adding it to the zip stream. | ||||
*/ | */ | ||||
private void createIndexList( ZipOutputStream zOut ) | private void createIndexList( ZipOutputStream zOut ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||||
// encoding must be UTF8 as specified in the specs. | // encoding must be UTF8 as specified in the specs. | ||||
@@ -371,7 +372,7 @@ public class Jar extends Zip | |||||
* @exception IOException Description of Exception | * @exception IOException Description of Exception | ||||
*/ | */ | ||||
private void zipManifestEntry( InputStream is ) | private void zipManifestEntry( InputStream is ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -61,6 +61,7 @@ public class Java extends Task | |||||
* @param s The new Classpath value | * @param s The new Classpath value | ||||
*/ | */ | ||||
public void setClasspath( Path s ) | public void setClasspath( Path s ) | ||||
throws TaskException | |||||
{ | { | ||||
createClasspath().append( s ); | createClasspath().append( s ); | ||||
} | } | ||||
@@ -71,6 +72,7 @@ public class Java extends Task | |||||
* @param r The new ClasspathRef value | * @param r The new ClasspathRef value | ||||
*/ | */ | ||||
public void setClasspathRef( Reference r ) | public void setClasspathRef( Reference r ) | ||||
throws TaskException | |||||
{ | { | ||||
createClasspath().setRefid( r ); | createClasspath().setRefid( r ); | ||||
} | } | ||||
@@ -190,6 +192,7 @@ public class Java extends Task | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Path createClasspath() | public Path createClasspath() | ||||
throws TaskException | |||||
{ | { | ||||
return cmdl.createClasspath( project ).createPath(); | return cmdl.createClasspath( project ).createPath(); | ||||
} | } | ||||
@@ -94,6 +94,7 @@ public class Javac extends MatchingTask | |||||
* @param r The new BootClasspathRef value | * @param r The new BootClasspathRef value | ||||
*/ | */ | ||||
public void setBootClasspathRef( Reference r ) | public void setBootClasspathRef( Reference r ) | ||||
throws TaskException | |||||
{ | { | ||||
createBootclasspath().setRefid( r ); | createBootclasspath().setRefid( r ); | ||||
} | } | ||||
@@ -104,6 +105,7 @@ public class Javac extends MatchingTask | |||||
* @param bootclasspath The new Bootclasspath value | * @param bootclasspath The new Bootclasspath value | ||||
*/ | */ | ||||
public void setBootclasspath( Path bootclasspath ) | public void setBootclasspath( Path bootclasspath ) | ||||
throws TaskException | |||||
{ | { | ||||
if( this.bootclasspath == null ) | if( this.bootclasspath == null ) | ||||
{ | { | ||||
@@ -121,6 +123,7 @@ public class Javac extends MatchingTask | |||||
* @param classpath The new Classpath value | * @param classpath The new Classpath value | ||||
*/ | */ | ||||
public void setClasspath( Path classpath ) | public void setClasspath( Path classpath ) | ||||
throws TaskException | |||||
{ | { | ||||
if( compileClasspath == null ) | if( compileClasspath == null ) | ||||
{ | { | ||||
@@ -138,6 +141,7 @@ public class Javac extends MatchingTask | |||||
* @param r The new ClasspathRef value | * @param r The new ClasspathRef value | ||||
*/ | */ | ||||
public void setClasspathRef( Reference r ) | public void setClasspathRef( Reference r ) | ||||
throws TaskException | |||||
{ | { | ||||
createClasspath().setRefid( r ); | createClasspath().setRefid( r ); | ||||
} | } | ||||
@@ -209,6 +213,7 @@ public class Javac extends MatchingTask | |||||
* @param extdirs The new Extdirs value | * @param extdirs The new Extdirs value | ||||
*/ | */ | ||||
public void setExtdirs( Path extdirs ) | public void setExtdirs( Path extdirs ) | ||||
throws TaskException | |||||
{ | { | ||||
if( this.extdirs == null ) | if( this.extdirs == null ) | ||||
{ | { | ||||
@@ -345,6 +350,7 @@ public class Javac extends MatchingTask | |||||
* @param srcDir The new Srcdir value | * @param srcDir The new Srcdir value | ||||
*/ | */ | ||||
public void setSrcdir( Path srcDir ) | public void setSrcdir( Path srcDir ) | ||||
throws TaskException | |||||
{ | { | ||||
if( src == null ) | if( src == null ) | ||||
{ | { | ||||
@@ -649,6 +655,7 @@ public class Javac extends MatchingTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Path createBootclasspath() | public Path createBootclasspath() | ||||
throws TaskException | |||||
{ | { | ||||
if( bootclasspath == null ) | if( bootclasspath == null ) | ||||
{ | { | ||||
@@ -663,6 +670,7 @@ public class Javac extends MatchingTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Path createClasspath() | public Path createClasspath() | ||||
throws TaskException | |||||
{ | { | ||||
if( compileClasspath == null ) | if( compileClasspath == null ) | ||||
{ | { | ||||
@@ -690,6 +698,7 @@ public class Javac extends MatchingTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Path createExtdirs() | public Path createExtdirs() | ||||
throws TaskException | |||||
{ | { | ||||
if( extdirs == null ) | if( extdirs == null ) | ||||
{ | { | ||||
@@ -704,6 +713,7 @@ public class Javac extends MatchingTask | |||||
* @return a nested src element. | * @return a nested src element. | ||||
*/ | */ | ||||
public Path createSrc() | public Path createSrc() | ||||
throws TaskException | |||||
{ | { | ||||
if( src == null ) | if( src == null ) | ||||
{ | { | ||||
@@ -91,6 +91,7 @@ public class Manifest extends Task | |||||
* Construct an empty manifest | * Construct an empty manifest | ||||
*/ | */ | ||||
public Manifest() | public Manifest() | ||||
throws TaskException | |||||
{ | { | ||||
mode = new Mode(); | mode = new Mode(); | ||||
mode.setValue( "replace" ); | mode.setValue( "replace" ); | ||||
@@ -244,7 +245,7 @@ public class Manifest extends Task | |||||
} | } | ||||
public void addConfiguredSection( Section section ) | public void addConfiguredSection( Section section ) | ||||
throws ManifestException | |||||
throws ManifestException, TaskException | |||||
{ | { | ||||
if( section.getName() == null ) | if( section.getName() == null ) | ||||
{ | { | ||||
@@ -360,9 +361,7 @@ public class Manifest extends Task | |||||
} | } | ||||
catch( IOException e ) | catch( IOException e ) | ||||
{ | { | ||||
throw new TaskException( "Failed to write " + manifestFile | |||||
e ); | |||||
throw new TaskException( "Failed to write " + manifestFile, e ); | |||||
} | } | ||||
finally | finally | ||||
{ | { | ||||
@@ -726,7 +725,7 @@ public class Manifest extends Task | |||||
* section. | * section. | ||||
*/ | */ | ||||
public String addAttributeAndCheck( Attribute attribute ) | public String addAttributeAndCheck( Attribute attribute ) | ||||
throws ManifestException | |||||
throws ManifestException, TaskException | |||||
{ | { | ||||
if( attribute.getName() == null || attribute.getValue() == null ) | if( attribute.getName() == null || attribute.getValue() == null ) | ||||
{ | { | ||||
@@ -773,7 +772,7 @@ public class Manifest extends Task | |||||
} | } | ||||
public void addConfiguredAttribute( Attribute attribute ) | public void addConfiguredAttribute( Attribute attribute ) | ||||
throws ManifestException | |||||
throws ManifestException, TaskException | |||||
{ | { | ||||
String check = addAttributeAndCheck( attribute ); | String check = addAttributeAndCheck( attribute ); | ||||
if( check != null ) | if( check != null ) | ||||
@@ -141,6 +141,7 @@ public abstract class MatchingTask extends Task | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet createPatternSet() | public PatternSet createPatternSet() | ||||
throws TaskException | |||||
{ | { | ||||
return fileset.createPatternSet(); | return fileset.createPatternSet(); | ||||
} | } | ||||
@@ -45,7 +45,8 @@ public abstract class Pack extends Task | |||||
pack(); | pack(); | ||||
} | } | ||||
protected abstract void pack(); | |||||
protected abstract void pack() | |||||
throws TaskException; | |||||
protected void zipFile( File file, OutputStream zOut ) | protected void zipFile( File file, OutputStream zOut ) | ||||
throws IOException | throws IOException | ||||
@@ -44,7 +44,8 @@ public abstract class Unpack extends Task | |||||
protected abstract String getDefaultExtension(); | protected abstract String getDefaultExtension(); | ||||
protected abstract void extract(); | |||||
protected abstract void extract() | |||||
throws TaskException; | |||||
private void createDestFile( String defaultExtension ) | private void createDestFile( String defaultExtension ) | ||||
{ | { | ||||
@@ -90,7 +90,7 @@ public class War extends Jar | |||||
} | } | ||||
protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// If the file being added is WEB-INF/web.xml, we warn if it's not the | // If the file being added is WEB-INF/web.xml, we warn if it's not the | ||||
// one specified in the "webxml" attribute - or if it's being added twice, | // one specified in the "webxml" attribute - or if it's being added twice, | ||||
@@ -71,6 +71,7 @@ public class Zip extends MatchingTask | |||||
private String encoding; | private String encoding; | ||||
protected static String[][] grabFileNames( FileScanner[] scanners ) | protected static String[][] grabFileNames( FileScanner[] scanners ) | ||||
throws TaskException | |||||
{ | { | ||||
String[][] result = new String[ scanners.length ][]; | String[][] result = new String[ scanners.length ][]; | ||||
for( int i = 0; i < scanners.length; i++ ) | for( int i = 0; i < scanners.length; i++ ) | ||||
@@ -84,11 +85,6 @@ public class Zip extends MatchingTask | |||||
return result; | return result; | ||||
} | } | ||||
protected static File[] grabFiles( FileScanner[] scanners ) | |||||
{ | |||||
return grabFiles( scanners, grabFileNames( scanners ) ); | |||||
} | |||||
protected static File[] grabFiles( FileScanner[] scanners, | protected static File[] grabFiles( FileScanner[] scanners, | ||||
String[][] fileNames ) | String[][] fileNames ) | ||||
{ | { | ||||
@@ -477,7 +473,7 @@ public class Zip extends MatchingTask | |||||
*/ | */ | ||||
protected void addFiles( FileScanner scanner, ZipOutputStream zOut, | protected void addFiles( FileScanner scanner, ZipOutputStream zOut, | ||||
String prefix, String fullpath ) | String prefix, String fullpath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
if( prefix.length() > 0 && fullpath.length() > 0 ) | if( prefix.length() > 0 && fullpath.length() > 0 ) | ||||
throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | ||||
@@ -534,7 +530,7 @@ public class Zip extends MatchingTask | |||||
* @exception IOException Description of Exception | * @exception IOException Description of Exception | ||||
*/ | */ | ||||
protected void addFiles( Vector filesets, ZipOutputStream zOut ) | protected void addFiles( Vector filesets, ZipOutputStream zOut ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// Add each fileset in the Vector. | // Add each fileset in the Vector. | ||||
for( int i = 0; i < filesets.size(); i++ ) | for( int i = 0; i < filesets.size(); i++ ) | ||||
@@ -630,7 +626,7 @@ public class Zip extends MatchingTask | |||||
protected void addZipEntries( ZipFileSet fs, DirectoryScanner ds, | protected void addZipEntries( ZipFileSet fs, DirectoryScanner ds, | ||||
ZipOutputStream zOut, String prefix, String fullpath ) | ZipOutputStream zOut, String prefix, String fullpath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
if( prefix.length() > 0 && fullpath.length() > 0 ) | if( prefix.length() > 0 && fullpath.length() > 0 ) | ||||
throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | ||||
@@ -703,6 +699,7 @@ public class Zip extends MatchingTask | |||||
* @return true if the file is then considered up to date. | * @return true if the file is then considered up to date. | ||||
*/ | */ | ||||
protected boolean createEmptyZip( File zipFile ) | protected boolean createEmptyZip( File zipFile ) | ||||
throws TaskException | |||||
{ | { | ||||
// In this case using java.util.zip will not work | // In this case using java.util.zip will not work | ||||
// because it does not permit a zero-entry archive. | // because it does not permit a zero-entry archive. | ||||
@@ -777,7 +774,7 @@ public class Zip extends MatchingTask | |||||
protected void zipFile( InputStream in, ZipOutputStream zOut, String vPath, | protected void zipFile( InputStream in, ZipOutputStream zOut, String vPath, | ||||
long lastModified ) | long lastModified ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
ZipEntry ze = new ZipEntry( vPath ); | ZipEntry ze = new ZipEntry( vPath ); | ||||
ze.setTime( lastModified ); | ze.setTime( lastModified ); | ||||
@@ -846,7 +843,7 @@ public class Zip extends MatchingTask | |||||
} | } | ||||
protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
if( file.equals( zipFile ) ) | if( file.equals( zipFile ) ) | ||||
{ | { | ||||
@@ -93,6 +93,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
} | } | ||||
protected Commandline setupJavacCommand() | protected Commandline setupJavacCommand() | ||||
throws TaskException | |||||
{ | { | ||||
return setupJavacCommand( false ); | return setupJavacCommand( false ); | ||||
} | } | ||||
@@ -105,6 +106,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
protected Commandline setupJavacCommand( boolean debugLevelCheck ) | protected Commandline setupJavacCommand( boolean debugLevelCheck ) | ||||
throws TaskException | |||||
{ | { | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
setupJavacCommandlineSwitches( cmd, debugLevelCheck ); | setupJavacCommandlineSwitches( cmd, debugLevelCheck ); | ||||
@@ -112,11 +114,6 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
return cmd; | return cmd; | ||||
} | } | ||||
protected Commandline setupJavacCommandlineSwitches( Commandline cmd ) | |||||
{ | |||||
return setupJavacCommandlineSwitches( cmd, false ); | |||||
} | |||||
/** | /** | ||||
* Does the command line argument processing common to classic and modern. | * Does the command line argument processing common to classic and modern. | ||||
* Doesn't add the files to compile. | * Doesn't add the files to compile. | ||||
@@ -127,6 +124,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
*/ | */ | ||||
protected Commandline setupJavacCommandlineSwitches( Commandline cmd, | protected Commandline setupJavacCommandlineSwitches( Commandline cmd, | ||||
boolean useDebugLevel ) | boolean useDebugLevel ) | ||||
throws TaskException | |||||
{ | { | ||||
Path classpath = getCompileClasspath(); | Path classpath = getCompileClasspath(); | ||||
@@ -292,6 +290,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
protected Commandline setupModernJavacCommand() | protected Commandline setupModernJavacCommand() | ||||
throws TaskException | |||||
{ | { | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
setupModernJavacCommandlineSwitches( cmd ); | setupModernJavacCommandlineSwitches( cmd ); | ||||
@@ -308,6 +307,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
protected Commandline setupModernJavacCommandlineSwitches( Commandline cmd ) | protected Commandline setupModernJavacCommandlineSwitches( Commandline cmd ) | ||||
throws TaskException | |||||
{ | { | ||||
setupJavacCommandlineSwitches( cmd, true ); | setupJavacCommandlineSwitches( cmd, true ); | ||||
if( attributes.getSource() != null ) | if( attributes.getSource() != null ) | ||||
@@ -324,6 +324,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
* @return The CompileClasspath value | * @return The CompileClasspath value | ||||
*/ | */ | ||||
protected Path getCompileClasspath() | protected Path getCompileClasspath() | ||||
throws TaskException | |||||
{ | { | ||||
Path classpath = new Path( project ); | Path classpath = new Path( project ); | ||||
@@ -42,6 +42,7 @@ public class Gcj extends DefaultCompilerAdapter | |||||
} | } | ||||
protected Commandline setupGCJCommand() | protected Commandline setupGCJCommand() | ||||
throws TaskException | |||||
{ | { | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
Path classpath = new Path( project ); | Path classpath = new Path( project ); | ||||
@@ -64,6 +64,7 @@ public class Kjc extends DefaultCompilerAdapter | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
protected Commandline setupKjcCommand() | protected Commandline setupKjcCommand() | ||||
throws TaskException | |||||
{ | { | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
@@ -1064,6 +1064,7 @@ public class IContract extends MatchingTask | |||||
// make it public | // make it public | ||||
public void modify( Path path ) | public void modify( Path path ) | ||||
throws TaskException | |||||
{ | { | ||||
// depending on what compiler to use, set the includeJavaRuntime flag | // depending on what compiler to use, set the includeJavaRuntime flag | ||||
if( "jikes".equals( compiler ) ) | if( "jikes".equals( compiler ) ) | ||||
@@ -239,6 +239,7 @@ public class ReplaceRegExp extends Task | |||||
Substitution s, | Substitution s, | ||||
String input, | String input, | ||||
int options ) | int options ) | ||||
throws TaskException | |||||
{ | { | ||||
String res = input; | String res = input; | ||||
Regexp regexp = r.getRegexp( project ); | Regexp regexp = r.getRegexp( project ); | ||||
@@ -259,7 +260,7 @@ public class ReplaceRegExp extends Task | |||||
* @exception IOException Description of Exception | * @exception IOException Description of Exception | ||||
*/ | */ | ||||
protected void doReplace( File f, int options ) | protected void doReplace( File f, int options ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
File parentDir = new File( new File( f.getAbsolutePath() ).getParent() ); | File parentDir = new File( new File( f.getAbsolutePath() ).getParent() ); | ||||
File temp = fileUtils.createTempFile( "replace", ".txt", parentDir ); | File temp = fileUtils.createTempFile( "replace", ".txt", parentDir ); | ||||
@@ -480,6 +480,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
* @param sourceJar java.io.File representing the produced jar file | * @param sourceJar java.io.File representing the produced jar file | ||||
*/ | */ | ||||
private void verifyBorlandJar( File sourceJar ) | private void verifyBorlandJar( File sourceJar ) | ||||
throws TaskException | |||||
{ | { | ||||
org.apache.tools.ant.taskdefs.Java javaTask = null; | org.apache.tools.ant.taskdefs.Java javaTask = null; | ||||
log( "verify " + sourceJar, Project.MSG_INFO ); | log( "verify " + sourceJar, Project.MSG_INFO ); | ||||
@@ -343,6 +343,7 @@ public class WLRun extends Task | |||||
} | } | ||||
private void executeWLS6() | private void executeWLS6() | ||||
throws TaskException | |||||
{ | { | ||||
File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL60_POLICY_FILE ); | File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL60_POLICY_FILE ); | ||||
if( !beaHome.isDirectory() ) | if( !beaHome.isDirectory() ) | ||||
@@ -747,6 +747,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
* @param publicId Description of Parameter | * @param publicId Description of Parameter | ||||
*/ | */ | ||||
private void buildWeblogicJar( File sourceJar, File destJar, String publicId ) | private void buildWeblogicJar( File sourceJar, File destJar, String publicId ) | ||||
throws TaskException | |||||
{ | { | ||||
org.apache.tools.ant.taskdefs.Java javaTask = null; | org.apache.tools.ant.taskdefs.Java javaTask = null; | ||||
@@ -878,10 +878,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
File genericJarFile = super.getVendorOutputJarFile( baseName ); | File genericJarFile = super.getVendorOutputJarFile( baseName ); | ||||
super.writeJar( baseName, genericJarFile, files, publicId ); | super.writeJar( baseName, genericJarFile, files, publicId ); | ||||
// create the output .jar, if required | // create the output .jar, if required | ||||
if( alwaysRebuild || isRebuildRequired( genericJarFile, jarFile ) ) | if( alwaysRebuild || isRebuildRequired( genericJarFile, jarFile ) ) | ||||
{ | { | ||||
buildWebsphereJar( genericJarFile, jarFile ); | buildWebsphereJar( genericJarFile, jarFile ); | ||||
@@ -939,6 +936,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
* jarfile. | * jarfile. | ||||
*/ | */ | ||||
private void buildWebsphereJar( File sourceJar, File destJar ) | private void buildWebsphereJar( File sourceJar, File destJar ) | ||||
throws TaskException | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -19,7 +19,8 @@ import org.apache.tools.ant.types.Commandline; | |||||
* | * | ||||
* @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a> | * @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a> | ||||
*/ | */ | ||||
public class JasperC extends DefaultCompilerAdapter | |||||
public class JasperC | |||||
extends DefaultCompilerAdapter | |||||
{ | { | ||||
/* | /* | ||||
* ------------------------------------------------------------ | * ------------------------------------------------------------ | ||||
@@ -274,6 +274,7 @@ public class FileSet extends DataType implements Cloneable | |||||
} | } | ||||
catch( TaskException e ) | catch( TaskException e ) | ||||
{ | { | ||||
throw new IllegalStateException( e.getMessage() ); | |||||
} | } | ||||
} | } | ||||
@@ -108,9 +108,12 @@ public class RegularExpression extends DataType | |||||
} | } | ||||
public Regexp getRegexp( Project p ) | public Regexp getRegexp( Project p ) | ||||
throws TaskException | |||||
{ | { | ||||
if( isReference() ) | if( isReference() ) | ||||
{ | |||||
return getRef( p ).getRegexp( p ); | return getRef( p ).getRegexp( p ); | ||||
} | |||||
return this.regexp; | return this.regexp; | ||||
} | } | ||||
@@ -1086,17 +1086,10 @@ public class AntClassLoader extends ClassLoader implements BuildListener | |||||
while( ( pathElementsIndex < pathComponents.size() ) && | while( ( pathElementsIndex < pathComponents.size() ) && | ||||
( url == null ) ) | ( url == null ) ) | ||||
{ | { | ||||
try | |||||
{ | |||||
File pathComponent | |||||
= (File)pathComponents.elementAt( pathElementsIndex ); | |||||
url = getResourceURL( pathComponent, this.resourceName ); | |||||
pathElementsIndex++; | |||||
} | |||||
catch( TaskException e ) | |||||
{ | |||||
// ignore path elements which are not valid relative to the project | |||||
} | |||||
File pathComponent | |||||
= (File)pathComponents.elementAt( pathElementsIndex ); | |||||
url = getResourceURL( pathComponent, this.resourceName ); | |||||
pathElementsIndex++; | |||||
} | } | ||||
this.nextResource = url; | this.nextResource = url; | ||||
} | } | ||||
@@ -103,6 +103,7 @@ public class Launcher | |||||
} | } | ||||
private static void addToolsJar( AntClassLoader antLoader ) | private static void addToolsJar( AntClassLoader antLoader ) | ||||
throws TaskException | |||||
{ | { | ||||
String javaHome = System.getProperty( "java.home" ); | String javaHome = System.getProperty( "java.home" ); | ||||
if( javaHome.endsWith( "jre" ) ) | if( javaHome.endsWith( "jre" ) ) | ||||
@@ -38,11 +38,6 @@ public class Chmod extends ExecuteOn | |||||
super.setSkipEmptyFilesets( true ); | super.setSkipEmptyFilesets( true ); | ||||
} | } | ||||
public void setCommand( String e ) | |||||
{ | |||||
throw new TaskException( taskType + " doesn\'t support the command attribute" ); | |||||
} | |||||
/** | /** | ||||
* Sets whether default exclusions should be used or not. | * Sets whether default exclusions should be used or not. | ||||
* | * | ||||
@@ -50,12 +45,14 @@ public class Chmod extends ExecuteOn | |||||
* should be used, "false"|"off"|"no" when they shouldn't be used. | * should be used, "false"|"off"|"no" when they shouldn't be used. | ||||
*/ | */ | ||||
public void setDefaultexcludes( boolean useDefaultExcludes ) | public void setDefaultexcludes( boolean useDefaultExcludes ) | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
defaultSet.setDefaultexcludes( useDefaultExcludes ); | defaultSet.setDefaultexcludes( useDefaultExcludes ); | ||||
} | } | ||||
public void setDir( File src ) | public void setDir( File src ) | ||||
throws TaskException | |||||
{ | { | ||||
defaultSet.setDir( src ); | defaultSet.setDir( src ); | ||||
} | } | ||||
@@ -67,17 +64,20 @@ public class Chmod extends ExecuteOn | |||||
* @param excludes the string containing the exclude patterns | * @param excludes the string containing the exclude patterns | ||||
*/ | */ | ||||
public void setExcludes( String excludes ) | public void setExcludes( String excludes ) | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
defaultSet.setExcludes( excludes ); | defaultSet.setExcludes( excludes ); | ||||
} | } | ||||
public void setExecutable( String e ) | public void setExecutable( String e ) | ||||
throws TaskException | |||||
{ | { | ||||
throw new TaskException( taskType + " doesn\'t support the executable attribute" ); | throw new TaskException( taskType + " doesn\'t support the executable attribute" ); | ||||
} | } | ||||
public void setFile( File src ) | public void setFile( File src ) | ||||
throws TaskException | |||||
{ | { | ||||
FileSet fs = new FileSet(); | FileSet fs = new FileSet(); | ||||
fs.setDir( new File( src.getParent() ) ); | fs.setDir( new File( src.getParent() ) ); | ||||
@@ -92,6 +92,7 @@ public class Chmod extends ExecuteOn | |||||
* @param includes the string containing the include patterns | * @param includes the string containing the include patterns | ||||
*/ | */ | ||||
public void setIncludes( String includes ) | public void setIncludes( String includes ) | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
defaultSet.setIncludes( includes ); | defaultSet.setIncludes( includes ); | ||||
@@ -104,6 +105,7 @@ public class Chmod extends ExecuteOn | |||||
} | } | ||||
public void setSkipEmptyFilesets( boolean skip ) | public void setSkipEmptyFilesets( boolean skip ) | ||||
throws TaskException | |||||
{ | { | ||||
throw new TaskException( taskType + " doesn\'t support the skipemptyfileset attribute" ); | throw new TaskException( taskType + " doesn\'t support the skipemptyfileset attribute" ); | ||||
} | } | ||||
@@ -114,6 +116,7 @@ public class Chmod extends ExecuteOn | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet.NameEntry createExclude() | public PatternSet.NameEntry createExclude() | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
return defaultSet.createExclude(); | return defaultSet.createExclude(); | ||||
@@ -125,6 +128,7 @@ public class Chmod extends ExecuteOn | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet.NameEntry createInclude() | public PatternSet.NameEntry createInclude() | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
return defaultSet.createInclude(); | return defaultSet.createInclude(); | ||||
@@ -136,6 +140,7 @@ public class Chmod extends ExecuteOn | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet createPatternSet() | public PatternSet createPatternSet() | ||||
throws TaskException | |||||
{ | { | ||||
defaultSetDefined = true; | defaultSetDefined = true; | ||||
return defaultSet.createPatternSet(); | return defaultSet.createPatternSet(); | ||||
@@ -176,6 +181,7 @@ public class Chmod extends ExecuteOn | |||||
} | } | ||||
protected void checkConfiguration() | protected void checkConfiguration() | ||||
throws TaskException | |||||
{ | { | ||||
if( !havePerm ) | if( !havePerm ) | ||||
{ | { | ||||
@@ -330,6 +330,7 @@ public class Copy extends Task | |||||
* good method for subclasses to override. | * good method for subclasses to override. | ||||
*/ | */ | ||||
protected void doFileOperations() | protected void doFileOperations() | ||||
throws TaskException | |||||
{ | { | ||||
if( fileCopyMap.size() > 0 ) | if( fileCopyMap.size() > 0 ) | ||||
{ | { | ||||
@@ -223,6 +223,7 @@ public class Delete extends MatchingTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet createPatternSet() | public PatternSet createPatternSet() | ||||
throws TaskException | |||||
{ | { | ||||
usedMatchingTask = true; | usedMatchingTask = true; | ||||
return super.createPatternSet(); | return super.createPatternSet(); | ||||
@@ -355,6 +356,7 @@ public class Delete extends MatchingTask | |||||
//************************************************************************ | //************************************************************************ | ||||
protected void removeDir( File d ) | protected void removeDir( File d ) | ||||
throws TaskException | |||||
{ | { | ||||
String[] list = d.list(); | String[] list = d.list(); | ||||
if( list == null ) | if( list == null ) | ||||
@@ -402,6 +404,7 @@ public class Delete extends MatchingTask | |||||
* @param dirs array of directories to delete; can of zero length | * @param dirs array of directories to delete; can of zero length | ||||
*/ | */ | ||||
protected void removeFiles( File d, String[] files, String[] dirs ) | protected void removeFiles( File d, String[] files, String[] dirs ) | ||||
throws TaskException | |||||
{ | { | ||||
if( files.length > 0 ) | if( files.length > 0 ) | ||||
{ | { | ||||
@@ -79,7 +79,7 @@ public class Ear extends Jar | |||||
} | } | ||||
protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// If the file being added is WEB-INF/web.xml, we warn if it's not the | // If the file being added is WEB-INF/web.xml, we warn if it's not the | ||||
// one specified in the "webxml" attribute - or if it's being added twice, | // one specified in the "webxml" attribute - or if it's being added twice, | ||||
@@ -59,6 +59,7 @@ public class ExecTask extends Task | |||||
* @param d The new Dir value | * @param d The new Dir value | ||||
*/ | */ | ||||
public void setDir( File d ) | public void setDir( File d ) | ||||
throws TaskException | |||||
{ | { | ||||
this.dir = d; | this.dir = d; | ||||
} | } | ||||
@@ -69,6 +70,7 @@ public class ExecTask extends Task | |||||
* @param value The new Executable value | * @param value The new Executable value | ||||
*/ | */ | ||||
public void setExecutable( String value ) | public void setExecutable( String value ) | ||||
throws TaskException | |||||
{ | { | ||||
cmdl.setExecutable( value ); | cmdl.setExecutable( value ); | ||||
} | } | ||||
@@ -64,78 +64,86 @@ public class Execute | |||||
*/ | */ | ||||
static | static | ||||
{ | { | ||||
// Try using a JDK 1.3 launcher | |||||
try | |||||
{ | |||||
vmLauncher = new Java13CommandLauncher(); | |||||
} | |||||
catch( NoSuchMethodException exc ) | |||||
{ | |||||
// Ignore and keep try | |||||
} | |||||
if( Os.isFamily( "mac" ) ) | |||||
{ | |||||
// Mac | |||||
shellLauncher = new MacCommandLauncher( new CommandLauncher() ); | |||||
} | |||||
else if( Os.isFamily( "os/2" ) ) | |||||
{ | |||||
// OS/2 - use same mechanism as Windows 2000 | |||||
shellLauncher = new WinNTCommandLauncher( new CommandLauncher() ); | |||||
} | |||||
else if( Os.isFamily( "windows" ) ) | |||||
try | |||||
{ | { | ||||
// Windows. Need to determine which JDK we're running in | |||||
CommandLauncher baseLauncher; | |||||
if( System.getProperty( "java.version" ).startsWith( "1.1" ) ) | |||||
// Try using a JDK 1.3 launcher | |||||
try | |||||
{ | { | ||||
// JDK 1.1 | |||||
baseLauncher = new Java11CommandLauncher(); | |||||
vmLauncher = new Java13CommandLauncher(); | |||||
} | } | ||||
else | |||||
catch( NoSuchMethodException exc ) | |||||
{ | { | ||||
// JDK 1.2 | |||||
baseLauncher = new CommandLauncher(); | |||||
// Ignore and keep try | |||||
} | } | ||||
// Determine if we're running under 2000/NT or 98/95 | |||||
String osname = | |||||
System.getProperty( "os.name" ).toLowerCase( Locale.US ); | |||||
if( osname.indexOf( "nt" ) >= 0 || osname.indexOf( "2000" ) >= 0 ) | |||||
if( Os.isFamily( "mac" ) ) | |||||
{ | { | ||||
// Windows 2000/NT | |||||
shellLauncher = new WinNTCommandLauncher( baseLauncher ); | |||||
// Mac | |||||
shellLauncher = new MacCommandLauncher( new CommandLauncher() ); | |||||
} | } | ||||
else | |||||
else if( Os.isFamily( "os/2" ) ) | |||||
{ | { | ||||
// Windows 98/95 - need to use an auxiliary script | |||||
shellLauncher = new ScriptCommandLauncher( "bin/antRun.bat", baseLauncher ); | |||||
// OS/2 - use same mechanism as Windows 2000 | |||||
shellLauncher = new WinNTCommandLauncher( new CommandLauncher() ); | |||||
} | } | ||||
} | |||||
else if( ( new Os( "netware" ) ).eval() ) | |||||
{ | |||||
// NetWare. Need to determine which JDK we're running in | |||||
CommandLauncher baseLauncher; | |||||
if( System.getProperty( "java.version" ).startsWith( "1.1" ) ) | |||||
else if( Os.isFamily( "windows" ) ) | |||||
{ | |||||
// Windows. Need to determine which JDK we're running in | |||||
CommandLauncher baseLauncher; | |||||
if( System.getProperty( "java.version" ).startsWith( "1.1" ) ) | |||||
{ | |||||
// JDK 1.1 | |||||
baseLauncher = new Java11CommandLauncher(); | |||||
} | |||||
else | |||||
{ | |||||
// JDK 1.2 | |||||
baseLauncher = new CommandLauncher(); | |||||
} | |||||
// Determine if we're running under 2000/NT or 98/95 | |||||
String osname = | |||||
System.getProperty( "os.name" ).toLowerCase( Locale.US ); | |||||
if( osname.indexOf( "nt" ) >= 0 || osname.indexOf( "2000" ) >= 0 ) | |||||
{ | |||||
// Windows 2000/NT | |||||
shellLauncher = new WinNTCommandLauncher( baseLauncher ); | |||||
} | |||||
else | |||||
{ | |||||
// Windows 98/95 - need to use an auxiliary script | |||||
shellLauncher = new ScriptCommandLauncher( "bin/antRun.bat", baseLauncher ); | |||||
} | |||||
} | |||||
else if( ( new Os( "netware" ) ).eval() ) | |||||
{ | { | ||||
// JDK 1.1 | |||||
baseLauncher = new Java11CommandLauncher(); | |||||
// NetWare. Need to determine which JDK we're running in | |||||
CommandLauncher baseLauncher; | |||||
if( System.getProperty( "java.version" ).startsWith( "1.1" ) ) | |||||
{ | |||||
// JDK 1.1 | |||||
baseLauncher = new Java11CommandLauncher(); | |||||
} | |||||
else | |||||
{ | |||||
// JDK 1.2 | |||||
baseLauncher = new CommandLauncher(); | |||||
} | |||||
shellLauncher = new PerlScriptCommandLauncher( "bin/antRun.pl", baseLauncher ); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
// JDK 1.2 | |||||
baseLauncher = new CommandLauncher(); | |||||
// Generic | |||||
shellLauncher = new ScriptCommandLauncher( "bin/antRun", new CommandLauncher() ); | |||||
} | } | ||||
shellLauncher = new PerlScriptCommandLauncher( "bin/antRun.pl", baseLauncher ); | |||||
} | } | ||||
else | |||||
catch( TaskException e ) | |||||
{ | { | ||||
// Generic | |||||
shellLauncher = new ScriptCommandLauncher( "bin/antRun", new CommandLauncher() ); | |||||
e.printStackTrace(); | |||||
} | } | ||||
} | } | ||||
@@ -82,6 +82,7 @@ public class ExecuteOn extends ExecTask | |||||
* @param skip The new SkipEmptyFilesets value | * @param skip The new SkipEmptyFilesets value | ||||
*/ | */ | ||||
public void setSkipEmptyFilesets( boolean skip ) | public void setSkipEmptyFilesets( boolean skip ) | ||||
throws TaskException | |||||
{ | { | ||||
skipEmpty = skip; | skipEmpty = skip; | ||||
} | } | ||||
@@ -130,6 +131,7 @@ public class ExecuteOn extends ExecTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Commandline.Marker createSrcfile() | public Commandline.Marker createSrcfile() | ||||
throws TaskException | |||||
{ | { | ||||
if( srcFilePos != null ) | if( srcFilePos != null ) | ||||
{ | { | ||||
@@ -146,6 +148,7 @@ public class ExecuteOn extends ExecTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Commandline.Marker createTargetfile() | public Commandline.Marker createTargetfile() | ||||
throws TaskException | |||||
{ | { | ||||
if( targetFilePos != null ) | if( targetFilePos != null ) | ||||
{ | { | ||||
@@ -343,6 +346,7 @@ public class ExecuteOn extends ExecTask | |||||
} | } | ||||
protected void checkConfiguration() | protected void checkConfiguration() | ||||
throws TaskException | |||||
{ | { | ||||
super.checkConfiguration(); | super.checkConfiguration(); | ||||
if( filesets.size() == 0 ) | if( filesets.size() == 0 ) | ||||
@@ -10,6 +10,7 @@ package org.apache.tools.ant.taskdefs; | |||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.io.InputStream; | import java.io.InputStream; | ||||
import java.io.OutputStream; | import java.io.OutputStream; | ||||
import org.apache.myrmidon.api.TaskException; | |||||
/** | /** | ||||
* Used by <code>Execute</code> to handle input and output stream of | * Used by <code>Execute</code> to handle input and output stream of | ||||
@@ -19,7 +20,6 @@ import java.io.OutputStream; | |||||
*/ | */ | ||||
public interface ExecuteStreamHandler | public interface ExecuteStreamHandler | ||||
{ | { | ||||
/** | /** | ||||
* Install a handler for the input stream of the subprocess. | * Install a handler for the input stream of the subprocess. | ||||
* | * | ||||
@@ -59,5 +59,6 @@ public interface ExecuteStreamHandler | |||||
/** | /** | ||||
* Stop handling of the streams - will not be restarted. | * Stop handling of the streams - will not be restarted. | ||||
*/ | */ | ||||
void stop(); | |||||
void stop() | |||||
throws TaskException; | |||||
} | } |
@@ -12,6 +12,7 @@ import java.io.IOException; | |||||
import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||
import java.util.StringTokenizer; | import java.util.StringTokenizer; | ||||
import java.util.Vector; | import java.util.Vector; | ||||
import org.apache.myrmidon.api.TaskException; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
@@ -86,6 +87,7 @@ public class Input extends Task | |||||
* @param msg The feature to be added to the Text attribute | * @param msg The feature to be added to the Text attribute | ||||
*/ | */ | ||||
public void addText( String msg ) | public void addText( String msg ) | ||||
throws TaskException | |||||
{ | { | ||||
message += project.replaceProperties( msg ); | message += project.replaceProperties( msg ); | ||||
} | } | ||||
@@ -73,6 +73,7 @@ public class Jar extends Zip | |||||
} | } | ||||
public void setManifest( File manifestFile ) | public void setManifest( File manifestFile ) | ||||
throws TaskException | |||||
{ | { | ||||
if( !manifestFile.exists() ) | if( !manifestFile.exists() ) | ||||
{ | { | ||||
@@ -124,7 +125,7 @@ public class Jar extends Zip | |||||
} | } | ||||
public void addConfiguredManifest( Manifest newManifest ) | public void addConfiguredManifest( Manifest newManifest ) | ||||
throws ManifestException | |||||
throws ManifestException, TaskException | |||||
{ | { | ||||
if( manifest == null ) | if( manifest == null ) | ||||
{ | { | ||||
@@ -265,7 +266,7 @@ public class Jar extends Zip | |||||
} | } | ||||
protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// If the file being added is META-INF/MANIFEST.MF, we warn if it's not the | // If the file being added is META-INF/MANIFEST.MF, we warn if it's not the | ||||
// one specified in the "manifest" attribute - or if it's being added twice, | // one specified in the "manifest" attribute - or if it's being added twice, | ||||
@@ -284,7 +285,7 @@ public class Jar extends Zip | |||||
} | } | ||||
protected void zipFile( InputStream is, ZipOutputStream zOut, String vPath, long lastModified ) | protected void zipFile( InputStream is, ZipOutputStream zOut, String vPath, long lastModified ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// If the file being added is META-INF/MANIFEST.MF, we merge it with the | // If the file being added is META-INF/MANIFEST.MF, we merge it with the | ||||
// current manifest | // current manifest | ||||
@@ -315,7 +316,7 @@ public class Jar extends Zip | |||||
* and adding it to the zip stream. | * and adding it to the zip stream. | ||||
*/ | */ | ||||
private void createIndexList( ZipOutputStream zOut ) | private void createIndexList( ZipOutputStream zOut ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||||
// encoding must be UTF8 as specified in the specs. | // encoding must be UTF8 as specified in the specs. | ||||
@@ -371,7 +372,7 @@ public class Jar extends Zip | |||||
* @exception IOException Description of Exception | * @exception IOException Description of Exception | ||||
*/ | */ | ||||
private void zipManifestEntry( InputStream is ) | private void zipManifestEntry( InputStream is ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -61,6 +61,7 @@ public class Java extends Task | |||||
* @param s The new Classpath value | * @param s The new Classpath value | ||||
*/ | */ | ||||
public void setClasspath( Path s ) | public void setClasspath( Path s ) | ||||
throws TaskException | |||||
{ | { | ||||
createClasspath().append( s ); | createClasspath().append( s ); | ||||
} | } | ||||
@@ -71,6 +72,7 @@ public class Java extends Task | |||||
* @param r The new ClasspathRef value | * @param r The new ClasspathRef value | ||||
*/ | */ | ||||
public void setClasspathRef( Reference r ) | public void setClasspathRef( Reference r ) | ||||
throws TaskException | |||||
{ | { | ||||
createClasspath().setRefid( r ); | createClasspath().setRefid( r ); | ||||
} | } | ||||
@@ -190,6 +192,7 @@ public class Java extends Task | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Path createClasspath() | public Path createClasspath() | ||||
throws TaskException | |||||
{ | { | ||||
return cmdl.createClasspath( project ).createPath(); | return cmdl.createClasspath( project ).createPath(); | ||||
} | } | ||||
@@ -94,6 +94,7 @@ public class Javac extends MatchingTask | |||||
* @param r The new BootClasspathRef value | * @param r The new BootClasspathRef value | ||||
*/ | */ | ||||
public void setBootClasspathRef( Reference r ) | public void setBootClasspathRef( Reference r ) | ||||
throws TaskException | |||||
{ | { | ||||
createBootclasspath().setRefid( r ); | createBootclasspath().setRefid( r ); | ||||
} | } | ||||
@@ -104,6 +105,7 @@ public class Javac extends MatchingTask | |||||
* @param bootclasspath The new Bootclasspath value | * @param bootclasspath The new Bootclasspath value | ||||
*/ | */ | ||||
public void setBootclasspath( Path bootclasspath ) | public void setBootclasspath( Path bootclasspath ) | ||||
throws TaskException | |||||
{ | { | ||||
if( this.bootclasspath == null ) | if( this.bootclasspath == null ) | ||||
{ | { | ||||
@@ -121,6 +123,7 @@ public class Javac extends MatchingTask | |||||
* @param classpath The new Classpath value | * @param classpath The new Classpath value | ||||
*/ | */ | ||||
public void setClasspath( Path classpath ) | public void setClasspath( Path classpath ) | ||||
throws TaskException | |||||
{ | { | ||||
if( compileClasspath == null ) | if( compileClasspath == null ) | ||||
{ | { | ||||
@@ -138,6 +141,7 @@ public class Javac extends MatchingTask | |||||
* @param r The new ClasspathRef value | * @param r The new ClasspathRef value | ||||
*/ | */ | ||||
public void setClasspathRef( Reference r ) | public void setClasspathRef( Reference r ) | ||||
throws TaskException | |||||
{ | { | ||||
createClasspath().setRefid( r ); | createClasspath().setRefid( r ); | ||||
} | } | ||||
@@ -209,6 +213,7 @@ public class Javac extends MatchingTask | |||||
* @param extdirs The new Extdirs value | * @param extdirs The new Extdirs value | ||||
*/ | */ | ||||
public void setExtdirs( Path extdirs ) | public void setExtdirs( Path extdirs ) | ||||
throws TaskException | |||||
{ | { | ||||
if( this.extdirs == null ) | if( this.extdirs == null ) | ||||
{ | { | ||||
@@ -345,6 +350,7 @@ public class Javac extends MatchingTask | |||||
* @param srcDir The new Srcdir value | * @param srcDir The new Srcdir value | ||||
*/ | */ | ||||
public void setSrcdir( Path srcDir ) | public void setSrcdir( Path srcDir ) | ||||
throws TaskException | |||||
{ | { | ||||
if( src == null ) | if( src == null ) | ||||
{ | { | ||||
@@ -649,6 +655,7 @@ public class Javac extends MatchingTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Path createBootclasspath() | public Path createBootclasspath() | ||||
throws TaskException | |||||
{ | { | ||||
if( bootclasspath == null ) | if( bootclasspath == null ) | ||||
{ | { | ||||
@@ -663,6 +670,7 @@ public class Javac extends MatchingTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Path createClasspath() | public Path createClasspath() | ||||
throws TaskException | |||||
{ | { | ||||
if( compileClasspath == null ) | if( compileClasspath == null ) | ||||
{ | { | ||||
@@ -690,6 +698,7 @@ public class Javac extends MatchingTask | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public Path createExtdirs() | public Path createExtdirs() | ||||
throws TaskException | |||||
{ | { | ||||
if( extdirs == null ) | if( extdirs == null ) | ||||
{ | { | ||||
@@ -704,6 +713,7 @@ public class Javac extends MatchingTask | |||||
* @return a nested src element. | * @return a nested src element. | ||||
*/ | */ | ||||
public Path createSrc() | public Path createSrc() | ||||
throws TaskException | |||||
{ | { | ||||
if( src == null ) | if( src == null ) | ||||
{ | { | ||||
@@ -91,6 +91,7 @@ public class Manifest extends Task | |||||
* Construct an empty manifest | * Construct an empty manifest | ||||
*/ | */ | ||||
public Manifest() | public Manifest() | ||||
throws TaskException | |||||
{ | { | ||||
mode = new Mode(); | mode = new Mode(); | ||||
mode.setValue( "replace" ); | mode.setValue( "replace" ); | ||||
@@ -244,7 +245,7 @@ public class Manifest extends Task | |||||
} | } | ||||
public void addConfiguredSection( Section section ) | public void addConfiguredSection( Section section ) | ||||
throws ManifestException | |||||
throws ManifestException, TaskException | |||||
{ | { | ||||
if( section.getName() == null ) | if( section.getName() == null ) | ||||
{ | { | ||||
@@ -360,9 +361,7 @@ public class Manifest extends Task | |||||
} | } | ||||
catch( IOException e ) | catch( IOException e ) | ||||
{ | { | ||||
throw new TaskException( "Failed to write " + manifestFile | |||||
e ); | |||||
throw new TaskException( "Failed to write " + manifestFile, e ); | |||||
} | } | ||||
finally | finally | ||||
{ | { | ||||
@@ -726,7 +725,7 @@ public class Manifest extends Task | |||||
* section. | * section. | ||||
*/ | */ | ||||
public String addAttributeAndCheck( Attribute attribute ) | public String addAttributeAndCheck( Attribute attribute ) | ||||
throws ManifestException | |||||
throws ManifestException, TaskException | |||||
{ | { | ||||
if( attribute.getName() == null || attribute.getValue() == null ) | if( attribute.getName() == null || attribute.getValue() == null ) | ||||
{ | { | ||||
@@ -773,7 +772,7 @@ public class Manifest extends Task | |||||
} | } | ||||
public void addConfiguredAttribute( Attribute attribute ) | public void addConfiguredAttribute( Attribute attribute ) | ||||
throws ManifestException | |||||
throws ManifestException, TaskException | |||||
{ | { | ||||
String check = addAttributeAndCheck( attribute ); | String check = addAttributeAndCheck( attribute ); | ||||
if( check != null ) | if( check != null ) | ||||
@@ -141,6 +141,7 @@ public abstract class MatchingTask extends Task | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
public PatternSet createPatternSet() | public PatternSet createPatternSet() | ||||
throws TaskException | |||||
{ | { | ||||
return fileset.createPatternSet(); | return fileset.createPatternSet(); | ||||
} | } | ||||
@@ -45,7 +45,8 @@ public abstract class Pack extends Task | |||||
pack(); | pack(); | ||||
} | } | ||||
protected abstract void pack(); | |||||
protected abstract void pack() | |||||
throws TaskException; | |||||
protected void zipFile( File file, OutputStream zOut ) | protected void zipFile( File file, OutputStream zOut ) | ||||
throws IOException | throws IOException | ||||
@@ -44,7 +44,8 @@ public abstract class Unpack extends Task | |||||
protected abstract String getDefaultExtension(); | protected abstract String getDefaultExtension(); | ||||
protected abstract void extract(); | |||||
protected abstract void extract() | |||||
throws TaskException; | |||||
private void createDestFile( String defaultExtension ) | private void createDestFile( String defaultExtension ) | ||||
{ | { | ||||
@@ -90,7 +90,7 @@ public class War extends Jar | |||||
} | } | ||||
protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// If the file being added is WEB-INF/web.xml, we warn if it's not the | // If the file being added is WEB-INF/web.xml, we warn if it's not the | ||||
// one specified in the "webxml" attribute - or if it's being added twice, | // one specified in the "webxml" attribute - or if it's being added twice, | ||||
@@ -71,6 +71,7 @@ public class Zip extends MatchingTask | |||||
private String encoding; | private String encoding; | ||||
protected static String[][] grabFileNames( FileScanner[] scanners ) | protected static String[][] grabFileNames( FileScanner[] scanners ) | ||||
throws TaskException | |||||
{ | { | ||||
String[][] result = new String[ scanners.length ][]; | String[][] result = new String[ scanners.length ][]; | ||||
for( int i = 0; i < scanners.length; i++ ) | for( int i = 0; i < scanners.length; i++ ) | ||||
@@ -84,11 +85,6 @@ public class Zip extends MatchingTask | |||||
return result; | return result; | ||||
} | } | ||||
protected static File[] grabFiles( FileScanner[] scanners ) | |||||
{ | |||||
return grabFiles( scanners, grabFileNames( scanners ) ); | |||||
} | |||||
protected static File[] grabFiles( FileScanner[] scanners, | protected static File[] grabFiles( FileScanner[] scanners, | ||||
String[][] fileNames ) | String[][] fileNames ) | ||||
{ | { | ||||
@@ -477,7 +473,7 @@ public class Zip extends MatchingTask | |||||
*/ | */ | ||||
protected void addFiles( FileScanner scanner, ZipOutputStream zOut, | protected void addFiles( FileScanner scanner, ZipOutputStream zOut, | ||||
String prefix, String fullpath ) | String prefix, String fullpath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
if( prefix.length() > 0 && fullpath.length() > 0 ) | if( prefix.length() > 0 && fullpath.length() > 0 ) | ||||
throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | ||||
@@ -534,7 +530,7 @@ public class Zip extends MatchingTask | |||||
* @exception IOException Description of Exception | * @exception IOException Description of Exception | ||||
*/ | */ | ||||
protected void addFiles( Vector filesets, ZipOutputStream zOut ) | protected void addFiles( Vector filesets, ZipOutputStream zOut ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
// Add each fileset in the Vector. | // Add each fileset in the Vector. | ||||
for( int i = 0; i < filesets.size(); i++ ) | for( int i = 0; i < filesets.size(); i++ ) | ||||
@@ -630,7 +626,7 @@ public class Zip extends MatchingTask | |||||
protected void addZipEntries( ZipFileSet fs, DirectoryScanner ds, | protected void addZipEntries( ZipFileSet fs, DirectoryScanner ds, | ||||
ZipOutputStream zOut, String prefix, String fullpath ) | ZipOutputStream zOut, String prefix, String fullpath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
if( prefix.length() > 0 && fullpath.length() > 0 ) | if( prefix.length() > 0 && fullpath.length() > 0 ) | ||||
throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | throw new TaskException( "Both prefix and fullpath attributes may not be set on the same fileset." ); | ||||
@@ -703,6 +699,7 @@ public class Zip extends MatchingTask | |||||
* @return true if the file is then considered up to date. | * @return true if the file is then considered up to date. | ||||
*/ | */ | ||||
protected boolean createEmptyZip( File zipFile ) | protected boolean createEmptyZip( File zipFile ) | ||||
throws TaskException | |||||
{ | { | ||||
// In this case using java.util.zip will not work | // In this case using java.util.zip will not work | ||||
// because it does not permit a zero-entry archive. | // because it does not permit a zero-entry archive. | ||||
@@ -777,7 +774,7 @@ public class Zip extends MatchingTask | |||||
protected void zipFile( InputStream in, ZipOutputStream zOut, String vPath, | protected void zipFile( InputStream in, ZipOutputStream zOut, String vPath, | ||||
long lastModified ) | long lastModified ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
ZipEntry ze = new ZipEntry( vPath ); | ZipEntry ze = new ZipEntry( vPath ); | ||||
ze.setTime( lastModified ); | ze.setTime( lastModified ); | ||||
@@ -846,7 +843,7 @@ public class Zip extends MatchingTask | |||||
} | } | ||||
protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | protected void zipFile( File file, ZipOutputStream zOut, String vPath ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
if( file.equals( zipFile ) ) | if( file.equals( zipFile ) ) | ||||
{ | { | ||||
@@ -93,6 +93,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
} | } | ||||
protected Commandline setupJavacCommand() | protected Commandline setupJavacCommand() | ||||
throws TaskException | |||||
{ | { | ||||
return setupJavacCommand( false ); | return setupJavacCommand( false ); | ||||
} | } | ||||
@@ -105,6 +106,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
protected Commandline setupJavacCommand( boolean debugLevelCheck ) | protected Commandline setupJavacCommand( boolean debugLevelCheck ) | ||||
throws TaskException | |||||
{ | { | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
setupJavacCommandlineSwitches( cmd, debugLevelCheck ); | setupJavacCommandlineSwitches( cmd, debugLevelCheck ); | ||||
@@ -112,11 +114,6 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
return cmd; | return cmd; | ||||
} | } | ||||
protected Commandline setupJavacCommandlineSwitches( Commandline cmd ) | |||||
{ | |||||
return setupJavacCommandlineSwitches( cmd, false ); | |||||
} | |||||
/** | /** | ||||
* Does the command line argument processing common to classic and modern. | * Does the command line argument processing common to classic and modern. | ||||
* Doesn't add the files to compile. | * Doesn't add the files to compile. | ||||
@@ -127,6 +124,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
*/ | */ | ||||
protected Commandline setupJavacCommandlineSwitches( Commandline cmd, | protected Commandline setupJavacCommandlineSwitches( Commandline cmd, | ||||
boolean useDebugLevel ) | boolean useDebugLevel ) | ||||
throws TaskException | |||||
{ | { | ||||
Path classpath = getCompileClasspath(); | Path classpath = getCompileClasspath(); | ||||
@@ -292,6 +290,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
protected Commandline setupModernJavacCommand() | protected Commandline setupModernJavacCommand() | ||||
throws TaskException | |||||
{ | { | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
setupModernJavacCommandlineSwitches( cmd ); | setupModernJavacCommandlineSwitches( cmd ); | ||||
@@ -308,6 +307,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
protected Commandline setupModernJavacCommandlineSwitches( Commandline cmd ) | protected Commandline setupModernJavacCommandlineSwitches( Commandline cmd ) | ||||
throws TaskException | |||||
{ | { | ||||
setupJavacCommandlineSwitches( cmd, true ); | setupJavacCommandlineSwitches( cmd, true ); | ||||
if( attributes.getSource() != null ) | if( attributes.getSource() != null ) | ||||
@@ -324,6 +324,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter | |||||
* @return The CompileClasspath value | * @return The CompileClasspath value | ||||
*/ | */ | ||||
protected Path getCompileClasspath() | protected Path getCompileClasspath() | ||||
throws TaskException | |||||
{ | { | ||||
Path classpath = new Path( project ); | Path classpath = new Path( project ); | ||||
@@ -42,6 +42,7 @@ public class Gcj extends DefaultCompilerAdapter | |||||
} | } | ||||
protected Commandline setupGCJCommand() | protected Commandline setupGCJCommand() | ||||
throws TaskException | |||||
{ | { | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
Path classpath = new Path( project ); | Path classpath = new Path( project ); | ||||
@@ -64,6 +64,7 @@ public class Kjc extends DefaultCompilerAdapter | |||||
* @return Description of the Returned Value | * @return Description of the Returned Value | ||||
*/ | */ | ||||
protected Commandline setupKjcCommand() | protected Commandline setupKjcCommand() | ||||
throws TaskException | |||||
{ | { | ||||
Commandline cmd = new Commandline(); | Commandline cmd = new Commandline(); | ||||
@@ -1064,6 +1064,7 @@ public class IContract extends MatchingTask | |||||
// make it public | // make it public | ||||
public void modify( Path path ) | public void modify( Path path ) | ||||
throws TaskException | |||||
{ | { | ||||
// depending on what compiler to use, set the includeJavaRuntime flag | // depending on what compiler to use, set the includeJavaRuntime flag | ||||
if( "jikes".equals( compiler ) ) | if( "jikes".equals( compiler ) ) | ||||
@@ -239,6 +239,7 @@ public class ReplaceRegExp extends Task | |||||
Substitution s, | Substitution s, | ||||
String input, | String input, | ||||
int options ) | int options ) | ||||
throws TaskException | |||||
{ | { | ||||
String res = input; | String res = input; | ||||
Regexp regexp = r.getRegexp( project ); | Regexp regexp = r.getRegexp( project ); | ||||
@@ -259,7 +260,7 @@ public class ReplaceRegExp extends Task | |||||
* @exception IOException Description of Exception | * @exception IOException Description of Exception | ||||
*/ | */ | ||||
protected void doReplace( File f, int options ) | protected void doReplace( File f, int options ) | ||||
throws IOException | |||||
throws IOException, TaskException | |||||
{ | { | ||||
File parentDir = new File( new File( f.getAbsolutePath() ).getParent() ); | File parentDir = new File( new File( f.getAbsolutePath() ).getParent() ); | ||||
File temp = fileUtils.createTempFile( "replace", ".txt", parentDir ); | File temp = fileUtils.createTempFile( "replace", ".txt", parentDir ); | ||||
@@ -480,6 +480,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec | |||||
* @param sourceJar java.io.File representing the produced jar file | * @param sourceJar java.io.File representing the produced jar file | ||||
*/ | */ | ||||
private void verifyBorlandJar( File sourceJar ) | private void verifyBorlandJar( File sourceJar ) | ||||
throws TaskException | |||||
{ | { | ||||
org.apache.tools.ant.taskdefs.Java javaTask = null; | org.apache.tools.ant.taskdefs.Java javaTask = null; | ||||
log( "verify " + sourceJar, Project.MSG_INFO ); | log( "verify " + sourceJar, Project.MSG_INFO ); | ||||
@@ -343,6 +343,7 @@ public class WLRun extends Task | |||||
} | } | ||||
private void executeWLS6() | private void executeWLS6() | ||||
throws TaskException | |||||
{ | { | ||||
File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL60_POLICY_FILE ); | File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL60_POLICY_FILE ); | ||||
if( !beaHome.isDirectory() ) | if( !beaHome.isDirectory() ) | ||||
@@ -747,6 +747,7 @@ public class WeblogicDeploymentTool extends GenericDeploymentTool | |||||
* @param publicId Description of Parameter | * @param publicId Description of Parameter | ||||
*/ | */ | ||||
private void buildWeblogicJar( File sourceJar, File destJar, String publicId ) | private void buildWeblogicJar( File sourceJar, File destJar, String publicId ) | ||||
throws TaskException | |||||
{ | { | ||||
org.apache.tools.ant.taskdefs.Java javaTask = null; | org.apache.tools.ant.taskdefs.Java javaTask = null; | ||||
@@ -878,10 +878,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
File genericJarFile = super.getVendorOutputJarFile( baseName ); | File genericJarFile = super.getVendorOutputJarFile( baseName ); | ||||
super.writeJar( baseName, genericJarFile, files, publicId ); | super.writeJar( baseName, genericJarFile, files, publicId ); | ||||
// create the output .jar, if required | // create the output .jar, if required | ||||
if( alwaysRebuild || isRebuildRequired( genericJarFile, jarFile ) ) | if( alwaysRebuild || isRebuildRequired( genericJarFile, jarFile ) ) | ||||
{ | { | ||||
buildWebsphereJar( genericJarFile, jarFile ); | buildWebsphereJar( genericJarFile, jarFile ); | ||||
@@ -939,6 +936,7 @@ public class WebsphereDeploymentTool extends GenericDeploymentTool | |||||
* jarfile. | * jarfile. | ||||
*/ | */ | ||||
private void buildWebsphereJar( File sourceJar, File destJar ) | private void buildWebsphereJar( File sourceJar, File destJar ) | ||||
throws TaskException | |||||
{ | { | ||||
try | try | ||||
{ | { | ||||
@@ -19,7 +19,8 @@ import org.apache.tools.ant.types.Commandline; | |||||
* | * | ||||
* @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a> | * @author Matthew Watson <a href="mailto:mattw@i3sp.com">mattw@i3sp.com</a> | ||||
*/ | */ | ||||
public class JasperC extends DefaultCompilerAdapter | |||||
public class JasperC | |||||
extends DefaultCompilerAdapter | |||||
{ | { | ||||
/* | /* | ||||
* ------------------------------------------------------------ | * ------------------------------------------------------------ | ||||
@@ -274,6 +274,7 @@ public class FileSet extends DataType implements Cloneable | |||||
} | } | ||||
catch( TaskException e ) | catch( TaskException e ) | ||||
{ | { | ||||
throw new IllegalStateException( e.getMessage() ); | |||||
} | } | ||||
} | } | ||||
@@ -108,9 +108,12 @@ public class RegularExpression extends DataType | |||||
} | } | ||||
public Regexp getRegexp( Project p ) | public Regexp getRegexp( Project p ) | ||||
throws TaskException | |||||
{ | { | ||||
if( isReference() ) | if( isReference() ) | ||||
{ | |||||
return getRef( p ).getRegexp( p ); | return getRef( p ).getRegexp( p ); | ||||
} | |||||
return this.regexp; | return this.regexp; | ||||
} | } | ||||