donaldp 01/12/15 16:38:04
Modified: proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
AntStructure.java Available.java BUnzip2.java
BZip2.java Checksum.java Chmod.java
ConditionTask.java Copy.java Cvs.java CVSPass.java
Delete.java DependSet.java Ear.java Echo.java
ExecTask.java Execute.java ExecuteJava.java
ExecuteOn.java ExecuteStreamHandler.java
ExecuteWatchdog.java Exit.java Expand.java
Filter.java FixCRLF.java GenerateKey.java Get.java
GUnzip.java GZip.java Input.java Jar.java Java.java
Javac.java Javadoc.java LogOutputStream.java
LogStreamHandler.java Manifest.java
ManifestException.java MatchingTask.java Mkdir.java
Move.java Pack.java Parallel.java Patch.java
PathConvert.java ProcessDestroyer.java
Property.java PumpStreamHandler.java Recorder.java
RecorderEntry.java Replace.java Rmic.java
SendEmail.java Sequential.java SignJar.java
Sleep.java SQLExec.java StreamPumper.java Tar.java
Touch.java Tstamp.java Unpack.java Untar.java
UpToDate.java WaitFor.java War.java
XSLTLiaison.java XSLTProcess.java Zip.java
Log:
BuildException -> TaskException
Removed uneeded imports.
Processed code through style formatter.
Revision Changes Path
1.3 +27 -25
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
Index: AntStructure.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/AntStructure.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AntStructure.java 2001/12/15 14:55:54 1.2
+++ AntStructure.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
@@ -16,7 +17,7 @@
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.IntrospectionHelper;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.TaskContainer;
@@ -26,12 +27,11 @@
* Creates a partial DTD for Ant from the currently known tasks.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class AntStructure extends Task
{
-
private final String lSep = System.getProperty( "line.separator" );
private final String BOOLEAN = "%boolean;";
@@ -53,12 +53,12 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( output == null )
{
- throw new BuildException( "output attribute is required" );
+ throw new TaskException( "output attribute is required" );
}
PrintWriter out = null;
@@ -80,24 +80,24 @@
}
printHead( out, project.getTaskDefinitions().keys(),
- project.getDataTypeDefinitions().keys() );
+ project.getDataTypeDefinitions().keys() );
printTargetDecl( out );
Enumeration dataTypes = project.getDataTypeDefinitions().keys();
while( dataTypes.hasMoreElements() )
{
- String typeName = ( String )dataTypes.nextElement();
+ String typeName = (String)dataTypes.nextElement();
printElementDecl( out, typeName,
- ( Class )project.getDataTypeDefinitions().get( typeName
) );
+
(Class)project.getDataTypeDefinitions().get( typeName ) );
}
Enumeration tasks = project.getTaskDefinitions().keys();
while( tasks.hasMoreElements() )
{
- String taskName = ( String )tasks.nextElement();
+ String taskName = (String)tasks.nextElement();
printElementDecl( out, taskName,
- ( Class )project.getTaskDefinitions().get( taskName ) );
+ (Class)project.getTaskDefinitions().get(
taskName ) );
}
printTail( out );
@@ -105,8 +105,8 @@
}
catch( IOException ioe )
{
- throw new BuildException( "Error writing " +
output.getAbsolutePath(),
- ioe );
+ throw new TaskException( "Error writing " +
output.getAbsolutePath(),
+ ioe );
}
finally
{
@@ -152,7 +152,7 @@
{
for( int i = 0; i < s.length; i++ )
{
- if( !isNmtoken( s[i] ) )
+ if( !isNmtoken( s[ i ] ) )
{
return false;
}
@@ -161,7 +161,7 @@
}
private void printElementDecl( PrintWriter out, String name, Class
element )
- throws BuildException
+ throws TaskException
{
if( visited.containsKey( name ) )
@@ -213,7 +213,7 @@
Enumeration enum = ih.getNestedElements();
while( enum.hasMoreElements() )
{
- v.addElement( ( String )enum.nextElement() );
+ v.addElement( (String)enum.nextElement() );
}
if( v.isEmpty() )
@@ -247,7 +247,7 @@
enum = ih.getAttributes();
while( enum.hasMoreElements() )
{
- String attrName = ( String )enum.nextElement();
+ String attrName = (String)enum.nextElement();
if( "id".equals( attrName ) )
continue;
@@ -267,11 +267,11 @@
try
{
EnumeratedAttribute ea =
- ( EnumeratedAttribute )type.newInstance();
+ (EnumeratedAttribute)type.newInstance();
String[] values = ea.getValues();
if( values == null
- || values.length == 0
- || !areNmtokens( values ) )
+ || values.length == 0
+ || !areNmtokens( values ) )
{
sb.append( "CDATA " );
}
@@ -284,7 +284,7 @@
{
sb.append( " | " );
}
- sb.append( values[i] );
+ sb.append( values[ i ] );
}
sb.append( ") " );
}
@@ -309,11 +309,11 @@
for( int i = 0; i < v.size(); i++ )
{
- String nestedName = ( String )v.elementAt( i );
+ String nestedName = (String)v.elementAt( i );
if( !"#PCDATA".equals( nestedName ) &&
!TASKS.equals( nestedName ) &&
!TYPES.equals( nestedName )
- )
+ )
{
printElementDecl( out, nestedName, ih.getElementType(
nestedName ) );
}
@@ -329,7 +329,7 @@
boolean first = true;
while( tasks.hasMoreElements() )
{
- String taskName = ( String )tasks.nextElement();
+ String taskName = (String)tasks.nextElement();
if( !first )
{
out.print( " | " );
@@ -345,7 +345,7 @@
first = true;
while( types.hasMoreElements() )
{
- String typeName = ( String )types.nextElement();
+ String typeName = (String)types.nextElement();
if( !first )
{
out.print( " | " );
@@ -370,7 +370,9 @@
out.println( "" );
}
- private void printTail( PrintWriter out ) { }
+ private void printTail( PrintWriter out )
+ {
+ }
private void printTargetDecl( PrintWriter out )
{
1.3 +15 -15
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java
Index: Available.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Available.java 2001/12/15 14:55:54 1.2
+++ Available.java 2001/12/16 00:38:01 1.3
@@ -6,9 +6,10 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader;
-import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.taskdefs.condition.Condition;
@@ -16,7 +17,6 @@
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
import org.apache.tools.ant.util.FileUtils;
-import org.apache.myrmidon.api.TaskException;
/**
* Will set the given property if the requested resource is available at
@@ -80,8 +80,7 @@
this.resource = resource;
}
-
- public void setType( FileDir type )
+ public void setType( FileDir type )
{
this.type = type;
}
@@ -114,7 +113,7 @@
{
if( classname == null && file == null && resource == null )
{
- throw new BuildException( "At least one of
(classname|file|resource) is required" );
+ throw new TaskException( "At least one of
(classname|file|resource) is required" );
}
if( type != null )
@@ -169,7 +168,7 @@
{
if( property == null )
{
- throw new BuildException( "property attribute is required");
+ throw new TaskException( "property attribute is required" );
}
if( eval() )
@@ -218,6 +217,7 @@
}
private boolean checkFile()
+ throws TaskException
{
if( filepath == null )
{
@@ -228,7 +228,7 @@
String[] paths = filepath.list();
for( int i = 0; i < paths.length; ++i )
{
- log( "Searching " + paths[i], Project.MSG_DEBUG );
+ log( "Searching " + paths[ i ], Project.MSG_DEBUG );
/*
* filepath can be a list of directory and/or
* file names (gen'd via <fileset>)
@@ -242,11 +242,11 @@
* simple name specified == parent of parent dir + name
*
*/
- File path = new File( paths[i] );
+ File path = new File( paths[ i ] );
// ** full-pathname specified == path in list
// ** simple name specified == path in list
- if( path.exists() && file.equals( paths[i] ) )
+ if( path.exists() && file.equals( paths[ i ] ) )
{
if( type == null )
{
@@ -254,13 +254,13 @@
return true;
}
else if( type.isDir()
- && path.isDirectory() )
+ && path.isDirectory() )
{
log( "Found directory: " + path, Project.MSG_VERBOSE
);
return true;
}
else if( type.isFile()
- && path.isFile() )
+ && path.isFile() )
{
log( "Found file: " + path, Project.MSG_VERBOSE );
return true;
@@ -273,7 +273,7 @@
File parent = fileUtils.getParentFile( path );
// ** full-pathname specified == parent dir of path in list
if( parent != null && parent.exists()
- && file.equals( parent.getAbsolutePath() ) )
+ && file.equals( parent.getAbsolutePath() ) )
{
if( type == null )
{
@@ -293,7 +293,7 @@
if( path.exists() && path.isDirectory() )
{
if( checkFile( new File( path, file ),
- file + " in " + path ) )
+ file + " in " + path ) )
{
return true;
}
@@ -303,7 +303,7 @@
if( parent != null && parent.exists() )
{
if( checkFile( new File( parent, file ),
- file + " in " + parent ) )
+ file + " in " + parent ) )
{
return true;
}
@@ -316,7 +316,7 @@
if( grandParent != null && grandParent.exists() )
{
if( checkFile( new File( grandParent, file ),
- file + " in " + grandParent ) )
+ file + " in " + grandParent ) )
{
return true;
}
1.3 +15 -10
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java
Index: BUnzip2.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BUnzip2.java 2001/12/15 14:55:54 1.2
+++ BUnzip2.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,12 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.bzip2.CBZip2InputStream;
/**
@@ -49,26 +50,26 @@
int b = bis.read();
if( b != 'B' )
{
- throw new BuildException( "Invalid bz2 file." );
+ throw new TaskException( "Invalid bz2 file." );
}
b = bis.read();
if( b != 'Z' )
{
- throw new BuildException( "Invalid bz2 file." );
+ throw new TaskException( "Invalid bz2 file." );
}
zIn = new CBZip2InputStream( bis );
- byte[] buffer = new byte[8 * 1024];
+ byte[] buffer = new byte[ 8 * 1024 ];
int count = 0;
do
{
out.write( buffer, 0, count );
count = zIn.read( buffer, 0, buffer.length );
- }while ( count != -1 );
+ } while( count != -1 );
}
catch( IOException ioe )
{
String msg = "Problem expanding bzip2 " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ throw new TaskException( msg, ioe );
}
finally
{
@@ -79,7 +80,8 @@
bis.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
if( fis != null )
{
@@ -88,7 +90,8 @@
fis.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
if( out != null )
{
@@ -97,7 +100,8 @@
out.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
if( zIn != null )
{
@@ -106,7 +110,8 @@
zIn.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
}
}
1.3 +5 -4
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BZip2.java
Index: BZip2.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BZip2.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BZip2.java 2001/12/15 14:55:54 1.2
+++ BZip2.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,11 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Pack;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.bzip2.CBZip2OutputStream;
/**
@@ -37,7 +37,7 @@
catch( IOException ioe )
{
String msg = "Problem creating bzip2 " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ throw new TaskException( msg, ioe );
}
finally
{
@@ -49,7 +49,8 @@
zOut.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
1.3 +32 -31
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java
Index: Checksum.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Checksum.java 2001/12/15 14:55:54 1.2
+++ Checksum.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -19,13 +20,11 @@
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.taskdefs.condition.Condition;
import org.apache.tools.ant.types.FileSet;
-import org.apache.myrmidon.api.TaskException;
/**
* This task can be used to create checksums for files. It can also be used
to
@@ -169,10 +168,10 @@
*
* @return Returns true if the checksum verification test passed, false
* otherwise.
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public boolean eval()
- throws BuildException
+ throws TaskException
{
isCondition = true;
return validateAndExecute();
@@ -181,16 +180,16 @@
/**
* Calculate the checksum(s).
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
boolean value = validateAndExecute();
if( verifyProperty != null )
{
project.setNewProperty( verifyProperty,
- new Boolean( value ).toString() );
+ new Boolean( value ).toString() );
}
}
@@ -198,10 +197,10 @@
* Add key-value pair to the hashtable upon which to later operate upon.
*
* @param file The feature to be added to the ToIncludeFileMap attribute
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private void addToIncludeFileMap( File file )
- throws BuildException
+ throws TaskException
{
if( file != null )
{
@@ -218,7 +217,7 @@
else
{
log( file + " omitted as " + dest + " is up to
date.",
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
}
}
else
@@ -229,10 +228,10 @@
else
{
String message = "Could not find file "
- + file.getAbsolutePath()
- + " to generate checksum for.";
+ + file.getAbsolutePath()
+ + " to generate checksum for.";
log( message );
- throw new BuildException( message );
+ throw new TaskException( message );
}
}
}
@@ -241,27 +240,27 @@
* Generate checksum(s) using the message digest created earlier.
*
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private boolean generateChecksums()
- throws BuildException
+ throws TaskException
{
boolean checksumMatches = true;
FileInputStream fis = null;
FileOutputStream fos = null;
try
{
- for( Enumeration e = includeFileMap.keys(); e.hasMoreElements();
)
+ for( Enumeration e = includeFileMap.keys(); e.hasMoreElements();
)
{
messageDigest.reset();
- File src = ( File )e.nextElement();
+ File src = (File)e.nextElement();
if( !isCondition )
{
log( "Calculating " + algorithm + " checksum for " + src
);
}
fis = new FileInputStream( src );
DigestInputStream dis = new DigestInputStream( fis,
- messageDigest );
+ messageDigest
);
while( dis.read() != -1 )
;
dis.close();
@@ -271,7 +270,7 @@
String checksum = "";
for( int i = 0; i < fileDigest.length; i++ )
{
- String hexStr = Integer.toHexString( 0x00ff &
fileDigest[i] );
+ String hexStr = Integer.toHexString( 0x00ff &
fileDigest[ i ] );
if( hexStr.length() < 2 )
{
checksum += "0";
@@ -282,7 +281,7 @@
Object destination = includeFileMap.get( src );
if( destination instanceof java.lang.String )
{
- String prop = ( String )destination;
+ String prop = (String)destination;
if( isCondition )
{
checksumMatches = checksum.equals( property );
@@ -296,7 +295,7 @@
{
if( isCondition )
{
- File existingFile = ( File )destination;
+ File existingFile = (File)destination;
if( existingFile.exists() &&
existingFile.length() == checksum.length() )
{
@@ -318,7 +317,7 @@
}
else
{
- File dest = ( File )destination;
+ File dest = (File)destination;
fos = new FileOutputStream( dest );
fos.write( checksum.getBytes() );
fos.close();
@@ -329,7 +328,7 @@
}
catch( Exception e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
finally
{
@@ -340,7 +339,8 @@
fis.close();
}
catch( IOException e )
- {}
+ {
+ }
}
if( fos != null )
{
@@ -349,7 +349,8 @@
fos.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
return checksumMatches;
@@ -359,10 +360,10 @@
* Validate attributes and get down to business.
*
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private boolean validateAndExecute()
- throws BuildException
+ throws TaskException
{
if( file == null && filesets.size() == 0 )
@@ -466,7 +467,7 @@
if( messageDigest == null )
{
- throw new BuildException( "Unable to create Message Digest" );
+ throw new TaskException( "Unable to create Message Digest" );
}
addToIncludeFileMap( file );
@@ -474,12 +475,12 @@
int sizeofFileSet = filesets.size();
for( int i = 0; i < sizeofFileSet; i++ )
{
- FileSet fs = ( FileSet )filesets.elementAt( i );
+ FileSet fs = (FileSet)filesets.elementAt( i );
DirectoryScanner ds = fs.getDirectoryScanner( project );
String[] srcFiles = ds.getIncludedFiles();
for( int j = 0; j < srcFiles.length; j++ )
{
- File src = new File( fs.getDir( project ), srcFiles[j] );
+ File src = new File( fs.getDir( project ), srcFiles[ j ] );
addToIncludeFileMap( src );
}
}
1.3 +8 -9
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Chmod.java
Index: Chmod.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Chmod.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Chmod.java 2001/12/15 14:55:54 1.2
+++ Chmod.java 2001/12/16 00:38:01 1.3
@@ -6,14 +6,14 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.IOException;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Os;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
-
/**
* Chmod equivalent for unix-like environments.
*
@@ -40,7 +40,7 @@
public void setCommand( String e )
{
- throw new BuildException( taskType + " doesn\'t support the command
attribute" );
+ throw new TaskException( taskType + " doesn\'t support the command
attribute" );
}
/**
@@ -72,10 +72,9 @@
defaultSet.setExcludes( excludes );
}
-
public void setExecutable( String e )
{
- throw new BuildException( taskType + " doesn\'t support the
executable attribute" );
+ throw new TaskException( taskType + " doesn\'t support the
executable attribute" );
}
public void setFile( File src )
@@ -106,7 +105,7 @@
public void setSkipEmptyFilesets( boolean skip )
{
- throw new BuildException( taskType + " doesn\'t support the
skipemptyfileset attribute" );
+ throw new TaskException( taskType + " doesn\'t support the
skipemptyfileset attribute" );
}
/**
@@ -143,7 +142,7 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( defaultSetDefined || defaultSet.getDir( project ) == null )
{
@@ -161,7 +160,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Execute failed: " + e, e );
+ throw new TaskException( "Execute failed: " + e, e );
}
finally
{
@@ -180,7 +179,7 @@
{
if( !havePerm )
{
- throw new BuildException( "Required attribute perm not set in
chmod" );
+ throw new TaskException( "Required attribute perm not set in
chmod" );
}
if( defaultSetDefined && defaultSet.getDir( project ) != null )
1.3 +5 -5
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java
Index: ConditionTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ConditionTask.java 2001/12/15 14:55:54 1.2
+++ ConditionTask.java 2001/12/16 00:38:01 1.3
@@ -6,10 +6,10 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.BuildException;
+
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.taskdefs.condition.Condition;
import org.apache.tools.ant.taskdefs.condition.ConditionBase;
-import org.apache.myrmidon.api.TaskException;
/**
* <condition> task as a generalization of <available> and
@@ -21,7 +21,7 @@
* This task does not extend Task to take advantage of ConditionBase.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class ConditionTask extends ConditionBase
{
@@ -54,7 +54,7 @@
/**
* See whether our nested condition holds and set the property.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
* @since 1.1
*/
public void execute()
@@ -68,7 +68,7 @@
{
throw new TaskException( "You must nest a condition into
<condition>" );
}
- Condition c = ( Condition )getConditions().nextElement();
+ Condition c = (Condition)getConditions().nextElement();
if( c.eval() )
{
getProject().setNewProperty( property, value );
1.3 +6 -7
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Copy.java
Index: Copy.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Copy.java 2001/12/15 14:55:54 1.2
+++ Copy.java 2001/12/16 00:38:01 1.3
@@ -13,7 +13,6 @@
import java.util.Hashtable;
import java.util.Vector;
import org.apache.myrmidon.api.TaskException;
-import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -195,14 +194,14 @@
* Defines the FileNameMapper to use (nested mapper element).
*
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public Mapper createMapper()
- throws BuildException
+ throws TaskException
{
if( mapperElement != null )
{
- throw new BuildException( "Cannot define more than one mapper" );
+ throw new TaskException( "Cannot define more than one mapper" );
}
mapperElement = new Mapper( project );
return mapperElement;
@@ -211,7 +210,7 @@
/**
* Performs the copy operation.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
throws TaskException
@@ -369,7 +368,7 @@
{
String msg = "Failed to copy " + fromFile + " to " +
toFile
+ " due to " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ throw new TaskException( msg, ioe );
}
}
}
@@ -445,7 +444,7 @@
* Ensure we have a consistent and legal set of attributes, and set any
* internal flags necessary based on different combinations of
attributes.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected void validateAttributes()
throws TaskException
1.3 +0 -2
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Cvs.java
Index: Cvs.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Cvs.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Cvs.java 2001/12/15 14:55:54 1.2
+++ Cvs.java 2001/12/16 00:38:01 1.3
@@ -14,7 +14,6 @@
import java.io.OutputStream;
import java.io.PrintStream;
import org.apache.myrmidon.api.TaskException;
-import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline;
@@ -189,7 +188,6 @@
public void execute()
throws TaskException
{
-
// XXX: we should use JCVS (www.ice.com/JCVS) instead of command line
// execution so that we don't rely on having native CVS stuff around
(SM)
1.3 +7 -7
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/CVSPass.java
Index: CVSPass.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/CVSPass.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CVSPass.java 2001/12/15 14:55:54 1.2
+++ CVSPass.java 2001/12/16 00:38:01 1.3
@@ -6,21 +6,21 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
import org.apache.myrmidon.api.TaskException;
+import org.apache.tools.ant.Task;
/**
* CVSLogin Adds an new entry to a CVS password file
*
* @author <a href="[EMAIL PROTECTED]">Jeff Martin</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public class CVSPass extends Task
{
@@ -100,10 +100,10 @@
/**
* Does the work.
*
- * @exception BuildException if someting goes wrong with the build
+ * @exception TaskException if someting goes wrong with the build
*/
public final void execute()
- throws BuildException
+ throws TaskException
{
if( cvsRoot == null )
throw new TaskException( "cvsroot is required" );
@@ -148,7 +148,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
@@ -158,7 +158,7 @@
StringBuffer buf = new StringBuffer();
for( int i = 0; i < password.length(); i++ )
{
- buf.append( shifts[password.charAt( i )] );
+ buf.append( shifts[ password.charAt( i ) ] );
}
return buf.toString();
}
1.3 +32 -32
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Delete.java
Index: Delete.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Delete.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Delete.java 2001/12/15 14:55:54 1.2
+++ Delete.java 2001/12/16 00:38:01 1.3
@@ -6,9 +6,10 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet;
@@ -109,7 +110,6 @@
this.file = file;
}
-
/**
* Used to delete empty directories.
*
@@ -225,10 +225,10 @@
/**
* Delete the file(s).
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
if( usedMatchingTask )
{
@@ -237,12 +237,12 @@
if( file == null && dir == null && filesets.size() == 0 )
{
- throw new BuildException( "At least one of the file or dir
attributes, or a fileset element, must be set." );
+ throw new TaskException( "At least one of the file or dir
attributes, or a fileset element, must be set." );
}
if( quiet && failonerror )
{
- throw new BuildException( "quiet and failonerror cannot both be
set to true" );
+ throw new TaskException( "quiet and failonerror cannot both be
set to true" );
}
// delete the single file
@@ -262,17 +262,17 @@
{
String message = "Unable to delete file " +
file.getAbsolutePath();
if( failonerror )
- throw new BuildException( message );
+ throw new TaskException( message );
else
log( message,
- quiet ? Project.MSG_VERBOSE :
Project.MSG_WARN );
+ quiet ? Project.MSG_VERBOSE :
Project.MSG_WARN );
}
}
}
else
{
log( "Could not find file " + file.getAbsolutePath() + " to
delete.",
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
}
}
@@ -295,7 +295,7 @@
// delete the files in the filesets
for( int i = 0; i < filesets.size(); i++ )
{
- FileSet fs = ( FileSet )filesets.elementAt( i );
+ FileSet fs = (FileSet)filesets.elementAt( i );
try
{
DirectoryScanner ds = fs.getDirectoryScanner( project );
@@ -303,7 +303,7 @@
String[] dirs = ds.getIncludedDirectories();
removeFiles( fs.getDir( project ), files, dirs );
}
- catch( BuildException be )
+ catch( TaskException be )
{
// directory doesn't exist or is not readable
if( failonerror )
@@ -313,7 +313,7 @@
else
{
log( be.getMessage(),
- quiet ? Project.MSG_VERBOSE : Project.MSG_WARN );
+ quiet ? Project.MSG_VERBOSE : Project.MSG_WARN );
}
}
}
@@ -328,7 +328,7 @@
String[] dirs = ds.getIncludedDirectories();
removeFiles( dir, files, dirs );
}
- catch( BuildException be )
+ catch( TaskException be )
{
// directory doesn't exist or is not readable
if( failonerror )
@@ -338,24 +338,24 @@
else
{
log( be.getMessage(),
- quiet ? Project.MSG_VERBOSE : Project.MSG_WARN );
+ quiet ? Project.MSG_VERBOSE : Project.MSG_WARN );
}
}
}
}
-//************************************************************************
-// protected and private methods
-//************************************************************************
+
//************************************************************************
+ // protected and private methods
+
//************************************************************************
protected void removeDir( File d )
{
String[] list = d.list();
if( list == null )
- list = new String[0];
+ list = new String[ 0 ];
for( int i = 0; i < list.length; i++ )
{
- String s = list[i];
+ String s = list[ i ];
File f = new File( d, s );
if( f.isDirectory() )
{
@@ -368,10 +368,10 @@
{
String message = "Unable to delete file " +
f.getAbsolutePath();
if( failonerror )
- throw new BuildException( message );
+ throw new TaskException( message );
else
log( message,
- quiet ? Project.MSG_VERBOSE : Project.MSG_WARN );
+ quiet ? Project.MSG_VERBOSE : Project.MSG_WARN
);
}
}
}
@@ -380,10 +380,10 @@
{
String message = "Unable to delete directory " +
dir.getAbsolutePath();
if( failonerror )
- throw new BuildException( message );
+ throw new TaskException( message );
else
log( message,
- quiet ? Project.MSG_VERBOSE : Project.MSG_WARN );
+ quiet ? Project.MSG_VERBOSE : Project.MSG_WARN );
}
}
@@ -402,16 +402,16 @@
log( "Deleting " + files.length + " files from " +
d.getAbsolutePath() );
for( int j = 0; j < files.length; j++ )
{
- File f = new File( d, files[j] );
+ File f = new File( d, files[ j ] );
log( "Deleting " + f.getAbsolutePath(), verbosity );
if( !f.delete() )
{
String message = "Unable to delete file " +
f.getAbsolutePath();
if( failonerror )
- throw new BuildException( message );
+ throw new TaskException( message );
else
log( message,
- quiet ? Project.MSG_VERBOSE : Project.MSG_WARN );
+ quiet ? Project.MSG_VERBOSE : Project.MSG_WARN
);
}
}
}
@@ -421,7 +421,7 @@
int dirCount = 0;
for( int j = dirs.length - 1; j >= 0; j-- )
{
- File dir = new File( d, dirs[j] );
+ File dir = new File( d, dirs[ j ] );
String[] dirFiles = dir.list();
if( dirFiles == null || dirFiles.length == 0 )
{
@@ -429,12 +429,12 @@
if( !dir.delete() )
{
String message = "Unable to delete directory "
- + dir.getAbsolutePath();
+ + dir.getAbsolutePath();
if( failonerror )
- throw new BuildException( message );
+ throw new TaskException( message );
else
log( message,
- quiet ? Project.MSG_VERBOSE :
Project.MSG_WARN );
+ quiet ? Project.MSG_VERBOSE :
Project.MSG_WARN );
}
else
{
@@ -446,8 +446,8 @@
if( dirCount > 0 )
{
log( "Deleted " + dirCount + " director" +
- ( dirCount == 1 ? "y" : "ies" ) +
- " from " + d.getAbsolutePath() );
+ ( dirCount == 1 ? "y" : "ies" ) +
+ " from " + d.getAbsolutePath() );
}
}
}
1.2 +36 -35
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java
Index: DependSet.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DependSet.java 2001/12/15 12:06:21 1.1
+++ DependSet.java 2001/12/16 00:38:01 1.2
@@ -6,14 +6,15 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.util.Date;
import java.util.Enumeration;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.framework.Os;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
-import org.apache.myrmidon.framework.Os;
import org.apache.tools.ant.types.FileList;
import org.apache.tools.ant.types.FileSet;
@@ -59,7 +60,7 @@
*
*
* @author <a href="mailto:[EMAIL PROTECTED]">Craeg Strong</a>
- * @version $Revision: 1.1 $ $Date: 2001/12/15 12:06:21 $
+ * @version $Revision: 1.2 $ $Date: 2001/12/16 00:38:01 $
*/
public class DependSet extends MatchingTask
{
@@ -72,7 +73,9 @@
/**
* Creates a new DependSet Task.
*/
- public DependSet() { }
+ public DependSet()
+ {
+ }
/**
* Nested <srcfilelist> element.
@@ -117,21 +120,19 @@
/**
* Executes the task.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
-
public void execute()
- throws BuildException
+ throws TaskException
{
-
if( ( sourceFileSets.size() == 0 ) && ( sourceFileLists.size() == 0
) )
{
- throw new BuildException( "At least one <srcfileset> or
<srcfilelist> element must be set" );
+ throw new TaskException( "At least one <srcfileset> or
<srcfilelist> element must be set" );
}
if( ( targetFileSets.size() == 0 ) && ( targetFileLists.size() == 0
) )
{
- throw new BuildException( "At least one <targetfileset> or
<targetfilelist> element must be set" );
+ throw new TaskException( "At least one <targetfileset> or
<targetfilelist> element must be set" );
}
long now = ( new Date() ).getTime();
@@ -153,20 +154,20 @@
while( enumTargetSets.hasMoreElements() )
{
- FileSet targetFS = ( FileSet )enumTargetSets.nextElement();
+ FileSet targetFS = (FileSet)enumTargetSets.nextElement();
DirectoryScanner targetDS = targetFS.getDirectoryScanner(
project );
String[] targetFiles = targetDS.getIncludedFiles();
for( int i = 0; i < targetFiles.length; i++ )
{
- File dest = new File( targetFS.getDir( project ),
targetFiles[i] );
+ File dest = new File( targetFS.getDir( project ),
targetFiles[ i ] );
allTargets.addElement( dest );
if( dest.lastModified() > now )
{
- log( "Warning: " + targetFiles[i] + " modified in the
future.",
- Project.MSG_WARN );
+ log( "Warning: " + targetFiles[ i ] + " modified in the
future.",
+ Project.MSG_WARN );
}
}
}
@@ -179,16 +180,16 @@
while( enumTargetLists.hasMoreElements() )
{
- FileList targetFL = ( FileList )enumTargetLists.nextElement();
+ FileList targetFL = (FileList)enumTargetLists.nextElement();
String[] targetFiles = targetFL.getFiles( project );
for( int i = 0; i < targetFiles.length; i++ )
{
- File dest = new File( targetFL.getDir( project ),
targetFiles[i] );
+ File dest = new File( targetFL.getDir( project ),
targetFiles[ i ] );
if( !dest.exists() )
{
- log( targetFiles[i] + " does not exist.",
Project.MSG_VERBOSE );
+ log( targetFiles[ i ] + " does not exist.",
Project.MSG_VERBOSE );
upToDate = false;
continue;
}
@@ -198,8 +199,8 @@
}
if( dest.lastModified() > now )
{
- log( "Warning: " + targetFiles[i] + " modified in the
future.",
- Project.MSG_WARN );
+ log( "Warning: " + targetFiles[ i ] + " modified in the
future.",
+ Project.MSG_WARN );
}
}
}
@@ -213,29 +214,29 @@
while( upToDate && enumSourceSets.hasMoreElements() )
{
- FileSet sourceFS = ( FileSet )enumSourceSets.nextElement();
+ FileSet sourceFS = (FileSet)enumSourceSets.nextElement();
DirectoryScanner sourceDS = sourceFS.getDirectoryScanner(
project );
String[] sourceFiles = sourceDS.getIncludedFiles();
for( int i = 0; upToDate && i < sourceFiles.length; i++ )
{
- File src = new File( sourceFS.getDir( project ),
sourceFiles[i] );
+ File src = new File( sourceFS.getDir( project ),
sourceFiles[ i ] );
if( src.lastModified() > now )
{
- log( "Warning: " + sourceFiles[i] + " modified in
the future.",
- Project.MSG_WARN );
+ log( "Warning: " + sourceFiles[ i ] + " modified in
the future.",
+ Project.MSG_WARN );
}
Enumeration enumTargets = allTargets.elements();
while( upToDate && enumTargets.hasMoreElements() )
{
- File dest = ( File )enumTargets.nextElement();
+ File dest = (File)enumTargets.nextElement();
if( src.lastModified() > dest.lastModified() )
{
log( dest.getPath() + " is out of date with
respect to " +
- sourceFiles[i], Project.MSG_VERBOSE );
+ sourceFiles[ i ], Project.MSG_VERBOSE );
upToDate = false;
}
@@ -253,23 +254,23 @@
while( upToDate && enumSourceLists.hasMoreElements() )
{
- FileList sourceFL = ( FileList
)enumSourceLists.nextElement();
+ FileList sourceFL = (FileList)enumSourceLists.nextElement();
String[] sourceFiles = sourceFL.getFiles( project );
int i = 0;
do
{
- File src = new File( sourceFL.getDir( project ),
sourceFiles[i] );
+ File src = new File( sourceFL.getDir( project ),
sourceFiles[ i ] );
if( src.lastModified() > now )
{
- log( "Warning: " + sourceFiles[i] + " modified in
the future.",
- Project.MSG_WARN );
+ log( "Warning: " + sourceFiles[ i ] + " modified in
the future.",
+ Project.MSG_WARN );
}
if( !src.exists() )
{
- log( sourceFiles[i] + " does not exist.",
Project.MSG_VERBOSE );
+ log( sourceFiles[ i ] + " does not exist.",
Project.MSG_VERBOSE );
upToDate = false;
break;
}
@@ -278,26 +279,26 @@
while( upToDate && enumTargets.hasMoreElements() )
{
- File dest = ( File )enumTargets.nextElement();
+ File dest = (File)enumTargets.nextElement();
if( src.lastModified() > dest.lastModified() )
{
log( dest.getPath() + " is out of date with
respect to " +
- sourceFiles[i], Project.MSG_VERBOSE );
+ sourceFiles[ i ], Project.MSG_VERBOSE );
upToDate = false;
}
}
- }while ( upToDate && ( ++i < sourceFiles.length ) );
+ } while( upToDate && ( ++i < sourceFiles.length ) );
}
}
if( !upToDate )
{
log( "Deleting all target files. ", Project.MSG_VERBOSE );
- for( Enumeration e = allTargets.elements(); e.hasMoreElements();
)
+ for( Enumeration e = allTargets.elements(); e.hasMoreElements();
)
{
- File fileToRemove = ( File )e.nextElement();
+ File fileToRemove = (File)e.nextElement();
log( "Deleting file " + fileToRemove.getAbsolutePath(),
Project.MSG_VERBOSE );
fileToRemove.delete();
}
1.3 +6 -7
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java
Index: Ear.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Ear.java 2001/12/15 14:55:54 1.2
+++ Ear.java 2001/12/16 00:38:01 1.3
@@ -6,14 +6,14 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.IOException;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.ZipFileSet;
import org.apache.tools.zip.ZipOutputStream;
-
/**
* Creates a EAR archive. Based on WAR task
*
@@ -37,7 +37,7 @@
{
deploymentDescriptor = descr;
if( !deploymentDescriptor.exists() )
- throw new BuildException( "Deployment descriptor: " +
deploymentDescriptor + " does not exist." );
+ throw new TaskException( "Deployment descriptor: " +
deploymentDescriptor + " does not exist." );
// Create a ZipFileSet for this file, and pass it up.
ZipFileSet fs = new ZipFileSet();
@@ -66,14 +66,13 @@
super.cleanUp();
}
-
protected void initZipOutputStream( ZipOutputStream zOut )
- throws IOException, BuildException
+ throws IOException, TaskException
{
// If no webxml file is specified, it's an error.
if( deploymentDescriptor == null && !isInUpdateMode() )
{
- throw new BuildException( "appxml attribute is required" );
+ throw new TaskException( "appxml attribute is required" );
}
super.initZipOutputStream( zOut );
@@ -91,7 +90,7 @@
if( deploymentDescriptor == null ||
!deploymentDescriptor.equals( file ) || descriptorAdded )
{
log( "Warning: selected " + archiveType + " files include a
META-INF/application.xml which will be ignored " +
- "(please use appxml attribute to " + archiveType + "
task)", Project.MSG_WARN );
+ "(please use appxml attribute to " + archiveType + "
task)", Project.MSG_WARN );
}
else
{
1.3 +7 -6
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Echo.java
Index: Echo.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Echo.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Echo.java 2001/12/15 14:55:54 1.2
+++ Echo.java 2001/12/16 00:38:01 1.3
@@ -6,12 +6,12 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.EnumeratedAttribute;
@@ -113,10 +113,10 @@
/**
* Does the work.
*
- * @exception BuildException if someting goes wrong with the build
+ * @exception TaskException if someting goes wrong with the build
*/
public void execute()
- throws BuildException
+ throws TaskException
{
if( file == null )
{
@@ -132,7 +132,7 @@
}
catch( IOException ioe )
{
- throw new BuildException( "Error", ioe);
+ throw new TaskException( "Error", ioe );
}
finally
{
@@ -143,7 +143,8 @@
out.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
}
}
1.3 +27 -25
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
Index: ExecTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExecTask.java 2001/12/15 14:55:54 1.2
+++ ExecTask.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -13,7 +14,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringReader;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline;
@@ -83,7 +84,7 @@
}
/**
- * Throw a BuildException if process returns non 0.
+ * Throw a TaskException if process returns non 0.
*
* @param fail The new Failonerror value
*/
@@ -189,10 +190,10 @@
/**
* Do the work.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
checkConfiguration();
if( isValidOs() )
@@ -243,7 +244,7 @@
{
if( failOnError )
{
- throw new BuildException( taskType + " returned: " + err );
+ throw new TaskException( taskType + " returned: " + err );
}
else
{
@@ -271,22 +272,22 @@
/**
* Has the user set all necessary attributes?
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected void checkConfiguration()
- throws BuildException
+ throws TaskException
{
if( cmdl.getExecutable() == null )
{
- throw new BuildException( "no executable specified" );
+ throw new TaskException( "no executable specified" );
}
if( dir != null && !dir.exists() )
{
- throw new BuildException( "The directory you specified does not
exist" );
+ throw new TaskException( "The directory you specified does not
exist" );
}
if( dir != null && !dir.isDirectory() )
{
- throw new BuildException( "The directory you specified is not a
directory" );
+ throw new TaskException( "The directory you specified is not a
directory" );
}
}
@@ -294,10 +295,10 @@
* Create the StreamHandler to use with our Execute instance.
*
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected ExecuteStreamHandler createHandler()
- throws BuildException
+ throws TaskException
{
if( out != null )
{
@@ -309,11 +310,11 @@
}
catch( FileNotFoundException fne )
{
- throw new BuildException( "Cannot write to " + out, fne );
+ throw new TaskException( "Cannot write to " + out, fne );
}
catch( IOException ioe )
{
- throw new BuildException( "Cannot write to " + out, ioe );
+ throw new TaskException( "Cannot write to " + out, ioe );
}
}
else if( outputprop != null )
@@ -325,7 +326,7 @@
else
{
return new LogStreamHandler( this,
- Project.MSG_INFO, Project.MSG_WARN );
+ Project.MSG_INFO, Project.MSG_WARN
);
}
}
@@ -333,10 +334,10 @@
* Create the Watchdog to kill a runaway process.
*
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected ExecuteWatchdog createWatchdog()
- throws BuildException
+ throws TaskException
{
if( timeout == null )
return null;
@@ -356,7 +357,8 @@
baos.close();
}
catch( IOException io )
- {}
+ {
+ }
}
/**
@@ -378,10 +380,10 @@
* Create an Execute instance with the correct working directory set.
*
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected Execute prepareExec()
- throws BuildException
+ throws TaskException
{
// default directory to the project's base directory
if( dir == null )
@@ -398,8 +400,8 @@
{
for( int i = 0; i < environment.length; i++ )
{
- log( "Setting environment variable: " + environment[i],
- Project.MSG_VERBOSE );
+ log( "Setting environment variable: " + environment[ i ],
+ Project.MSG_VERBOSE );
}
}
exe.setNewenvironment( newEnvironment );
@@ -412,10 +414,10 @@
* by subclasses
*
* @param exe Description of Parameter
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected void runExec( Execute exe )
- throws BuildException
+ throws TaskException
{
exe.setCommandline( cmdl.getCommandline() );
try
@@ -426,7 +428,7 @@
{
if( failIfExecFails )
{
- throw new BuildException( "Execute failed: " + e.toString(),
e );
+ throw new TaskException( "Execute failed: " + e.toString(),
e );
}
else
{
1.4 +9 -10
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Execute.java
Index: Execute.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Execute.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Execute.java 2001/12/15 15:20:23 1.3
+++ Execute.java 2001/12/16 00:38:01 1.4
@@ -18,11 +18,10 @@
import java.util.Vector;
import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Os;
-import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
-import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.types.Commandline;
+import org.apache.tools.ant.util.FileUtils;
/**
* Runs an external program.
@@ -245,10 +244,10 @@
*
* @param task The task that the command is part of. Used for logging
* @param cmdline The command to execute.
- * @throws BuildException if the command does not return 0.
+ * @throws TaskException if the command does not return 0.
*/
public static void runCommand( Task task, String[] cmdline )
- throws BuildException
+ throws TaskException
{
try
{
@@ -261,12 +260,12 @@
int retval = exe.execute();
if( retval != 0 )
{
- throw new BuildException( cmdline[ 0 ] + " failed with
return code " + retval );
+ throw new TaskException( cmdline[ 0 ] + " failed with return
code " + retval );
}
}
catch( java.io.IOException exc )
{
- throw new BuildException( "Could not launch " + cmdline[ 0 ] +
": " + exc );
+ throw new TaskException( "Could not launch " + cmdline[ 0 ] + ":
" + exc );
}
}
@@ -322,10 +321,10 @@
* Set the name of the antRun script using the project's value.
*
* @param project the current project.
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void setAntRun( Project project )
- throws BuildException
+ throws TaskException
{
this.project = project;
}
@@ -707,13 +706,13 @@
}
else
{
- throw new BuildException( "Unable to execute command",
realexc );
+ throw new TaskException( "Unable to execute command",
realexc );
}
}
catch( Exception exc )
{
// IllegalAccess, IllegalArgument, ClassCast
- throw new BuildException( "Unable to execute command", exc );
+ throw new TaskException( "Unable to execute command", exc );
}
}
}
1.3 +9 -8
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
Index: ExecuteJava.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExecuteJava.java 2001/12/15 14:55:54 1.2
+++ ExecuteJava.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,11 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
-import java.io.PrintStream;
+
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader;
-import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.CommandlineJava;
@@ -20,6 +20,7 @@
* @author [EMAIL PROTECTED]
* @author <a href="mailto:[EMAIL PROTECTED]">Stefan Bodewig</a>
*/
+
public class ExecuteJava
{
@@ -43,7 +44,7 @@
}
public void execute( Project project )
- throws BuildException
+ throws TaskException
{
final String classname = javaCommand.getExecutable();
final Object[] argument = {javaCommand.getArguments()};
@@ -75,27 +76,27 @@
}
catch( NullPointerException e )
{
- throw new BuildException( "Could not find main() method in " +
classname );
+ throw new TaskException( "Could not find main() method in " +
classname );
}
catch( ClassNotFoundException e )
{
- throw new BuildException( "Could not find " + classname + ".
Make sure you have it in your classpath" );
+ throw new TaskException( "Could not find " + classname + ". Make
sure you have it in your classpath" );
}
catch( InvocationTargetException e )
{
Throwable t = e.getTargetException();
if( !( t instanceof SecurityException ) )
{
- throw new BuildException( "Error", t );
+ throw new TaskException( "Error", t );
}
else
{
- throw ( SecurityException )t;
+ throw (SecurityException)t;
}
}
catch( Exception e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
finally
{
1.3 +47 -47
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
Index: ExecuteOn.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ExecuteOn.java 2001/12/15 14:55:54 1.2
+++ ExecuteOn.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,12 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Commandline;
@@ -55,7 +56,6 @@
this.destDir = destDir;
}
-
/**
* Shall the command work on all specified files in parallel?
*
@@ -110,14 +110,14 @@
* Defines the FileNameMapper to use (nested mapper element).
*
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public Mapper createMapper()
- throws BuildException
+ throws TaskException
{
if( mapperElement != null )
{
- throw new BuildException( "Cannot define more than one mapper" );
+ throw new TaskException( "Cannot define more than one mapper" );
}
mapperElement = new Mapper( project );
return mapperElement;
@@ -133,7 +133,7 @@
{
if( srcFilePos != null )
{
- throw new BuildException( taskType + " doesn\'t support multiple
srcfile elements." );
+ throw new TaskException( taskType + " doesn\'t support multiple
srcfile elements." );
}
srcFilePos = cmdl.createMarker();
return srcFilePos;
@@ -149,7 +149,7 @@
{
if( targetFilePos != null )
{
- throw new BuildException( taskType + " doesn\'t support multiple
targetfile elements." );
+ throw new TaskException( taskType + " doesn\'t support multiple
targetfile elements." );
}
targetFilePos = cmdl.createMarker();
srcIsFirst = ( srcFilePos != null );
@@ -171,7 +171,7 @@
Hashtable addedFiles = new Hashtable();
for( int i = 0; i < srcFiles.length; i++ )
{
- String[] subTargets = mapper.mapFileName( srcFiles[i] );
+ String[] subTargets = mapper.mapFileName( srcFiles[ i ] );
if( subTargets != null )
{
for( int j = 0; j < subTargets.length; j++ )
@@ -180,11 +180,11 @@
if( !relative )
{
name =
- ( new File( destDir, subTargets[j] )
).getAbsolutePath();
+ ( new File( destDir, subTargets[ j ] )
).getAbsolutePath();
}
else
{
- name = subTargets[j];
+ name = subTargets[ j ];
}
if( !addedFiles.contains( name ) )
{
@@ -195,11 +195,11 @@
}
}
}
- String[] targetFiles = new String[targets.size()];
+ String[] targetFiles = new String[ targets.size() ];
targets.copyInto( targetFiles );
String[] orig = cmdl.getCommandline();
- String[] result = new String[orig.length + srcFiles.length +
targetFiles.length];
+ String[] result = new String[ orig.length + srcFiles.length +
targetFiles.length ];
int srcIndex = orig.length;
if( srcFilePos != null )
@@ -212,7 +212,7 @@
int targetIndex = targetFilePos.getPosition();
if( srcIndex < targetIndex
- || ( srcIndex == targetIndex && srcIsFirst ) )
+ || ( srcIndex == targetIndex && srcIsFirst ) )
{
// 0 --> srcIndex
@@ -220,18 +220,18 @@
// srcIndex --> targetIndex
System.arraycopy( orig, srcIndex, result,
- srcIndex + srcFiles.length,
- targetIndex - srcIndex );
+ srcIndex + srcFiles.length,
+ targetIndex - srcIndex );
// targets are already absolute file names
System.arraycopy( targetFiles, 0, result,
- targetIndex + srcFiles.length,
- targetFiles.length );
+ targetIndex + srcFiles.length,
+ targetFiles.length );
// targetIndex --> end
System.arraycopy( orig, targetIndex, result,
- targetIndex + srcFiles.length + targetFiles.length,
- orig.length - targetIndex );
+ targetIndex + srcFiles.length +
targetFiles.length,
+ orig.length - targetIndex );
}
else
{
@@ -240,18 +240,18 @@
// targets are already absolute file names
System.arraycopy( targetFiles, 0, result,
- targetIndex,
- targetFiles.length );
+ targetIndex,
+ targetFiles.length );
// targetIndex --> srcIndex
System.arraycopy( orig, targetIndex, result,
- targetIndex + targetFiles.length,
- srcIndex - targetIndex );
+ targetIndex + targetFiles.length,
+ srcIndex - targetIndex );
// srcIndex --> end
System.arraycopy( orig, srcIndex, result,
- srcIndex + srcFiles.length + targetFiles.length,
- orig.length - srcIndex );
+ srcIndex + srcFiles.length +
targetFiles.length,
+ orig.length - srcIndex );
srcIndex += targetFiles.length;
}
@@ -263,8 +263,8 @@
System.arraycopy( orig, 0, result, 0, srcIndex );
// srcIndex --> end
System.arraycopy( orig, srcIndex, result,
- srcIndex + srcFiles.length,
- orig.length - srcIndex );
+ srcIndex + srcFiles.length,
+ orig.length - srcIndex );
}
@@ -273,12 +273,12 @@
{
if( !relative )
{
- result[srcIndex + i] =
- ( new File( baseDirs[i], srcFiles[i] )
).getAbsolutePath();
+ result[ srcIndex + i ] =
+ ( new File( baseDirs[ i ], srcFiles[ i ] )
).getAbsolutePath();
}
else
{
- result[srcIndex + i] = srcFiles[i];
+ result[ srcIndex + i ] = srcFiles[ i ];
}
}
return result;
@@ -310,7 +310,7 @@
{
SourceFileScanner sfs = new SourceFileScanner( this );
return sfs.restrict( ds.getIncludedDirectories(), baseDir,
destDir,
- mapper );
+ mapper );
}
else
{
@@ -332,7 +332,7 @@
{
SourceFileScanner sfs = new SourceFileScanner( this );
return sfs.restrict( ds.getIncludedFiles(), baseDir, destDir,
- mapper );
+ mapper );
}
else
{
@@ -345,27 +345,27 @@
super.checkConfiguration();
if( filesets.size() == 0 )
{
- throw new BuildException( "no filesets specified" );
+ throw new TaskException( "no filesets specified" );
}
if( targetFilePos != null || mapperElement != null
- || destDir != null )
+ || destDir != null )
{
if( mapperElement == null )
{
- throw new BuildException( "no mapper specified" );
+ throw new TaskException( "no mapper specified" );
}
if( mapperElement == null )
{
- throw new BuildException( "no dest attribute specified" );
+ throw new TaskException( "no dest attribute specified" );
}
mapper = mapperElement.getImplementation();
}
}
protected void runExec( Execute exe )
- throws BuildException
+ throws TaskException
{
try
{
@@ -374,7 +374,7 @@
Vector baseDirs = new Vector();
for( int i = 0; i < filesets.size(); i++ )
{
- FileSet fs = ( FileSet )filesets.elementAt( i );
+ FileSet fs = (FileSet)filesets.elementAt( i );
File base = fs.getDir( project );
DirectoryScanner ds = fs.getDirectoryScanner( project );
@@ -383,7 +383,7 @@
String[] s = getFiles( base, ds );
for( int j = 0; j < s.length; j++ )
{
- fileNames.addElement( s[j] );
+ fileNames.addElement( s[ j ] );
baseDirs.addElement( base );
}
}
@@ -394,7 +394,7 @@
;
for( int j = 0; j < s.length; j++ )
{
- fileNames.addElement( s[j] );
+ fileNames.addElement( s[ j ] );
baseDirs.addElement( base );
}
}
@@ -408,13 +408,13 @@
if( !parallel )
{
- String[] s = new String[fileNames.size()];
+ String[] s = new String[ fileNames.size() ];
fileNames.copyInto( s );
for( int j = 0; j < s.length; j++ )
{
- String[] command = getCommandline( s[j], base );
+ String[] command = getCommandline( s[ j ], base );
log( "Executing " + Commandline.toString( command ),
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
exe.setCommandline( command );
runExecute( exe );
}
@@ -425,13 +425,13 @@
if( parallel && ( fileNames.size() > 0 || !skipEmpty ) )
{
- String[] s = new String[fileNames.size()];
+ String[] s = new String[ fileNames.size() ];
fileNames.copyInto( s );
- File[] b = new File[baseDirs.size()];
+ File[] b = new File[ baseDirs.size() ];
baseDirs.copyInto( b );
String[] command = getCommandline( s, b );
log( "Executing " + Commandline.toString( command ),
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
exe.setCommandline( command );
runExecute( exe );
}
@@ -439,7 +439,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Execute failed: " + e, e );
+ throw new TaskException( "Execute failed: " + e, e );
}
finally
{
1.2 +1 -0
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java
Index: ExecuteStreamHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExecuteStreamHandler.java 2001/12/15 12:06:21 1.1
+++ ExecuteStreamHandler.java 2001/12/16 00:38:01 1.2
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
1.2 +8 -7
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java
Index: ExecuteWatchdog.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExecuteWatchdog.java 2001/12/15 12:06:21 1.1
+++ ExecuteWatchdog.java 2001/12/16 00:38:01 1.2
@@ -6,8 +6,9 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
+
/**
* Destroys a process running for too long. For example: <pre>
* ExecuteWatchdog watchdog = new ExecuteWatchdog(30000);
@@ -84,16 +85,16 @@
* been terminated either by 'error', timeout or manual intervention.
* Information will be discarded once a new process is ran.
*
- * @throws BuildException a wrapped exception over the one that was
silently
+ * @throws TaskException a wrapped exception over the one that was
silently
* swallowed and stored during the process run.
*/
public void checkException()
- throws BuildException
+ throws TaskException
{
if( caught != null )
{
- throw new BuildException( "Exception in ExecuteWatchdog.run: "
- + caught.getMessage(), caught );
+ throw new TaskException( "Exception in ExecuteWatchdog.run: "
+ + caught.getMessage(), caught );
}
}
@@ -108,7 +109,6 @@
return killedProcess;
}
-
/**
* Watches the process and terminates it, if it runs for to long.
*/
@@ -127,7 +127,8 @@
wait( until - now );
}
catch( InterruptedException e )
- {}
+ {
+ }
}
// if we are here, either someone stopped the watchdog,
1.2 +5 -5
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Exit.java
Index: Exit.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Exit.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Exit.java 2001/12/15 12:06:21 1.1
+++ Exit.java 2001/12/16 00:38:01 1.2
@@ -6,8 +6,8 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.ProjectHelper;
+
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
/**
@@ -46,17 +46,17 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( testIfCondition() && testUnlessCondition() )
{
if( message != null && message.length() > 0 )
{
- throw new BuildException( message );
+ throw new TaskException( message );
}
else
{
- throw new BuildException( "No message" );
+ throw new TaskException( "No message" );
}
}
}
1.3 +26 -23
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java
Index: Expand.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Expand.java 2001/12/15 14:55:54 1.2
+++ Expand.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -16,7 +17,7 @@
import java.util.Vector;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet;
@@ -93,25 +94,25 @@
/**
* Do the work.
*
- * @exception BuildException Thrown in unrecoverable error.
+ * @exception TaskException Thrown in unrecoverable error.
*/
public void execute()
- throws BuildException
+ throws TaskException
{
if( source == null && filesets.size() == 0 )
{
- throw new BuildException( "src attribute and/or filesets must be
specified" );
+ throw new TaskException( "src attribute and/or filesets must be
specified" );
}
if( dest == null )
{
- throw new BuildException(
+ throw new TaskException(
"Dest attribute must be specified" );
}
if( dest.exists() && !dest.isDirectory() )
{
- throw new BuildException( "Dest must be a directory." );
+ throw new TaskException( "Dest must be a directory." );
}
FileUtils fileUtils = FileUtils.newFileUtils();
@@ -120,8 +121,8 @@
{
if( source.isDirectory() )
{
- throw new BuildException( "Src must not be a directory." +
- " Use nested filesets instead." );
+ throw new TaskException( "Src must not be a directory." +
+ " Use nested filesets instead." );
}
else
{
@@ -132,14 +133,14 @@
{
for( int j = 0; j < filesets.size(); j++ )
{
- FileSet fs = ( FileSet )filesets.elementAt( j );
+ FileSet fs = (FileSet)filesets.elementAt( j );
DirectoryScanner ds = fs.getDirectoryScanner( project );
File fromDir = fs.getDir( project );
String[] files = ds.getIncludedFiles();
for( int i = 0; i < files.length; ++i )
{
- File file = new File( fromDir, files[i] );
+ File file = new File( fromDir, files[ i ] );
expandFile( fileUtils, file, dest );
}
}
@@ -161,16 +162,16 @@
while( ( ze = zis.getNextEntry() ) != null )
{
extractFile( fileUtils, srcF, dir, zis,
- ze.getName(),
- new Date( ze.getTime() ),
- ze.isDirectory() );
+ ze.getName(),
+ new Date( ze.getTime() ),
+ ze.isDirectory() );
}
log( "expand complete", Project.MSG_VERBOSE );
}
catch( IOException ioe )
{
- throw new BuildException( "Error while expanding " +
srcF.getPath(), ioe );
+ throw new TaskException( "Error while expanding " +
srcF.getPath(), ioe );
}
finally
{
@@ -181,7 +182,8 @@
zis.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
@@ -199,13 +201,13 @@
boolean included = false;
for( int v = 0; v < patternsets.size(); v++ )
{
- PatternSet p = ( PatternSet )patternsets.elementAt( v );
+ PatternSet p = (PatternSet)patternsets.elementAt( v );
String[] incls = p.getIncludePatterns( project );
if( incls != null )
{
for( int w = 0; w < incls.length; w++ )
{
- boolean isIncl = DirectoryScanner.match( incls[w],
name );
+ boolean isIncl = DirectoryScanner.match( incls[ w ],
name );
if( isIncl )
{
included = true;
@@ -218,7 +220,7 @@
{
for( int w = 0; w < excls.length; w++ )
{
- boolean isExcl = DirectoryScanner.match( excls[w],
name );
+ boolean isExcl = DirectoryScanner.match( excls[ w ],
name );
if( isExcl )
{
included = false;
@@ -238,15 +240,15 @@
try
{
if( !overwrite && f.exists()
- && f.lastModified() >= entryDate.getTime() )
+ && f.lastModified() >= entryDate.getTime() )
{
log( "Skipping " + f + " as it is up-to-date",
- Project.MSG_DEBUG );
+ Project.MSG_DEBUG );
return;
}
log( "expanding " + entryName + " to " + f,
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
// create intermediary directories - sometimes zip don't add them
File dirF = fileUtils.getParentFile( f );
dirF.mkdirs();
@@ -257,7 +259,7 @@
}
else
{
- byte[] buffer = new byte[1024];
+ byte[] buffer = new byte[ 1024 ];
int length = 0;
FileOutputStream fos = null;
try
@@ -282,7 +284,8 @@
fos.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
1.3 +5 -4
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java
Index: Filter.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Filter.java 2001/12/15 14:55:54 1.2
+++ Filter.java 2001/12/16 00:38:01 1.3
@@ -6,8 +6,9 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -44,14 +45,14 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
boolean isFiltersFromFile = filtersFile != null && token == null &&
value == null;
boolean isSingleFilter = filtersFile == null && token != null &&
value != null;
if( !isFiltersFromFile && !isSingleFilter )
{
- throw new BuildException( "both token and value parameters, or
only a filtersFile parameter is required" );
+ throw new TaskException( "both token and value parameters, or
only a filtersFile parameter is required" );
}
if( isSingleFilter )
@@ -66,7 +67,7 @@
}
protected void readFilters()
- throws BuildException
+ throws TaskException
{
log( "Reading filters from " + filtersFile, Project.MSG_VERBOSE );
project.getGlobalFilterSet().readFiltersFromFile( filtersFile );
1.3 +170 -174
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
Index: FixCRLF.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FixCRLF.java 2001/12/15 14:55:54 1.2
+++ FixCRLF.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -20,7 +21,7 @@
import java.io.Writer;
import java.util.Enumeration;
import java.util.NoSuchElementException;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.EnumeratedAttribute;
@@ -65,7 +66,7 @@
*
* @author Sam Ruby <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Peter B. West</a>
- * @version $Revision: 1.2 $ $Name: $
+ * @version $Revision: 1.3 $ $Name: $
*/
public class FixCRLF extends MatchingTask
@@ -192,7 +193,6 @@
}
}
-
/**
* Specify how EndOfLine characters are to be handled
*
@@ -270,14 +270,14 @@
* Specify tab length in characters
*
* @param tlength specify the length of tab in spaces,
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void setTablength( int tlength )
- throws BuildException
+ throws TaskException
{
if( tlength < 2 || tlength > 80 )
{
- throw new BuildException( "tablength must be between 2 and 80" );
+ throw new TaskException( "tablength must be between 2 and 80" );
}
tablength = tlength;
StringBuffer sp = new StringBuffer();
@@ -291,53 +291,53 @@
/**
* Executes the task.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
// first off, make sure that we've got a srcdir and destdir
if( srcDir == null )
{
- throw new BuildException( "srcdir attribute must be set!" );
+ throw new TaskException( "srcdir attribute must be set!" );
}
if( !srcDir.exists() )
{
- throw new BuildException( "srcdir does not exist!" );
+ throw new TaskException( "srcdir does not exist!" );
}
if( !srcDir.isDirectory() )
{
- throw new BuildException( "srcdir is not a directory!" );
+ throw new TaskException( "srcdir is not a directory!" );
}
if( destDir != null )
{
if( !destDir.exists() )
{
- throw new BuildException( "destdir does not exist!" );
+ throw new TaskException( "destdir does not exist!" );
}
if( !destDir.isDirectory() )
{
- throw new BuildException( "destdir is not a directory!" );
+ throw new TaskException( "destdir is not a directory!" );
}
}
// log options used
log( "options:" +
- " eol=" +
- ( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" :
"crlf" ) +
- " tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" :
"remove" ) +
- " eof=" + ( ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" :
"remove" ) +
- " tablength=" + tablength +
- " encoding=" + ( encoding == null ? "default" : encoding ),
- Project.MSG_VERBOSE );
+ " eol=" +
+ ( eol == ASIS ? "asis" : eol == CR ? "cr" : eol == LF ? "lf" :
"crlf" ) +
+ " tab=" + ( tabs == TABS ? "add" : tabs == ASIS ? "asis" :
"remove" ) +
+ " eof=" + ( ctrlz == ADD ? "add" : ctrlz == ASIS ? "asis" :
"remove" ) +
+ " tablength=" + tablength +
+ " encoding=" + ( encoding == null ? "default" : encoding ),
+ Project.MSG_VERBOSE );
DirectoryScanner ds = super.getDirectoryScanner( srcDir );
String[] files = ds.getIncludedFiles();
for( int i = 0; i < files.length; i++ )
{
- processFile( files[i] );
+ processFile( files[ i ] );
}
}
@@ -353,10 +353,9 @@
throws IOException
{
return ( encoding == null ) ? new FileReader( f )
- : new InputStreamReader( new FileInputStream( f ), encoding );
+ : new InputStreamReader( new FileInputStream( f ), encoding );
}
-
/**
* Scan a BufferLine forward from the 'next' pointer for the end of a
* character constant. Set 'lookahead' pointer to the character following
@@ -364,10 +363,10 @@
*
* @param bufline Description of Parameter
* @param terminator Description of Parameter
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private void endOfCharConst( OneLiner.BufferLine bufline, char
terminator )
- throws BuildException
+ throws TaskException
{
int ptr = bufline.getNext();
int eol = bufline.length();
@@ -389,7 +388,7 @@
}
}// end of while (ptr < eol)
// Must have fallen through to the end of the line
- throw new BuildException( "endOfCharConst: unterminated char
constant" );
+ throw new TaskException( "endOfCharConst: unterminated char
constant" );
}
/**
@@ -400,10 +399,10 @@
* next eol character.
*
* @param bufline Description of Parameter
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private void nextStateChange( OneLiner.BufferLine bufline )
- throws BuildException
+ throws TaskException
{
int eol = bufline.length();
int ptr = bufline.getNext();
@@ -411,33 +410,33 @@
// Look for next single or double quote, double slash or slash star
while( ptr < eol )
{
- switch ( bufline.getChar( ptr++ ) )
+ switch( bufline.getChar( ptr++ ) )
{
- case '\'':
- bufline.setState( IN_CHAR_CONST );
- bufline.setLookahead( --ptr );
- return;
- case '\"':
- bufline.setState( IN_STR_CONST );
- bufline.setLookahead( --ptr );
- return;
- case '/':
- if( ptr < eol )
- {
- if( bufline.getChar( ptr ) == '*' )
- {
- bufline.setState( IN_MULTI_COMMENT );
- bufline.setLookahead( --ptr );
- return;
- }
- else if( bufline.getChar( ptr ) == '/' )
+ case '\'':
+ bufline.setState( IN_CHAR_CONST );
+ bufline.setLookahead( --ptr );
+ return;
+ case '\"':
+ bufline.setState( IN_STR_CONST );
+ bufline.setLookahead( --ptr );
+ return;
+ case '/':
+ if( ptr < eol )
{
- bufline.setState( IN_SINGLE_COMMENT );
- bufline.setLookahead( --ptr );
- return;
+ if( bufline.getChar( ptr ) == '*' )
+ {
+ bufline.setState( IN_MULTI_COMMENT );
+ bufline.setLookahead( --ptr );
+ return;
+ }
+ else if( bufline.getChar( ptr ) == '/' )
+ {
+ bufline.setState( IN_SINGLE_COMMENT );
+ bufline.setLookahead( --ptr );
+ return;
+ }
}
- }
- break;
+ break;
}// end of switch (bufline.getChar(ptr++))
}// end of while (ptr < eol)
@@ -445,7 +444,6 @@
bufline.setLookahead( ptr );
}
-
/**
* Process a BufferLine string which is not part of of a string constant.
* The start position of the string is given by the 'next' field. Sets
the
@@ -472,7 +470,7 @@
// process sequences of white space
// first convert all tabs to spaces
linebuf.setLength( 0 );
- while( ( nextTab = line.indexOf( ( int )'\t', place ) ) >= 0 )
+ while( ( nextTab = line.indexOf( (int)'\t', place ) ) >= 0 )
{
linebuf.append( line.substring( place, nextTab ) );// copy to
the TAB
col += nextTab - place;
@@ -492,7 +490,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}// end of try-catch
}
else
@@ -519,9 +517,9 @@
; nextStop += tablength )
{
for( tabCol = nextStop;
- --tabCol - placediff >= place
- && linestring.charAt( tabCol - placediff ) == ' '
- ; )
+ --tabCol - placediff >= place
+ && linestring.charAt( tabCol - placediff ) == ' '
+ ; )
{
;// Loop for the side-effects
}
@@ -551,7 +549,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}// end of try-catch
}// end of else tabs == ADD
@@ -562,9 +560,8 @@
}
-
private void processFile( String file )
- throws BuildException
+ throws TaskException
{
File srcFile = new File( srcDir, file );
File destD = destDir == null ? srcDir : destDir;
@@ -582,12 +579,12 @@
{
tmpFile = fileUtils.createTempFile( "fixcrlf", "", destD );
Writer writer = ( encoding == null ) ? new FileWriter(
tmpFile )
- : new OutputStreamWriter( new FileOutputStream( tmpFile
), encoding );
+ : new OutputStreamWriter( new FileOutputStream( tmpFile
), encoding );
outWriter = new BufferedWriter( writer );
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
while( lines.hasMoreElements() )
@@ -597,11 +594,11 @@
try
{
- line = ( OneLiner.BufferLine )lines.nextElement();
+ line = (OneLiner.BufferLine)lines.nextElement();
}
catch( NoSuchElementException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
String lineString = line.getLineString();
@@ -619,7 +616,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}// end of try-catch
}
@@ -630,78 +627,78 @@
while( ( ptr = line.getNext() ) < linelen )
{
- switch ( lines.getState() )
+ switch( lines.getState() )
{
- case NOTJAVA:
- notInConstant( line, line.length(), outWriter );
- break;
- case IN_MULTI_COMMENT:
- if( ( endComment =
- lineString.indexOf( "*/", line.getNext() )
- ) >= 0 )
- {
- // End of multiLineComment on this line
- endComment += 2;// Include the end token
- lines.setState( LOOKING );
- }
- else
- {
- endComment = linelen;
- }
-
- notInConstant( line, endComment, outWriter );
- break;
- case IN_SINGLE_COMMENT:
- notInConstant( line, line.length(), outWriter );
- lines.setState( LOOKING );
- break;
- case IN_CHAR_CONST:
- case IN_STR_CONST:
- // Got here from LOOKING by finding an opening
"\'"
- // next points to that quote character.
- // Find the end of the constant. Watch out for
- // backslashes. Literal tabs are left
unchanged, and
- // the column is adjusted accordingly.
-
- int begin = line.getNext();
- char terminator = ( lines.getState() ==
IN_STR_CONST
- ? '\"'
- : '\'' );
- endOfCharConst( line, terminator );
- while( line.getNext() < line.getLookahead() )
- {
- if( line.getNextCharInc() == '\t' )
+ case NOTJAVA:
+ notInConstant( line, line.length(),
outWriter );
+ break;
+ case IN_MULTI_COMMENT:
+ if( ( endComment =
+ lineString.indexOf( "*/", line.getNext()
)
+ ) >= 0 )
{
- line.setColumn(
- line.getColumn() +
- tablength -
- line.getColumn() % tablength );
+ // End of multiLineComment on this line
+ endComment += 2;// Include the end token
+ lines.setState( LOOKING );
}
else
{
- line.incColumn();
+ endComment = linelen;
}
- }
- // Now output the substring
- try
- {
- outWriter.write( line.substring( begin,
line.getNext() ) );
- }
- catch( IOException e )
- {
- throw new BuildException( "Error", e );
- }
-
- lines.setState( LOOKING );
-
- break;
-
- case LOOKING:
- nextStateChange( line );
- notInConstant( line, line.getLookahead(),
outWriter );
- break;
+ notInConstant( line, endComment, outWriter );
+ break;
+ case IN_SINGLE_COMMENT:
+ notInConstant( line, line.length(),
outWriter );
+ lines.setState( LOOKING );
+ break;
+ case IN_CHAR_CONST:
+ case IN_STR_CONST:
+ // Got here from LOOKING by finding an
opening "\'"
+ // next points to that quote character.
+ // Find the end of the constant. Watch out
for
+ // backslashes. Literal tabs are left
unchanged, and
+ // the column is adjusted accordingly.
+
+ int begin = line.getNext();
+ char terminator = ( lines.getState() ==
IN_STR_CONST
+ ? '\"'
+ : '\'' );
+ endOfCharConst( line, terminator );
+ while( line.getNext() < line.getLookahead() )
+ {
+ if( line.getNextCharInc() == '\t' )
+ {
+ line.setColumn(
+ line.getColumn() +
+ tablength -
+ line.getColumn() % tablength );
+ }
+ else
+ {
+ line.incColumn();
+ }
+ }
+
+ // Now output the substring
+ try
+ {
+ outWriter.write( line.substring( begin,
line.getNext() ) );
+ }
+ catch( IOException e )
+ {
+ throw new TaskException( "Error", e );
+ }
+
+ lines.setState( LOOKING );
+
+ break;
+
+ case LOOKING:
+ nextStateChange( line );
+ notInConstant( line, line.getLookahead(),
outWriter );
+ break;
}// end of switch (state)
}// end of while (line.getNext() < linelen)
@@ -714,7 +711,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}// end of try-catch
}// end of while (lines.hasNext())
@@ -733,7 +730,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
finally
{
@@ -743,7 +740,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
@@ -756,7 +753,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Unable to close source file " +
srcFile );
+ throw new TaskException( "Unable to close source file " +
srcFile );
}
if( destFile.exists() )
@@ -768,28 +765,28 @@
log( destFile + " is being written", Project.MSG_DEBUG );
if( !destFile.delete() )
{
- throw new BuildException( "Unable to delete "
- + destFile );
+ throw new TaskException( "Unable to delete "
+ + destFile );
}
if( !tmpFile.renameTo( destFile ) )
{
- throw new BuildException(
+ throw new TaskException(
"Failed to transform " + srcFile
- + " to " + destFile
- + ". Couldn't rename temporary file: "
- + tmpFile );
+ + " to " + destFile
+ + ". Couldn't rename temporary file: "
+ + tmpFile );
}
}
else
{// destination is equal to temp file
log( destFile +
- " is not written, as the contents are identical",
- Project.MSG_DEBUG );
+ " is not written, as the contents are identical",
+ Project.MSG_DEBUG );
if( !tmpFile.delete() )
{
- throw new BuildException( "Unable to delete "
- + tmpFile );
+ throw new TaskException( "Unable to delete "
+ + tmpFile );
}
}
}
@@ -798,11 +795,11 @@
log( "destFile does not exist", Project.MSG_DEBUG );
if( !tmpFile.renameTo( destFile ) )
{
- throw new BuildException(
+ throw new TaskException(
"Failed to transform " + srcFile
- + " to " + destFile
- + ". Couldn't rename temporary file: "
- + tmpFile );
+ + " to " + destFile
+ + ". Couldn't rename temporary file: "
+ + tmpFile );
}
}
@@ -811,7 +808,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
finally
{
@@ -860,7 +857,6 @@
}
}
-
class OneLiner implements Enumeration
{
@@ -874,7 +870,7 @@
private BufferedReader reader;
public OneLiner( File srcFile )
- throws BuildException
+ throws TaskException
{
try
{
@@ -884,7 +880,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
@@ -931,7 +927,7 @@
}
protected void nextLine()
- throws BuildException
+ throws TaskException
{
int ch = -1;
int eolcount = 0;
@@ -944,7 +940,7 @@
ch = reader.read();
while( ch != -1 && ch != '\r' && ch != '\n' )
{
- line.append( ( char )ch );
+ line.append( (char)ch );
ch = reader.read();
}
@@ -955,32 +951,32 @@
return;
}
- switch ( ( char )ch )
+ switch( (char)ch )
{
- case '\r':
- // Check for \r, \r\n and \r\r\n
- // Regard \r\r not followed by \n as two lines
- ++eolcount;
- eolStr.append( '\r' );
- switch ( ( char )( ch = reader.read() ) )
- {
case '\r':
- if( ( char )( ch = reader.read() ) == '\n' )
+ // Check for \r, \r\n and \r\r\n
+ // Regard \r\r not followed by \n as two lines
+ ++eolcount;
+ eolStr.append( '\r' );
+ switch( (char)( ch = reader.read() ) )
{
- eolcount += 2;
- eolStr.append( "\r\n" );
- }
+ case '\r':
+ if( (char)( ch = reader.read() ) == '\n' )
+ {
+ eolcount += 2;
+ eolStr.append( "\r\n" );
+ }
+ break;
+ case '\n':
+ ++eolcount;
+ eolStr.append( '\n' );
+ break;
+ }// end of switch ((char)(ch = reader.read()))
break;
case '\n':
++eolcount;
eolStr.append( '\n' );
break;
- }// end of switch ((char)(ch = reader.read()))
- break;
- case '\n':
- ++eolcount;
- eolStr.append( '\n' );
- break;
}// end of switch ((char) ch)
// if at eolcount == 0 and trailing characters of string
@@ -1013,7 +1009,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
@@ -1026,7 +1022,7 @@
private String line;
public BufferLine( String line, String eolStr )
- throws BuildException
+ throws TaskException
{
next = 0;
column = 0;
1.2 +20 -19
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
Index: GenerateKey.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GenerateKey.java 2001/12/15 12:06:21 1.1
+++ GenerateKey.java 2001/12/16 00:38:01 1.2
@@ -6,9 +6,10 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.util.Enumeration;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline;
@@ -51,8 +52,8 @@
{
if( null != expandedDname )
{
- throw new BuildException( "It is not possible to specify dname
both " +
- "as attribute and element." );
+ throw new TaskException( "It is not possible to specify dname
both " +
+ "as attribute and element." );
}
this.dname = dname;
}
@@ -68,7 +69,7 @@
}
public void setKeysize( final String keysize )
- throws BuildException
+ throws TaskException
{
try
{
@@ -76,7 +77,7 @@
}
catch( final NumberFormatException nfe )
{
- throw new BuildException( "KeySize attribute should be a
integer" );
+ throw new TaskException( "KeySize attribute should be a integer"
);
}
}
@@ -101,7 +102,7 @@
}
public void setValidity( final String validity )
- throws BuildException
+ throws TaskException
{
try
{
@@ -109,7 +110,7 @@
}
catch( final NumberFormatException nfe )
{
- throw new BuildException( "Validity attribute should be a
integer" );
+ throw new TaskException( "Validity attribute should be a
integer" );
}
}
@@ -119,43 +120,43 @@
}
public DistinguishedName createDname()
- throws BuildException
+ throws TaskException
{
if( null != expandedDname )
{
- throw new BuildException( "DName sub-element can only be
specified once." );
+ throw new TaskException( "DName sub-element can only be
specified once." );
}
if( null != dname )
{
- throw new BuildException( "It is not possible to specify dname
both " +
- "as attribute and element." );
+ throw new TaskException( "It is not possible to specify dname
both " +
+ "as attribute and element." );
}
expandedDname = new DistinguishedName();
return expandedDname;
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( project.getJavaVersion().equals( Project.JAVA_1_1 ) )
{
- throw new BuildException( "The genkey task is only available on
JDK" +
- " versions 1.2 or greater" );
+ throw new TaskException( "The genkey task is only available on
JDK" +
+ " versions 1.2 or greater" );
}
if( null == alias )
{
- throw new BuildException( "alias attribute must be set" );
+ throw new TaskException( "alias attribute must be set" );
}
if( null == storepass )
{
- throw new BuildException( "storepass attribute must be set" );
+ throw new TaskException( "storepass attribute must be set" );
}
if( null == dname && null == expandedDname )
{
- throw new BuildException( "dname must be set" );
+ throw new TaskException( "dname must be set" );
}
final StringBuffer sb = new StringBuffer();
@@ -246,7 +247,7 @@
}
log( "Generating Key for " + alias );
- final ExecTask cmd = ( ExecTask )project.createTask( "exec" );
+ final ExecTask cmd = (ExecTask)project.createTask( "exec" );
cmd.setCommand( new Commandline( sb.toString() ) );
cmd.setFailonerror( true );
cmd.setTaskName( getTaskName() );
@@ -311,7 +312,7 @@
}
firstPass = false;
- final DnameParam param = ( DnameParam )params.elementAt( i );
+ final DnameParam param = (DnameParam)params.elementAt( i );
sb.append( encode( param.getName() ) );
sb.append( '=' );
sb.append( encode( param.getValue() ) );
1.3 +41 -43
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
Index: Get.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Get.java 2001/12/15 14:55:54 1.2
+++ Get.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -14,7 +15,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.util.Date;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -100,7 +101,6 @@
}
}
-
/**
* Username for basic auth.
*
@@ -121,33 +121,32 @@
verbose = v;
}
-
/**
* Does the work.
*
- * @exception BuildException Thrown in unrecoverable error.
+ * @exception TaskException Thrown in unrecoverable error.
*/
public void execute()
- throws BuildException
+ throws TaskException
{
if( source == null )
{
- throw new BuildException( "src attribute is required" );
+ throw new TaskException( "src attribute is required" );
}
if( dest == null )
{
- throw new BuildException( "dest attribute is required" );
+ throw new TaskException( "dest attribute is required" );
}
if( dest.exists() && dest.isDirectory() )
{
- throw new BuildException( "The specified destination is a
directory" );
+ throw new TaskException( "The specified destination is a
directory" );
}
if( dest.exists() && !dest.canWrite() )
{
- throw new BuildException( "Can't write to " +
dest.getAbsolutePath() );
+ throw new TaskException( "Can't write to " +
dest.getAbsolutePath() );
}
try
@@ -187,7 +186,7 @@
try
{
sun.misc.BASE64Encoder encoder =
- ( sun.misc.BASE64Encoder )Class.forName(
"sun.misc.BASE64Encoder" ).newInstance();
+ (sun.misc.BASE64Encoder)Class.forName(
"sun.misc.BASE64Encoder" ).newInstance();
encoding = encoder.encode( up.getBytes() );
}
@@ -204,7 +203,7 @@
//next test for a 304 result (HTTP only)
if( connection instanceof HttpURLConnection )
{
- HttpURLConnection httpConnection = ( HttpURLConnection
)connection;
+ HttpURLConnection httpConnection =
(HttpURLConnection)connection;
if( httpConnection.getResponseCode() ==
HttpURLConnection.HTTP_NOT_MODIFIED )
{
//not modified so no file download. just return instead
@@ -246,10 +245,10 @@
log( "Can't get " + source + " to " + dest );
if( ignoreErrors )
return;
- throw new BuildException( "Can't get " + source + " to " +
dest );
+ throw new TaskException( "Can't get " + source + " to " +
dest );
}
- byte[] buffer = new byte[100 * 1024];
+ byte[] buffer = new byte[ 100 * 1024 ];
int length;
while( ( length = is.read( buffer ) ) >= 0 )
@@ -283,7 +282,7 @@
log( "Error getting " + source + " to " + dest );
if( ignoreErrors )
return;
- throw new BuildException( "Error", ioe);
+ throw new TaskException( "Error", ioe );
}
}
@@ -294,16 +293,16 @@
* @param timemillis Description of Parameter
* @return true if it succeeded. False means that this is a java1.1
system
* and that file times can not be set
- * @exception BuildException Thrown in unrecoverable error. Likely this
+ * @exception TaskException Thrown in unrecoverable error. Likely this
* comes from file access failures.
*/
protected boolean touchFile( File file, long timemillis )
- throws BuildException
+ throws TaskException
{
if( project.getJavaVersion() != Project.JAVA_1_1 )
{
- Touch touch = ( Touch )project.createTask( "touch" );
+ Touch touch = (Touch)project.createTask( "touch" );
touch.setOwningTarget( target );
touch.setTaskName( getTaskName() );
touch.setLocation( getLocation() );
@@ -330,14 +329,13 @@
public final char[] alphabet = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', // 0 to 7
- 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 8 to 15
- 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 16 to 23
- 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 24 to 31
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 32 to 39
- 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 40 to 47
- 'w', 'x', 'y', 'z', '0', '1', '2', '3', // 48 to 55
- '4', '5', '6', '7', '8', '9', '+', '/'};// 56 to 63
-
+ 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 8 to 15
+ 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', // 16 to 23
+ 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', // 24 to 31
+ 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', // 32 to 39
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', // 40 to 47
+ 'w', 'x', 'y', 'z', '0', '1', '2', '3', // 48 to 55
+ '4', '5', '6', '7', '8', '9', '+', '/'};// 56 to 63
public String encode( String s )
{
@@ -350,7 +348,7 @@
int bits6;
char[] out
- = new char[( ( octetString.length - 1 ) / 3 + 1 ) * 4];
+ = new char[ ( ( octetString.length - 1 ) / 3 + 1 ) * 4 ];
int outIndex = 0;
int i = 0;
@@ -358,46 +356,46 @@
while( ( i + 3 ) <= octetString.length )
{
// store the octets
- bits24 = ( octetString[i++] & 0xFF ) << 16;
- bits24 |= ( octetString[i++] & 0xFF ) << 8;
+ bits24 = ( octetString[ i++ ] & 0xFF ) << 16;
+ bits24 |= ( octetString[ i++ ] & 0xFF ) << 8;
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
bits6 = ( bits24 & 0x0003F000 ) >> 12;
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
bits6 = ( bits24 & 0x0000003F );
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
}
if( octetString.length - i == 2 )
{
// store the octets
- bits24 = ( octetString[i] & 0xFF ) << 16;
- bits24 |= ( octetString[i + 1] & 0xFF ) << 8;
+ bits24 = ( octetString[ i ] & 0xFF ) << 16;
+ bits24 |= ( octetString[ i + 1 ] & 0xFF ) << 8;
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
bits6 = ( bits24 & 0x0003F000 ) >> 12;
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
bits6 = ( bits24 & 0x00000FC0 ) >> 6;
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
// padding
- out[outIndex++] = '=';
+ out[ outIndex++ ] = '=';
}
else if( octetString.length - i == 1 )
{
// store the octets
- bits24 = ( octetString[i] & 0xFF ) << 16;
+ bits24 = ( octetString[ i ] & 0xFF ) << 16;
bits6 = ( bits24 & 0x00FC0000 ) >> 18;
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
bits6 = ( bits24 & 0x0003F000 ) >> 12;
- out[outIndex++] = alphabet[bits6];
+ out[ outIndex++ ] = alphabet[ bits6 ];
// padding
- out[outIndex++] = '=';
- out[outIndex++] = '=';
+ out[ outIndex++ ] = '=';
+ out[ outIndex++ ] = '=';
}
return new String( out );
1.3 +11 -7
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GUnzip.java
Index: GUnzip.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GUnzip.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GUnzip.java 2001/12/15 14:55:54 1.2
+++ GUnzip.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,12 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.GZIPInputStream;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
/**
* Expands a file that has been compressed with the GZIP algorithm. Normally
@@ -45,18 +46,18 @@
out = new FileOutputStream( dest );
fis = new FileInputStream( source );
zIn = new GZIPInputStream( fis );
- byte[] buffer = new byte[8 * 1024];
+ byte[] buffer = new byte[ 8 * 1024 ];
int count = 0;
do
{
out.write( buffer, 0, count );
count = zIn.read( buffer, 0, buffer.length );
- }while ( count != -1 );
+ } while( count != -1 );
}
catch( IOException ioe )
{
String msg = "Problem expanding gzip " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ throw new TaskException( msg, ioe );
}
finally
{
@@ -67,7 +68,8 @@
fis.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
if( out != null )
{
@@ -76,7 +78,8 @@
out.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
if( zIn != null )
{
@@ -85,7 +88,8 @@
zIn.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
}
}
1.3 +5 -4
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GZip.java
Index: GZip.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GZip.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GZip.java 2001/12/15 14:55:54 1.2
+++ GZip.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,11 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.zip.GZIPOutputStream;
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.taskdefs.Pack;
+import org.apache.myrmidon.api.TaskException;
/**
* Compresses a file with the GZIP algorithm. Normally used to compress
@@ -34,7 +34,7 @@
catch( IOException ioe )
{
String msg = "Problem creating gzip " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ throw new TaskException( msg, ioe );
}
finally
{
@@ -46,7 +46,8 @@
zOut.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
1.2 +10 -7
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java
Index: Input.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Input.java 2001/12/15 12:06:21 1.1
+++ Input.java 2001/12/16 00:38:01 1.2
@@ -6,13 +6,14 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import java.util.Vector;
-import org.apache.tools.ant.*;
-
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
/**
* Ant task to read input line from console.
@@ -29,7 +30,9 @@
/**
* No arg constructor.
*/
- public Input() { }
+ public Input()
+ {
+ }
/**
* Defines the name of a property to be created from input. Behaviour is
@@ -90,10 +93,10 @@
/**
* Actual test method executed by jakarta-ant.
*
- * @exception BuildException
+ * @exception TaskException
*/
public void execute()
- throws BuildException
+ throws TaskException
{
Vector accept = null;
if( validargs != null )
@@ -123,7 +126,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Failed to read input from
Console.", e );
+ throw new TaskException( "Failed to read input from
Console.", e );
}
}
// not quite the original intention of this task but for the sake
@@ -132,7 +135,7 @@
{
if( accept != null && ( !accept.contains( input ) ) )
{
- throw new BuildException( "Invalid input please reenter." );
+ throw new TaskException( "Invalid input please reenter." );
}
}
// adopted from org.apache.tools.ant.taskdefs.Property
1.3 +28 -21
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java
Index: Jar.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Jar.java 2001/12/15 14:55:54 1.2
+++ Jar.java 2001/12/16 00:38:01 1.3
@@ -6,10 +6,19 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
-import java.io.*;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.Reader;
import java.util.Enumeration;
-import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.FileScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.ZipFileSet;
@@ -67,7 +76,7 @@
{
if( !manifestFile.exists() )
{
- throw new BuildException( "Manifest file: " + manifestFile + "
does not exist." );
+ throw new TaskException( "Manifest file: " + manifestFile + "
does not exist." );
}
this.manifestFile = manifestFile;
@@ -86,11 +95,11 @@
catch( ManifestException e )
{
log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR );
- throw new BuildException( "Invalid Manifest: " + manifestFile, e
);
+ throw new TaskException( "Invalid Manifest: " + manifestFile, e
);
}
catch( IOException e )
{
- throw new BuildException( "Unable to read manifest file: " +
manifestFile, e );
+ throw new TaskException( "Unable to read manifest file: " +
manifestFile, e );
}
finally
{
@@ -111,7 +120,7 @@
public void setWhenempty( WhenEmpty we )
{
log( "JARs are never empty, they contain at least a manifest file",
- Project.MSG_WARN );
+ Project.MSG_WARN );
}
public void addConfiguredManifest( Manifest newManifest )
@@ -139,10 +148,10 @@
* @param zipFile intended archive file (may or may not exist)
* @return true if nothing need be done (may have done something
already);
* false if archive creation should proceed
- * @exception BuildException if it likes
+ * @exception TaskException if it likes
*/
protected boolean isUpToDate( FileScanner[] scanners, File zipFile )
- throws BuildException
+ throws TaskException
{
// need to handle manifest as a special check
if( buildFileManifest || manifestFile == null )
@@ -172,7 +181,7 @@
{
// any problems and we will rebuild
log( "Updating jar since cannot read current jar manifest: "
+ e.getClass().getName() + e.getMessage(),
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
return false;
}
finally
@@ -213,7 +222,7 @@
}
protected void finalizeZipOutputStream( ZipOutputStream zOut )
- throws IOException, BuildException
+ throws IOException, TaskException
{
if( index )
{
@@ -222,7 +231,7 @@
}
protected void initZipOutputStream( ZipOutputStream zOut )
- throws IOException, BuildException
+ throws IOException, TaskException
{
try
{
@@ -232,9 +241,9 @@
{
execManifest.merge( manifest );
}
- for( Enumeration e = execManifest.getWarnings();
e.hasMoreElements(); )
+ for( Enumeration e = execManifest.getWarnings();
e.hasMoreElements(); )
{
- log( "Manifest warning: " + ( String )e.nextElement(),
Project.MSG_WARN );
+ log( "Manifest warning: " + (String)e.nextElement(),
Project.MSG_WARN );
}
zipDir( null, zOut, "META-INF/" );
@@ -251,7 +260,7 @@
catch( ManifestException e )
{
log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR );
- throw new BuildException( "Invalid Manifest", e );
+ throw new TaskException( "Invalid Manifest", e );
}
}
@@ -265,7 +274,7 @@
if( vPath.equalsIgnoreCase( "META-INF/MANIFEST.MF" ) )
{
log( "Warning: selected " + archiveType + " files include a
META-INF/MANIFEST.MF which will be ignored " +
- "(please use manifest attribute to " + archiveType + "
task)", Project.MSG_WARN );
+ "(please use manifest attribute to " + archiveType + "
task)", Project.MSG_WARN );
}
else
{
@@ -287,7 +296,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Unable to read manifest file: ",
e );
+ throw new TaskException( "Unable to read manifest file: ", e
);
}
}
else
@@ -325,7 +334,7 @@
Enumeration enum = addedDirs.keys();
while( enum.hasMoreElements() )
{
- String dir = ( String )enum.nextElement();
+ String dir = (String)enum.nextElement();
// try to be smart, not to be fooled by a weird directory name
// @fixme do we need to check for directories starting by ./ ?
@@ -352,8 +361,6 @@
super.zipFile( bais, zOut, INDEX_NAME, System.currentTimeMillis() );
}
-
-
/**
* Handle situation when we encounter a manifest file If we haven't been
* given one, we use this one. If we have, we merge the manifest in,
@@ -380,7 +387,7 @@
catch( ManifestException e )
{
log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR );
- throw new BuildException( "Invalid Manifest", e );
+ throw new TaskException( "Invalid Manifest", e );
}
}
}
1.3 +25 -25
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
Index: Java.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Java.java 2001/12/15 14:55:54 1.2
+++ Java.java 2001/12/16 00:38:01 1.3
@@ -12,7 +12,7 @@
import java.io.IOException;
import java.io.PrintStream;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline;
@@ -43,14 +43,14 @@
* Set the class name.
*
* @param s The new Classname value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void setClassname( String s )
- throws BuildException
+ throws TaskException
{
if( cmdl.getJar() != null )
{
- throw new BuildException( "Cannot use 'jar' and 'classname'
attributes in same command" );
+ throw new TaskException( "Cannot use 'jar' and 'classname'
attributes in same command" );
}
cmdl.setClassname( s );
}
@@ -86,7 +86,7 @@
}
/**
- * Throw a BuildException if process returns non 0.
+ * Throw a TaskException if process returns non 0.
*
* @param fail The new Failonerror value
*/
@@ -114,14 +114,14 @@
* set the jar name...
*
* @param jarfile The new Jar value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void setJar( File jarfile )
- throws BuildException
+ throws TaskException
{
if( cmdl.getClassname() != null )
{
- throw new BuildException( "Cannot use 'jar' and 'classname'
attributes in same command." );
+ throw new TaskException( "Cannot use 'jar' and 'classname'
attributes in same command." );
}
cmdl.setJar( jarfile.getAbsolutePath() );
}
@@ -207,17 +207,17 @@
/**
* Do the execution.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
int err = -1;
if( ( err = executeJava() ) != 0 )
{
if( failOnError )
{
- throw new BuildException( "Java returned: " + err );
+ throw new TaskException( "Java returned: " + err );
}
else
{
@@ -231,19 +231,19 @@
*
* @return the return code from the execute java class if it was
executed in
* a separate VM (fork = "yes").
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public int executeJava()
- throws BuildException
+ throws TaskException
{
String classname = cmdl.getClassname();
if( classname == null && cmdl.getJar() == null )
{
- throw new BuildException( "Classname must not be null." );
+ throw new TaskException( "Classname must not be null." );
}
if( !fork && cmdl.getJar() != null )
{
- throw new BuildException( "Cannot execute a jar in non-forked
mode. Please set fork='true'. " );
+ throw new TaskException( "Cannot execute a jar in non-forked
mode. Please set fork='true'. " );
}
if( fork )
@@ -300,10 +300,10 @@
*
* @param classname Description of Parameter
* @param args Description of Parameter
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected void run( String classname, Vector args )
- throws BuildException
+ throws TaskException
{
CommandlineJava cmdj = new CommandlineJava();
cmdj.setClassname( classname );
@@ -319,10 +319,10 @@
* line application.
*
* @param command Description of Parameter
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private void run( CommandlineJava command )
- throws BuildException
+ throws TaskException
{
ExecuteJava exe = new ExecuteJava();
exe.setJavaCommand( command.getJavaCommand() );
@@ -337,7 +337,7 @@
}
catch( IOException io )
{
- throw new BuildException( "Error", io );
+ throw new TaskException( "Error", io );
}
finally
{
@@ -358,10 +358,10 @@
*
* @param command Description of Parameter
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private int run( String[] command )
- throws BuildException
+ throws TaskException
{
FileOutputStream fos = null;
try
@@ -387,7 +387,7 @@
}
else if( !dir.exists() || !dir.isDirectory() )
{
- throw new BuildException( dir.getAbsolutePath() + " is not a
valid directory");
+ throw new TaskException( dir.getAbsolutePath() + " is not a
valid directory" );
}
exe.setWorkingDirectory( dir );
@@ -399,12 +399,12 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
catch( IOException io )
{
- throw new BuildException( "Error", io );
+ throw new TaskException( "Error", io );
}
finally
{
1.3 +9 -9
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
Index: Javac.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Javac.java 2001/12/15 14:55:54 1.2
+++ Javac.java 2001/12/16 00:38:01 1.3
@@ -10,8 +10,8 @@
import java.io.File;
import java.util.Enumeration;
import java.util.Vector;
+import org.apache.myrmidon.api.TaskException;
import org.apache.myrmidon.framework.Os;
-import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
@@ -221,7 +221,7 @@
}
/**
- * Throw a BuildException if compilation fails
+ * Throw a TaskException if compilation fails
*
* @param fail The new Failonerror value
*/
@@ -715,26 +715,26 @@
/**
* Executes the task.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
// first off, make sure that we've got a srcdir
if( src == null )
{
- throw new BuildException( "srcdir attribute must be set!" );
+ throw new TaskException( "srcdir attribute must be set!" );
}
String[] list = src.list();
if( list.length == 0 )
{
- throw new BuildException( "srcdir attribute must be set!" );
+ throw new TaskException( "srcdir attribute must be set!" );
}
if( destDir != null && !destDir.isDirectory() )
{
- throw new BuildException( "destination directory \"" + destDir +
"\" does not exist or is not a directory" );
+ throw new TaskException( "destination directory \"" + destDir +
"\" does not exist or is not a directory" );
}
// scan source directories and dest directory to build up
@@ -745,7 +745,7 @@
File srcDir = (File)resolveFile( list[ i ] );
if( !srcDir.exists() )
{
- throw new BuildException( "srcdir \"" + srcDir.getPath() +
"\" does not exist!" );
+ throw new TaskException( "srcdir \"" + srcDir.getPath() +
"\" does not exist!" );
}
DirectoryScanner ds = this.getDirectoryScanner( srcDir );
@@ -777,7 +777,7 @@
{
if( failOnError )
{
- throw new BuildException( FAIL_MSG );
+ throw new TaskException( FAIL_MSG );
}
else
{
1.3 +56 -49
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
Index: Javadoc.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Javadoc.java 2001/12/15 14:55:54 1.2
+++ Javadoc.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.FileWriter;
import java.io.FilenameFilter;
@@ -14,12 +15,11 @@
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
+import org.apache.myrmidon.framework.Os;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
-import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.Task;
-import org.apache.myrmidon.framework.Os;
import org.apache.tools.ant.types.Commandline;
import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet;
@@ -100,6 +100,7 @@
}
public void setAdditionalparam( String add )
+ throws TaskException
{
cmd.createArgument().setLine( add );
}
@@ -300,6 +301,7 @@
}
public void setLinkoffline( String src )
+ throws TaskException
{
if( !javadoc1 )
{
@@ -309,14 +311,14 @@
"a package-list file location separated by a space";
if( src.trim().length() == 0 )
{
- throw new BuildException( linkOfflineError );
+ throw new TaskException( linkOfflineError );
}
StringTokenizer tok = new StringTokenizer( src, " ", false );
le.setHref( tok.nextToken() );
if( !tok.hasMoreTokens() )
{
- throw new BuildException( linkOfflineError );
+ throw new TaskException( linkOfflineError );
}
le.setPackagelistLoc( resolveFile( tok.nextToken() ) );
}
@@ -430,6 +432,7 @@
}
public void setSourcefiles( String src )
+ throws TaskException
{
StringTokenizer tok = new StringTokenizer( src, "," );
while( tok.hasMoreTokens() )
@@ -606,12 +609,12 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( sourcePath == null )
{
String msg = "sourcePath attribute must be set!";
- throw new BuildException( msg );
+ throw new TaskException( msg );
}
log( "Generating Javadoc", Project.MSG_INFO );
@@ -637,10 +640,10 @@
cmd.createArgument().setValue( expand( bottom.getText() ) );
}
- Commandline toExecute = ( Commandline )cmd.clone();
+ Commandline toExecute = (Commandline)cmd.clone();
toExecute.setExecutable( getJavadocExecutableName() );
-// ------------------------------------------------ general javadoc arguments
+ // ------------------------------------------------ general javadoc
arguments
if( classpath == null )
classpath = Path.systemClasspath;
else
@@ -657,7 +660,7 @@
{
toExecute.createArgument().setValue( "-classpath" );
toExecute.createArgument().setValue( sourcePath.toString() +
- System.getProperty( "path.separator" ) +
classpath.toString() );
+ System.getProperty(
"path.separator" ) + classpath.toString() );
}
if( version && doclet == null )
@@ -670,13 +673,13 @@
if( destDir == null )
{
String msg = "destDir attribute must be set!";
- throw new BuildException( msg );
+ throw new TaskException( msg );
}
}
-// --------------------------------- javadoc2 arguments for default doclet
+ // --------------------------------- javadoc2 arguments for default
doclet
-// XXX: how do we handle a custom doclet?
+ // XXX: how do we handle a custom doclet?
if( !javadoc1 )
{
@@ -684,7 +687,7 @@
{
if( doclet.getName() == null )
{
- throw new BuildException( "The doclet name must be
specified." );
+ throw new TaskException( "The doclet name must be
specified." );
}
else
{
@@ -695,12 +698,12 @@
toExecute.createArgument().setValue( "-docletpath" );
toExecute.createArgument().setPath( doclet.getPath()
);
}
- for( Enumeration e = doclet.getParams();
e.hasMoreElements(); )
+ for( Enumeration e = doclet.getParams();
e.hasMoreElements(); )
{
- DocletParam param = ( DocletParam )e.nextElement();
+ DocletParam param = (DocletParam)e.nextElement();
if( param.getName() == null )
{
- throw new BuildException( "Doclet parameters
must have a name" );
+ throw new TaskException( "Doclet parameters must
have a name" );
}
toExecute.createArgument().setValue( param.getName()
);
@@ -720,13 +723,13 @@
// add the links arguments
if( links.size() != 0 )
{
- for( Enumeration e = links.elements(); e.hasMoreElements();
)
+ for( Enumeration e = links.elements(); e.hasMoreElements(); )
{
- LinkArgument la = ( LinkArgument )e.nextElement();
+ LinkArgument la = (LinkArgument)e.nextElement();
if( la.getHref() == null )
{
- throw new BuildException( "Links must provide the
URL to the external class documentation." );
+ throw new TaskException( "Links must provide the URL
to the external class documentation." );
}
if( la.isLinkOffline() )
@@ -734,8 +737,8 @@
File packageListLocation = la.getPackagelistLoc();
if( packageListLocation == null )
{
- throw new BuildException( "The package list
location for link " + la.getHref() +
- " must be provided because the link is
offline" );
+ throw new TaskException( "The package list
location for link " + la.getHref() +
+ " must be provided
because the link is offline" );
}
File packageList = new File( packageListLocation,
"package-list" );
if( packageList.exists() )
@@ -747,7 +750,7 @@
else
{
log( "Warning: No package list was found at " +
packageListLocation,
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
}
}
else
@@ -790,14 +793,14 @@
// add the group arguments
if( groups.size() != 0 )
{
- for( Enumeration e = groups.elements(); e.hasMoreElements();
)
+ for( Enumeration e = groups.elements(); e.hasMoreElements();
)
{
- GroupArgument ga = ( GroupArgument )e.nextElement();
+ GroupArgument ga = (GroupArgument)e.nextElement();
String title = ga.getTitle();
String packages = ga.getPackages();
if( title == null || packages == null )
{
- throw new BuildException( "The title and packages
must be specified for group elements." );
+ throw new TaskException( "The title and packages
must be specified for group elements." );
}
toExecute.createArgument().setValue( "-group" );
toExecute.createArgument().setValue( expand( title ) );
@@ -814,7 +817,7 @@
Enumeration enum = packageNames.elements();
while( enum.hasMoreElements() )
{
- PackageName pn = ( PackageName )enum.nextElement();
+ PackageName pn = (PackageName)enum.nextElement();
String name = pn.getName().trim();
if( name.endsWith( ".*" ) )
{
@@ -832,7 +835,7 @@
enum = excludePackageNames.elements();
while( enum.hasMoreElements() )
{
- PackageName pn = ( PackageName )enum.nextElement();
+ PackageName pn = (PackageName)enum.nextElement();
excludePackages.addElement( pn.getName().trim() );
}
}
@@ -859,13 +862,13 @@
toExecute.createArgument().setValue( "@" +
tmpList.getAbsolutePath() );
}
srcListWriter = new PrintWriter( new FileWriter(
tmpList.getAbsolutePath(),
- true ) );
+ true )
);
}
Enumeration enum = sourceFiles.elements();
while( enum.hasMoreElements() )
{
- SourceFile sf = ( SourceFile )enum.nextElement();
+ SourceFile sf = (SourceFile)enum.nextElement();
String sourceFileName = sf.getFile().getAbsolutePath();
if( useExternalFile )
{
@@ -880,7 +883,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error creating temporary file", e
);
+ throw new TaskException( "Error creating temporary file", e
);
}
finally
{
@@ -917,12 +920,12 @@
int ret = exe.execute();
if( ret != 0 && failOnError )
{
- throw new BuildException( "Javadoc returned " + ret );
+ throw new TaskException( "Javadoc returned " + ret );
}
}
catch( IOException e )
{
- throw new BuildException( "Javadoc failed: " + e, e );
+ throw new TaskException( "Javadoc failed: " + e, e );
}
finally
{
@@ -941,7 +944,8 @@
err.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
@@ -967,7 +971,7 @@
// so we need to fall back to assuming javadoc is somewhere on the
// PATH.
File jdocExecutable = new File( System.getProperty( "java.home" ) +
- "/../bin/javadoc" + extension );
+ "/../bin/javadoc" + extension );
if( jdocExecutable.exists() && !Os.isFamily( "netware" ) )
{
@@ -978,7 +982,7 @@
if( !Os.isFamily( "netware" ) )
{
log( "Unable to locate " + jdocExecutable.getAbsolutePath() +
- ". Using \"javadoc\" instead.", Project.MSG_VERBOSE );
+ ". Using \"javadoc\" instead.", Project.MSG_VERBOSE );
}
return "javadoc";
}
@@ -1012,13 +1016,12 @@
else
{
project.log( this,
- "Warning: Leaving out empty argument '" + key + "'",
- Project.MSG_WARN );
+ "Warning: Leaving out empty argument '" + key +
"'",
+ Project.MSG_WARN );
}
}
}
-
private void addArgIf( boolean b, String arg )
{
if( b )
@@ -1039,6 +1042,7 @@
*/
private void evaluatePackages( Commandline toExecute, Path sourcePath,
Vector packages, Vector excludePackages )
+ throws TaskException
{
log( "Source path = " + sourcePath.toString(), Project.MSG_VERBOSE );
StringBuffer msg = new StringBuffer( "Packages = " );
@@ -1068,7 +1072,7 @@
String[] list = sourcePath.list();
if( list == null )
- list = new String[0];
+ list = new String[ 0 ];
FileSet fs = new FileSet();
fs.setDefaultexcludes( useDefaultExcludes );
@@ -1076,7 +1080,7 @@
Enumeration e = packages.elements();
while( e.hasMoreElements() )
{
- String pkg = ( String )e.nextElement();
+ String pkg = (String)e.nextElement();
pkg = pkg.replace( '.', '/' );
if( pkg.endsWith( "*" ) )
{
@@ -1089,7 +1093,7 @@
e = excludePackages.elements();
while( e.hasMoreElements() )
{
- String pkg = ( String )e.nextElement();
+ String pkg = (String)e.nextElement();
pkg = pkg.replace( '.', '/' );
if( pkg.endsWith( "*" ) )
{
@@ -1111,7 +1115,7 @@
for( int j = 0; j < list.length; j++ )
{
- File source = resolveFile( list[j] );
+ File source = resolveFile( list[ j ] );
fs.setDir( source );
DirectoryScanner ds = fs.getDirectoryScanner( project );
@@ -1119,7 +1123,7 @@
for( int i = 0; i < packageDirs.length; i++ )
{
- File pd = new File( source, packageDirs[i] );
+ File pd = new File( source, packageDirs[ i ] );
String[] files = pd.list(
new FilenameFilter()
{
@@ -1135,7 +1139,7 @@
if( files.length > 0 )
{
- String pkgDir = packageDirs[i].replace( '/', '.'
).replace( '\\', '.' );
+ String pkgDir = packageDirs[ i ].replace( '/', '.'
).replace( '\\', '.' );
if( !addedPackages.contains( pkgDir ) )
{
if( useExternalFile )
@@ -1154,7 +1158,7 @@
}
catch( IOException ioex )
{
- throw new BuildException( "Error creating temporary file", ioex
);
+ throw new TaskException( "Error creating temporary file", ioex );
}
finally
{
@@ -1323,7 +1327,9 @@
private Vector packages = new Vector( 3 );
private Html title;
- public GroupArgument() { }
+ public GroupArgument()
+ {
+ }
public void setPackages( String src )
{
@@ -1380,7 +1386,9 @@
private String href;
private File packagelistLoc;
- public LinkArgument() { }
+ public LinkArgument()
+ {
+ }
public void setHref( String hr )
{
@@ -1427,7 +1435,6 @@
{
super( Javadoc.this, level );
}
-
protected void logFlush()
{
1.2 +2 -5
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
Index: LogOutputStream.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LogOutputStream.java 2001/12/15 12:06:21 1.1
+++ LogOutputStream.java 2001/12/16 00:38:01 1.2
@@ -6,13 +6,13 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
-
/**
* Logs each line written to this stream to the log system of ant. Tries to
be
* smart about line separators.<br>
@@ -47,7 +47,6 @@
return level;
}
-
/**
* Writes all remaining
*
@@ -61,7 +60,6 @@
super.close();
}
-
/**
* Write the data to the buffer and flush the buffer, if a line
separator is
* detected.
@@ -72,7 +70,7 @@
public void write( int cc )
throws IOException
{
- final byte c = ( byte )cc;
+ final byte c = (byte)cc;
if( ( c == '\n' ) || ( c == '\r' ) )
{
if( !skip )
@@ -82,7 +80,6 @@
buffer.write( cc );
skip = ( c == '\r' );
}
-
/**
* Converts the buffer to a string and sends it to
<code>processLine</code>
1.3 +4 -3
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java
Index: LogStreamHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LogStreamHandler.java 2001/12/15 14:55:54 1.2
+++ LogStreamHandler.java 2001/12/16 00:38:01 1.3
@@ -6,8 +6,9 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.IOException;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
/**
@@ -28,7 +29,7 @@
public LogStreamHandler( Task task, int outlevel, int errlevel )
{
super( new LogOutputStream( task, outlevel ),
- new LogOutputStream( task, errlevel ) );
+ new LogOutputStream( task, errlevel ) );
}
public void stop()
@@ -42,7 +43,7 @@
catch( IOException e )
{
// plain impossible
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
}
1.3 +65 -60
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Manifest.java
Index: Manifest.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Manifest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Manifest.java 2001/12/15 14:55:54 1.2
+++ Manifest.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -20,7 +21,7 @@
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.EnumeratedAttribute;
@@ -134,7 +135,7 @@
if( !sectionName.getName().equalsIgnoreCase( ATTRIBUTE_NAME
) )
{
throw new ManifestException( "Manifest sections should
start with a \"" + ATTRIBUTE_NAME +
- "\" attribute and not \"" + sectionName.getName() +
"\"" );
+ "\" attribute and not \"" +
sectionName.getName() + "\"" );
}
nextSectionName = sectionName.getValue();
}
@@ -157,10 +158,10 @@
* Construct a manifest from Ant's default manifest file.
*
* @return The DefaultManifest value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public static Manifest getDefaultManifest()
- throws BuildException
+ throws TaskException
{
try
{
@@ -168,7 +169,7 @@
InputStream in = Manifest.class.getResourceAsStream( s );
if( in == null )
{
- throw new BuildException( "Could not find default manifest:
" + s );
+ throw new TaskException( "Could not find default manifest: "
+ s );
}
try
{
@@ -181,11 +182,11 @@
}
catch( ManifestException e )
{
- throw new BuildException( "Default manifest is invalid !!" );
+ throw new TaskException( "Default manifest is invalid !!" );
}
catch( IOException e )
{
- throw new BuildException( "Unable to read default manifest", e );
+ throw new TaskException( "Unable to read default manifest", e );
}
}
@@ -218,16 +219,16 @@
{
Vector warnings = new Vector();
- for( Enumeration e2 = mainSection.getWarnings();
e2.hasMoreElements(); )
+ for( Enumeration e2 = mainSection.getWarnings();
e2.hasMoreElements(); )
{
warnings.addElement( e2.nextElement() );
}
// create a vector and add in the warnings for all the sections
- for( Enumeration e = sections.elements(); e.hasMoreElements(); )
+ for( Enumeration e = sections.elements(); e.hasMoreElements(); )
{
- Section section = ( Section )e.nextElement();
- for( Enumeration e2 = section.getWarnings();
e2.hasMoreElements(); )
+ Section section = (Section)e.nextElement();
+ for( Enumeration e2 = section.getWarnings();
e2.hasMoreElements(); )
{
warnings.addElement( e2.nextElement() );
}
@@ -247,7 +248,7 @@
{
if( section.getName() == null )
{
- throw new BuildException( "Sections must have a name" );
+ throw new TaskException( "Sections must have a name" );
}
sections.put( section.getName().toLowerCase(), section );
}
@@ -259,7 +260,7 @@
return false;
}
- Manifest rhsManifest = ( Manifest )rhs;
+ Manifest rhsManifest = (Manifest)rhs;
if( manifestVersion == null )
{
if( rhsManifest.manifestVersion != null )
@@ -281,10 +282,10 @@
return false;
}
- for( Enumeration e = sections.elements(); e.hasMoreElements(); )
+ for( Enumeration e = sections.elements(); e.hasMoreElements(); )
{
- Section section = ( Section )e.nextElement();
- Section rhsSection = ( Section )rhsManifest.sections.get(
section.getName().toLowerCase() );
+ Section section = (Section)e.nextElement();
+ Section rhsSection = (Section)rhsManifest.sections.get(
section.getName().toLowerCase() );
if( !section.equals( rhsSection ) )
{
return false;
@@ -297,14 +298,14 @@
/**
* Create or update the Manifest when used as a task.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
if( manifestFile == null )
{
- throw new BuildException( "the file attribute is required" );
+ throw new TaskException( "the file attribute is required" );
}
Manifest toWrite = getDefaultManifest();
@@ -319,13 +320,13 @@
}
catch( ManifestException m )
{
- throw new BuildException( "Existing manifest " + manifestFile
- + " is invalid", m );
+ throw new TaskException( "Existing manifest " + manifestFile
+ + " is invalid", m );
}
catch( IOException e )
{
throw new
- BuildException( "Failed to read " + manifestFile, e );
+ TaskException( "Failed to read " + manifestFile, e );
}
finally
{
@@ -336,7 +337,8 @@
f.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
@@ -347,7 +349,7 @@
}
catch( ManifestException m )
{
- throw new BuildException( "Manifest is invalid", m );
+ throw new TaskException( "Manifest is invalid", m );
}
PrintWriter w = null;
@@ -358,7 +360,8 @@
}
catch( IOException e )
{
- throw new BuildException( "Failed to write " + manifestFile e );
+ throw new TaskException( "Failed to write " + manifestFile
+ e );
}
finally
{
@@ -384,11 +387,11 @@
manifestVersion = other.manifestVersion;
}
mainSection.merge( other.mainSection );
- for( Enumeration e = other.sections.keys(); e.hasMoreElements(); )
+ for( Enumeration e = other.sections.keys(); e.hasMoreElements(); )
{
- String sectionName = ( String )e.nextElement();
- Section ourSection = ( Section )sections.get( sectionName );
- Section otherSection = ( Section )other.sections.get(
sectionName );
+ String sectionName = (String)e.nextElement();
+ Section ourSection = (Section)sections.get( sectionName );
+ Section otherSection = (Section)other.sections.get( sectionName
);
if( ourSection == null )
{
sections.put( sectionName.toLowerCase(), otherSection );
@@ -450,9 +453,9 @@
}
}
- for( Enumeration e = sections.elements(); e.hasMoreElements(); )
+ for( Enumeration e = sections.elements(); e.hasMoreElements(); )
{
- Section section = ( Section )e.nextElement();
+ Section section = (Section)e.nextElement();
section.write( writer );
}
}
@@ -477,7 +480,9 @@
/**
* Construct an empty attribute
*/
- public Attribute() { }
+ public Attribute()
+ {
+ }
/**
* Construct an attribute by parsing a line from the Manifest
@@ -564,7 +569,7 @@
return false;
}
- Attribute rhsAttribute = ( Attribute )rhs;
+ Attribute rhsAttribute = (Attribute)rhs;
return ( name != null && rhsAttribute.name != null &&
name.toLowerCase().equals( rhsAttribute.name.toLowerCase() )
&&
value != null && value.equals( rhsAttribute.value ) );
@@ -584,7 +589,7 @@
if( index == -1 )
{
throw new ManifestException( "Manifest line \"" + line + "\"
is not valid as it does not " +
- "contain a name and a value separated by ': ' " );
+ "contain a name and a value
separated by ': ' " );
}
name = line.substring( 0, index );
value = line.substring( index + 2 );
@@ -681,14 +686,14 @@
}
if( attribute instanceof Attribute )
{
- return ( ( Attribute )attribute ).getValue();
+ return ( (Attribute)attribute ).getValue();
}
else
{
String value = "";
- for( Enumeration e = ( ( Vector )attribute ).elements();
e.hasMoreElements(); )
+ for( Enumeration e = ( (Vector)attribute ).elements();
e.hasMoreElements(); )
{
- Attribute classpathAttribute = ( Attribute
)e.nextElement();
+ Attribute classpathAttribute =
(Attribute)e.nextElement();
value += classpathAttribute.getValue() + " ";
}
return value.trim();
@@ -724,20 +729,20 @@
{
if( attribute.getName() == null || attribute.getValue() == null )
{
- throw new BuildException( "Attributes must have name and
value" );
+ throw new TaskException( "Attributes must have name and
value" );
}
if( attribute.getName().equalsIgnoreCase( ATTRIBUTE_NAME ) )
{
warnings.addElement( "\"" + ATTRIBUTE_NAME + "\" attributes
should not occur in the " +
- "main section and must be the first element in all " +
- "other sections: \"" + attribute.getName() + ": " +
attribute.getValue() + "\"" );
+ "main section and must be the first
element in all " +
+ "other sections: \"" +
attribute.getName() + ": " + attribute.getValue() + "\"" );
return attribute.getValue();
}
if( attribute.getName().toLowerCase().startsWith(
ATTRIBUTE_FROM.toLowerCase() ) )
{
warnings.addElement( "Manifest attributes should not start
with \"" +
- ATTRIBUTE_FROM + "\" in \"" + attribute.getName() + ": "
+ attribute.getValue() + "\"" );
+ ATTRIBUTE_FROM + "\" in \"" +
attribute.getName() + ": " + attribute.getValue() + "\"" );
}
else
{
@@ -745,7 +750,7 @@
String attributeName = attribute.getName().toLowerCase();
if( attributeName.equals( ATTRIBUTE_CLASSPATH ) )
{
- Vector classpathAttrs = ( Vector )attributes.get(
attributeName );
+ Vector classpathAttrs = (Vector)attributes.get(
attributeName );
if( classpathAttrs == null )
{
classpathAttrs = new Vector();
@@ -756,7 +761,7 @@
else if( attributes.containsKey( attributeName ) )
{
throw new ManifestException( "The attribute \"" +
attribute.getName() + "\" may not " +
- "occur more than once in the same section" );
+ "occur more than once in
the same section" );
}
else
{
@@ -772,8 +777,8 @@
String check = addAttributeAndCheck( attribute );
if( check != null )
{
- throw new BuildException( "Specify the section name using
the \"name\" attribute of the <section> element rather " +
- "than using a \"Name\" manifest attribute" );
+ throw new TaskException( "Specify the section name using the
\"name\" attribute of the <section> element rather " +
+ "than using a \"Name\" manifest
attribute" );
}
}
@@ -784,16 +789,16 @@
return false;
}
- Section rhsSection = ( Section )rhs;
+ Section rhsSection = (Section)rhs;
if( attributes.size() != rhsSection.attributes.size() )
{
return false;
}
- for( Enumeration e = attributes.elements(); e.hasMoreElements();
)
+ for( Enumeration e = attributes.elements(); e.hasMoreElements();
)
{
- Attribute attribute = ( Attribute )e.nextElement();
- Attribute rshAttribute = ( Attribute
)rhsSection.attributes.get( attribute.getName().toLowerCase() );
+ Attribute attribute = (Attribute)e.nextElement();
+ Attribute rshAttribute =
(Attribute)rhsSection.attributes.get( attribute.getName().toLowerCase() );
if( !attribute.equals( rshAttribute ) )
{
return false;
@@ -818,16 +823,16 @@
throw new ManifestException( "Unable to merge sections with
different names" );
}
- for( Enumeration e = section.attributes.keys();
e.hasMoreElements(); )
+ for( Enumeration e = section.attributes.keys();
e.hasMoreElements(); )
{
- String attributeName = ( String )e.nextElement();
+ String attributeName = (String)e.nextElement();
if( attributeName.equals( ATTRIBUTE_CLASSPATH ) &&
attributes.containsKey( attributeName ) )
{
// classpath entries are vetors which are merged
- Vector classpathAttrs = ( Vector
)section.attributes.get( attributeName );
- Vector ourClasspathAttrs = ( Vector )attributes.get(
attributeName );
- for( Enumeration e2 = classpathAttrs.elements();
e2.hasMoreElements(); )
+ Vector classpathAttrs = (Vector)section.attributes.get(
attributeName );
+ Vector ourClasspathAttrs = (Vector)attributes.get(
attributeName );
+ for( Enumeration e2 = classpathAttrs.elements();
e2.hasMoreElements(); )
{
ourClasspathAttrs.addElement( e2.nextElement() );
}
@@ -840,7 +845,7 @@
}
// add in the warnings
- for( Enumeration e = section.warnings.elements();
e.hasMoreElements(); )
+ for( Enumeration e = section.warnings.elements();
e.hasMoreElements(); )
{
warnings.addElement( e.nextElement() );
}
@@ -924,20 +929,20 @@
Attribute nameAttr = new Attribute( ATTRIBUTE_NAME, name );
nameAttr.write( writer );
}
- for( Enumeration e = attributes.elements(); e.hasMoreElements();
)
+ for( Enumeration e = attributes.elements(); e.hasMoreElements();
)
{
Object object = e.nextElement();
if( object instanceof Attribute )
{
- Attribute attribute = ( Attribute )object;
+ Attribute attribute = (Attribute)object;
attribute.write( writer );
}
else
{
- Vector attrList = ( Vector )object;
- for( Enumeration e2 = attrList.elements();
e2.hasMoreElements(); )
+ Vector attrList = (Vector)object;
+ for( Enumeration e2 = attrList.elements();
e2.hasMoreElements(); )
{
- Attribute attribute = ( Attribute )e2.nextElement();
+ Attribute attribute = (Attribute)e2.nextElement();
attribute.write( writer );
}
}
1.2 +0 -2
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ManifestException.java
Index: ManifestException.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ManifestException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ManifestException.java 2001/12/15 12:06:21 1.1
+++ ManifestException.java 2001/12/16 00:38:01 1.2
@@ -7,8 +7,6 @@
*/
package org.apache.tools.ant.taskdefs;
-
-
/**
* Exception thrown indicating problems in a JAR Manifest
*
1.3 +3 -3
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
Index: MatchingTask.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MatchingTask.java 2001/12/15 14:55:54 1.2
+++ MatchingTask.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,10 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
-import java.util.StringTokenizer;
-import java.util.Vector;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
@@ -145,6 +144,7 @@
* @return The DirectoryScanner value
*/
protected DirectoryScanner getDirectoryScanner( File baseDir )
+ throws TaskException
{
fileset.setDir( baseDir );
fileset.setDefaultexcludes( useDefaultExcludes );
1.3 +6 -6
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Mkdir.java
Index: Mkdir.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Mkdir.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Mkdir.java 2001/12/15 14:55:54 1.2
+++ Mkdir.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,11 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
-
/**
* Creates a given directory.
*
@@ -28,16 +28,16 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( dir == null )
{
- throw new BuildException( "dir attribute is required" );
+ throw new TaskException( "dir attribute is required" );
}
if( dir.isFile() )
{
- throw new BuildException( "Unable to create directory as a file
already exists with that name: " + dir.getAbsolutePath() );
+ throw new TaskException( "Unable to create directory as a file
already exists with that name: " + dir.getAbsolutePath() );
}
if( !dir.exists() )
@@ -47,7 +47,7 @@
{
String msg = "Directory " + dir.getAbsolutePath() + "
creation was not " +
"successful for an unknown reason";
- throw new BuildException( msg );
+ throw new TaskException( msg );
}
log( "Created dir: " + dir.getAbsolutePath() );
}
1.3 +36 -35
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Move.java
Index: Move.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Move.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Move.java 2001/12/15 14:55:54 1.2
+++ Move.java 2001/12/16 00:38:01 1.3
@@ -6,10 +6,11 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.FilterSet;
@@ -53,7 +54,7 @@
for( int i = 0; i < list.length; i++ )
{
- String s = list[i];
+ String s = list[ i ];
File f = new File( d, s );
if( f.isDirectory() )
{
@@ -61,19 +62,19 @@
}
else
{
- throw new BuildException( "UNEXPECTED ERROR - The file " +
f.getAbsolutePath() + " should not exist!" );
+ throw new TaskException( "UNEXPECTED ERROR - The file " +
f.getAbsolutePath() + " should not exist!" );
}
}
log( "Deleting directory " + d.getAbsolutePath(), verbosity );
if( !d.delete() )
{
- throw new BuildException( "Unable to delete directory " +
d.getAbsolutePath() );
+ throw new TaskException( "Unable to delete directory " +
d.getAbsolutePath() );
}
}
-//************************************************************************
-// protected and private methods
-//************************************************************************
+
//************************************************************************
+ // protected and private methods
+
//************************************************************************
protected void doFileOperations()
{
@@ -83,33 +84,33 @@
Enumeration e = completeDirMap.keys();
while( e.hasMoreElements() )
{
- File fromDir = ( File )e.nextElement();
- File toDir = ( File )completeDirMap.get( fromDir );
+ File fromDir = (File)e.nextElement();
+ File toDir = (File)completeDirMap.get( fromDir );
try
{
log( "Attempting to rename dir: " + fromDir +
- " to " + toDir, verbosity );
+ " to " + toDir, verbosity );
renameFile( fromDir, toDir, filtering, forceOverwrite );
}
catch( IOException ioe )
{
String msg = "Failed to rename dir " + fromDir
- + " to " + toDir
- + " due to " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ + " to " + toDir
+ + " due to " + ioe.getMessage();
+ throw new TaskException( msg, ioe );
}
}
}
if( fileCopyMap.size() > 0 )
{// files to move
log( "Moving " + fileCopyMap.size() + " files to " +
- destDir.getAbsolutePath() );
+ destDir.getAbsolutePath() );
Enumeration e = fileCopyMap.keys();
while( e.hasMoreElements() )
{
- String fromFile = ( String )e.nextElement();
- String toFile = ( String )fileCopyMap.get( fromFile );
+ String fromFile = (String)e.nextElement();
+ String toFile = (String)fileCopyMap.get( fromFile );
if( fromFile.equals( toFile ) )
{
@@ -127,15 +128,15 @@
try
{
log( "Attempting to rename: " + fromFile +
- " to " + toFile, verbosity );
+ " to " + toFile, verbosity );
moved = renameFile( f, d, filtering, forceOverwrite
);
}
catch( IOException ioe )
{
String msg = "Failed to rename " + fromFile
- + " to " + toFile
- + " due to " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ + " to " + toFile
+ + " due to " + ioe.getMessage();
+ throw new TaskException( msg, ioe );
}
if( !moved )
@@ -149,26 +150,26 @@
{
executionFilters.addFilterSet(
project.getGlobalFilterSet() );
}
- for( Enumeration filterEnum =
getFilterSets().elements(); filterEnum.hasMoreElements(); )
+ for( Enumeration filterEnum =
getFilterSets().elements(); filterEnum.hasMoreElements(); )
{
- executionFilters.addFilterSet( ( FilterSet
)filterEnum.nextElement() );
+ executionFilters.addFilterSet(
(FilterSet)filterEnum.nextElement() );
}
getFileUtils().copyFile( f, d, executionFilters,
- forceOverwrite );
+ forceOverwrite );
f = new File( fromFile );
if( !f.delete() )
{
- throw new BuildException( "Unable to delete
file "
- + f.getAbsolutePath() );
+ throw new TaskException( "Unable to delete
file "
+ +
f.getAbsolutePath() );
}
}
catch( IOException ioe )
{
String msg = "Failed to copy " + fromFile + " to
"
- + toFile
- + " due to " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ + toFile
+ + " due to " + ioe.getMessage();
+ throw new TaskException( msg, ioe );
}
}
}
@@ -181,7 +182,7 @@
int count = 0;
while( e.hasMoreElements() )
{
- File d = new File( ( String )e.nextElement() );
+ File d = new File( (String)e.nextElement() );
if( !d.exists() )
{
if( !d.mkdirs() )
@@ -206,7 +207,7 @@
Enumeration e = filesets.elements();
while( e.hasMoreElements() )
{
- FileSet fs = ( FileSet )e.nextElement();
+ FileSet fs = (FileSet)e.nextElement();
File dir = fs.getDir( project );
if( okToDelete( dir ) )
@@ -231,7 +232,7 @@
for( int i = 0; i < list.length; i++ )
{
- String s = list[i];
+ String s = list[ i ];
File f = new File( d, s );
if( f.isDirectory() )
{
@@ -260,12 +261,12 @@
* @param filtering Description of Parameter
* @param overwrite Description of Parameter
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
* @throws IOException
*/
protected boolean renameFile( File sourceFile, File destFile,
boolean filtering, boolean overwrite )
- throws IOException, BuildException
+ throws IOException, TaskException
{
boolean renamed = true;
@@ -287,8 +288,8 @@
{
if( !destFile.delete() )
{
- throw new BuildException( "Unable to remove existing
file "
- + destFile );
+ throw new TaskException( "Unable to remove existing file
"
+ + destFile );
}
}
renamed = sourceFile.renameTo( destFile );
1.3 +9 -8
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Pack.java
Index: Pack.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Pack.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Pack.java 2001/12/15 14:55:54 1.2
+++ Pack.java 2001/12/16 00:38:01 1.3
@@ -6,12 +6,13 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
/**
@@ -37,7 +38,7 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
validate();
log( "Building: " + zipFile.getAbsolutePath() );
@@ -64,30 +65,30 @@
{
if( zipFile == null )
{
- throw new BuildException( "zipfile attribute is required" );
+ throw new TaskException( "zipfile attribute is required" );
}
if( source == null )
{
- throw new BuildException( "src attribute is required" );
+ throw new TaskException( "src attribute is required" );
}
if( source.isDirectory() )
{
- throw new BuildException( "Src attribute must not " +
- "represent a directory!" );
+ throw new TaskException( "Src attribute must not " +
+ "represent a directory!" );
}
}
private void zipFile( InputStream in, OutputStream zOut )
throws IOException
{
- byte[] buffer = new byte[8 * 1024];
+ byte[] buffer = new byte[ 8 * 1024 ];
int count = 0;
do
{
zOut.write( buffer, 0, count );
count = in.read( buffer, 0, buffer.length );
- }while ( count != -1 );
+ } while( count != -1 );
}
}
1.3 +19 -20
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Parallel.java
Index: Parallel.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Parallel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Parallel.java 2001/12/15 14:55:54 1.2
+++ Parallel.java 2001/12/16 00:38:01 1.3
@@ -6,14 +6,14 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.util.Enumeration;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Location;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.TaskContainer;
-
/**
* Implements a multi threaded task execution. <p>
*
@@ -23,7 +23,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Conor MacNeill </a>
*/
public class Parallel extends Task
- implements TaskContainer
+ implements TaskContainer
{
/**
@@ -31,17 +31,16 @@
*/
private Vector nestedTasks = new Vector();
-
/**
* Add a nested task to execute parallel (asynchron). <p>
*
*
*
* @param nestedTask Nested task to be executed in parallel
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void addTask( Task nestedTask )
- throws BuildException
+ throws TaskException
{
nestedTasks.addElement( nestedTask );
}
@@ -50,23 +49,23 @@
* Block execution until the specified time or for a specified amount of
* milliseconds and if defined, execute the wait status.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
- TaskThread[] threads = new TaskThread[nestedTasks.size()];
+ TaskThread[] threads = new TaskThread[ nestedTasks.size() ];
int threadNumber = 0;
for( Enumeration e = nestedTasks.elements(); e.hasMoreElements();
threadNumber++ )
{
- Task nestedTask = ( Task )e.nextElement();
- threads[threadNumber] = new TaskThread( threadNumber, nestedTask
);
+ Task nestedTask = (Task)e.nextElement();
+ threads[ threadNumber ] = new TaskThread( threadNumber,
nestedTask );
}
// now start all threads
for( int i = 0; i < threads.length; ++i )
{
- threads[i].start();
+ threads[ i ].start();
}
// now join to all the threads
@@ -74,7 +73,7 @@
{
try
{
- threads[i].join();
+ threads[ i ].join();
}
catch( InterruptedException ie )
{
@@ -91,7 +90,7 @@
;
for( int i = 0; i < threads.length; ++i )
{
- Throwable t = threads[i].getException();
+ Throwable t = threads[ i ].getException();
if( t != null )
{
numExceptions++;
@@ -99,10 +98,10 @@
{
firstException = t;
}
- if( t instanceof BuildException &&
+ if( t instanceof TaskException &&
firstLocation == Location.UNKNOWN_LOCATION )
{
- firstLocation = ( ( BuildException )t ).getLocation();
+ firstLocation = ( (TaskException)t ).getLocation();
}
exceptionMessage.append( lSep );
exceptionMessage.append( t.getMessage() );
@@ -111,18 +110,18 @@
if( numExceptions == 1 )
{
- if( firstException instanceof BuildException )
+ if( firstException instanceof TaskException )
{
- throw ( BuildException )firstException;
+ throw (TaskException)firstException;
}
else
{
- throw new BuildException( "Error", firstException );
+ throw new TaskException( "Error", firstException );
}
}
else if( numExceptions > 1 )
{
- throw new BuildException( exceptionMessage.toString() );
+ throw new TaskException( exceptionMessage.toString() );
}
}
1.3 +12 -11
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Patch.java
Index: Patch.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Patch.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Patch.java 2001/12/15 14:55:54 1.2
+++ Patch.java 2001/12/16 00:38:01 1.3
@@ -6,9 +6,10 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.IOException;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.Commandline;
@@ -70,7 +71,7 @@
{
if( !file.exists() )
{
- throw new BuildException( "patchfile " + file + " doesn\'t
exist" );
+ throw new TaskException( "patchfile " + file + " doesn\'t exist"
);
}
cmd.createArgument().setValue( "-i" );
cmd.createArgument().setFile( file );
@@ -110,27 +111,27 @@
* patch's <i>-p</i> option.
*
* @param num The new Strip value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void setStrip( int num )
- throws BuildException
+ throws TaskException
{
if( num < 0 )
{
- throw new BuildException( "strip has to be >= 0" );
+ throw new TaskException( "strip has to be >= 0" );
}
cmd.createArgument().setValue( "-p" + num );
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( !havePatchfile )
{
- throw new BuildException( "patchfile argument is required" );
+ throw new TaskException( "patchfile argument is required" );
}
- Commandline toExecute = ( Commandline )cmd.clone();
+ Commandline toExecute = (Commandline)cmd.clone();
toExecute.setExecutable( "patch" );
if( originalFile != null )
@@ -139,8 +140,8 @@
}
Execute exe = new Execute( new LogStreamHandler( this,
Project.MSG_INFO,
- Project.MSG_WARN ),
- null );
+ Project.MSG_WARN ),
+ null );
exe.setCommandline( toExecute.getCommandline() );
try
{
@@ -148,7 +149,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
1.2 +17 -16
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java
Index: PathConvert.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PathConvert.java 2001/12/15 12:06:21 1.1
+++ PathConvert.java 2001/12/16 00:38:01 1.2
@@ -6,9 +6,10 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
@@ -96,7 +97,7 @@
if( !targetOS.equals( "windows" ) && !target.equals( "unix" ) &&
!targetOS.equals( "netware" ) )
{
- throw new BuildException( "targetos must be one of 'unix',
'netware', or 'windows'" );
+ throw new TaskException( "targetos must be one of 'unix',
'netware', or 'windows'" );
}
// Currently, we deal with only two path formats: Unix and Windows
@@ -153,10 +154,10 @@
/**
* Do the execution.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
// If we are a reference, the create a Path from the reference
@@ -172,12 +173,12 @@
}
else if( obj instanceof FileSet )
{
- FileSet fs = ( FileSet )obj;
+ FileSet fs = (FileSet)obj;
path.addFileset( fs );
}
else
{
- throw new BuildException( "'refid' does not refer to a path
or fileset" );
+ throw new TaskException( "'refid' does not refer to a path
or fileset" );
}
}
@@ -206,7 +207,7 @@
for( int i = 0; i < elems.length; i++ )
{
- String elem = elems[i];
+ String elem = elems[ i ];
elem = mapElement( elem );// Apply the path prefix map
@@ -249,7 +250,7 @@
for( int i = 0; i < size; i++ )
{
- MapEntry entry = ( MapEntry )prefixMap.elementAt( i );
+ MapEntry entry = (MapEntry)prefixMap.elementAt( i );
String newElem = entry.apply( elem );
// Note I'm using "!=" to see if we got a new object back
from
@@ -272,30 +273,30 @@
*
* @return Description of the Returned Value
*/
- private BuildException noChildrenAllowed()
+ private TaskException noChildrenAllowed()
{
- return new BuildException( "You must not specify nested PATH
elements when using refid" );
+ return new TaskException( "You must not specify nested PATH elements
when using refid" );
}
/**
* Validate that all our parameters have been properly initialized.
*
- * @throws BuildException if something is not setup properly
+ * @throws TaskException if something is not setup properly
*/
private void validateSetup()
- throws BuildException
+ throws TaskException
{
if( path == null )
- throw new BuildException( "You must specify a path to convert" );
+ throw new TaskException( "You must specify a path to convert" );
if( property == null )
- throw new BuildException( "You must specify a property" );
+ throw new TaskException( "You must specify a property" );
// Must either have a target OS or both a dirSep and pathSep
if( targetOS == null && pathSep == null && dirSep == null )
- throw new BuildException( "You must specify at least one of
targetOS, dirSep, or pathSep" );
+ throw new TaskException( "You must specify at least one of
targetOS, dirSep, or pathSep" );
// Determine the separator strings. The dirsep and pathsep
attributes
// override the targetOS settings.
@@ -367,7 +368,7 @@
{
if( from == null || to == null )
{
- throw new BuildException( "Both 'from' and 'to' must be set
in a map entry" );
+ throw new TaskException( "Both 'from' and 'to' must be set
in a map entry" );
}
// If we're on windows, then do the comparison ignoring case
1.2 +3 -2
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java
Index: ProcessDestroyer.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ProcessDestroyer.java 2001/12/15 12:06:21 1.1
+++ ProcessDestroyer.java 2001/12/16 00:38:01 1.2
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.Vector;
@@ -16,7 +17,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Michael Newcomb</a>
*/
class ProcessDestroyer
- extends Thread
+ extends Thread
{
private Vector processes = new Vector();
@@ -83,7 +84,7 @@
Enumeration e = processes.elements();
while( e.hasMoreElements() )
{
- ( ( Process )e.nextElement() ).destroy();
+ ( (Process)e.nextElement() ).destroy();
}
}
}
1.4 +0 -1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java
Index: Property.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Property.java 2001/12/15 15:20:23 1.3
+++ Property.java 2001/12/16 00:38:01 1.4
@@ -16,7 +16,6 @@
import java.util.Vector;
import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader;
-import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
import org.apache.tools.ant.Task;
1.2 +12 -10
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java
Index: PumpStreamHandler.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PumpStreamHandler.java 2001/12/15 12:06:21 1.1
+++ PumpStreamHandler.java 2001/12/16 00:38:01 1.2
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -41,28 +42,26 @@
this( System.out, System.err );
}
-
public void setProcessErrorStream( InputStream is )
{
createProcessErrorPump( is, err );
}
-
- public void setProcessInputStream( OutputStream os ) { }
+ public void setProcessInputStream( OutputStream os )
+ {
+ }
public void setProcessOutputStream( InputStream is )
{
createProcessOutputPump( is, out );
}
-
public void start()
{
inputThread.start();
errorThread.start();
}
-
public void stop()
{
try
@@ -70,25 +69,29 @@
inputThread.join();
}
catch( InterruptedException e )
- {}
+ {
+ }
try
{
errorThread.join();
}
catch( InterruptedException e )
- {}
+ {
+ }
try
{
err.flush();
}
catch( IOException e )
- {}
+ {
+ }
try
{
out.flush();
}
catch( IOException e )
- {}
+ {
+ }
}
protected OutputStream getErr()
@@ -110,7 +113,6 @@
{
inputThread = createPump( is, os );
}
-
/**
* Creates a stream pumper to copy the given input stream to the given
1.2 +12 -11
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java
Index: Recorder.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Recorder.java 2001/12/15 12:06:21 1.1
+++ Recorder.java 2001/12/16 00:38:01 1.2
@@ -6,11 +6,12 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Hashtable;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.EnumeratedAttribute;
@@ -133,16 +134,16 @@
/**
* The main execution.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
if( filename == null )
- throw new BuildException( "No filename specified" );
+ throw new TaskException( "No filename specified" );
getProject().log( "setting a recorder for name " + filename,
- Project.MSG_DEBUG );
+ Project.MSG_DEBUG );
// get the recorder entry
RecorderEntry recorder = getRecorder( filename, getProject() );
@@ -158,10 +159,10 @@
* @param name Description of Parameter
* @param proj Description of Parameter
* @return The Recorder value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected RecorderEntry getRecorder( String name, Project proj )
- throws BuildException
+ throws TaskException
{
Object o = recorderEntries.get( name );
RecorderEntry entry;
@@ -187,15 +188,15 @@
}
catch( IOException ioe )
{
- throw new BuildException( "Problems creating a recorder
entry",
- ioe );
+ throw new TaskException( "Problems creating a recorder
entry",
+ ioe );
}
proj.addBuildListener( entry );
recorderEntries.put( name, entry );
}
else
{
- entry = ( RecorderEntry )o;
+ entry = (RecorderEntry)o;
}
return entry;
}
@@ -228,7 +229,7 @@
public static class VerbosityLevelChoices extends EnumeratedAttribute
{
private final static String[] values = {"error", "warn", "info",
- "verbose", "debug"};
+ "verbose", "debug"};
public String[] getValues()
{
1.2 +5 -5
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java
Index: RecorderEntry.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RecorderEntry.java 2001/12/15 12:06:21 1.1
+++ RecorderEntry.java 2001/12/16 00:38:01 1.2
@@ -6,13 +6,13 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.PrintStream;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.util.StringUtils;
-
/**
* This is a class that represents a recorder. This is the listener to the
build
* process.
@@ -66,14 +66,14 @@
if( minutes > 0 )
{
return Long.toString( minutes ) + " minute"
- + ( minutes == 1 ? " " : "s " )
- + Long.toString( seconds % 60 ) + " second"
- + ( seconds % 60 == 1 ? "" : "s" );
+ + ( minutes == 1 ? " " : "s " )
+ + Long.toString( seconds % 60 ) + " second"
+ + ( seconds % 60 == 1 ? "" : "s" );
}
else
{
return Long.toString( seconds ) + " second"
- + ( seconds % 60 == 1 ? "" : "s" );
+ + ( seconds % 60 == 1 ? "" : "s" );
}
}
1.3 +40 -39
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java
Index: Replace.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Replace.java 2001/12/15 14:55:54 1.2
+++ Replace.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
@@ -21,7 +22,7 @@
import java.io.Writer;
import java.util.Properties;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.util.FileUtils;
@@ -59,7 +60,6 @@
private int fileCount;
private int replaceCount;
-
/**
* Set the source files path when using matching tasks.
*
@@ -80,7 +80,6 @@
this.encoding = encoding;
}
-
/**
* Set the source file.
*
@@ -133,7 +132,7 @@
}
public Properties getProperties( File propertyFile )
- throws BuildException
+ throws TaskException
{
Properties properties = new Properties();
@@ -144,12 +143,12 @@
catch( FileNotFoundException e )
{
String message = "Property file (" + propertyFile.getPath() + ")
not found.";
- throw new BuildException( message );
+ throw new TaskException( message );
}
catch( IOException e )
{
String message = "Property file (" + propertyFile.getPath() + ")
cannot be loaded.";
- throw new BuildException( message );
+ throw new TaskException( message );
}
return properties;
@@ -194,10 +193,10 @@
/**
* Do the execution.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
validateAttributes();
@@ -222,7 +221,7 @@
for( int i = 0; i < srcs.length; i++ )
{
- File file = new File( dir, srcs[i] );
+ File file = new File( dir, srcs[ i ] );
processFile( file );
}
}
@@ -236,47 +235,47 @@
/**
* Validate attributes provided for this task in .xml build file.
*
- * @exception BuildException if any supplied attribute is invalid or any
+ * @exception TaskException if any supplied attribute is invalid or any
* mandatory attribute is missing
*/
public void validateAttributes()
- throws BuildException
+ throws TaskException
{
if( src == null && dir == null )
{
String message = "Either the file or the dir attribute " + "must
be specified";
- throw new BuildException( message );
+ throw new TaskException( message );
}
if( propertyFile != null && !propertyFile.exists() )
{
String message = "Property file " + propertyFile.getPath() + "
does not exist.";
- throw new BuildException( message );
+ throw new TaskException( message );
}
if( token == null && replacefilters.size() == 0 )
{
String message = "Either token or a nested replacefilter "
- + "must be specified";
- throw new BuildException( message);
+ + "must be specified";
+ throw new TaskException( message );
}
if( token != null && "".equals( token.getText() ) )
{
String message = "The token attribute must not be an empty
string.";
- throw new BuildException( message );
+ throw new TaskException( message );
}
}
/**
* Validate nested elements.
*
- * @exception BuildException if any supplied attribute is invalid or any
+ * @exception TaskException if any supplied attribute is invalid or any
* mandatory attribute is missing
*/
public void validateReplacefilters()
- throws BuildException
+ throws TaskException
{
for( int i = 0; i < replacefilters.size(); i++ )
{
- Replacefilter element = ( Replacefilter
)replacefilters.elementAt( i );
+ Replacefilter element = (Replacefilter)replacefilters.elementAt(
i );
element.validate();
}
}
@@ -286,27 +285,27 @@
* on a temporary file which then replaces the original file.
*
* @param src the source file
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private void processFile( File src )
- throws BuildException
+ throws TaskException
{
if( !src.exists() )
{
- throw new BuildException( "Replace: source file " +
src.getPath() + " doesn't exist" );
+ throw new TaskException( "Replace: source file " + src.getPath()
+ " doesn't exist" );
}
File temp = fileUtils.createTempFile( "rep", ".tmp",
- fileUtils.getParentFile( src ) );
+ fileUtils.getParentFile( src )
);
Reader reader = null;
Writer writer = null;
try
{
reader = encoding == null ? new FileReader( src )
- : new InputStreamReader( new FileInputStream( src ),
encoding );
+ : new InputStreamReader( new FileInputStream( src ),
encoding );
writer = encoding == null ? new FileWriter( temp )
- : new OutputStreamWriter( new FileOutputStream( temp ),
encoding );
+ : new OutputStreamWriter( new FileOutputStream( temp ),
encoding );
BufferedReader br = new BufferedReader( reader );
BufferedWriter bw = new BufferedWriter( writer );
@@ -316,7 +315,7 @@
// when multibyte characters exist in the source file
// but then again, it might be smaller than needed on
// platforms like Windows where length can't be trusted
- int fileLengthInBytes = ( int )( src.length() );
+ int fileLengthInBytes = (int)( src.length() );
StringBuffer tmpBuf = new StringBuffer( fileLengthInBytes );
int readChar = 0;
int totread = 0;
@@ -327,7 +326,7 @@
{
break;
}
- tmpBuf.append( ( char )readChar );
+ tmpBuf.append( (char)readChar );
totread++;
}
@@ -381,8 +380,8 @@
}
catch( IOException ioe )
{
- throw new BuildException( "IOException in " + src + " - " +
- ioe.getClass().getName() + ":" + ioe.getMessage(), ioe );
+ throw new TaskException( "IOException in " + src + " - " +
+ ioe.getClass().getName() + ":" +
ioe.getMessage(), ioe );
}
finally
{
@@ -393,7 +392,8 @@
reader.close();
}
catch( IOException e )
- {}
+ {
+ }
}
if( writer != null )
{
@@ -402,7 +402,8 @@
writer.close();
}
catch( IOException e )
- {}
+ {
+ }
}
if( temp != null )
{
@@ -418,7 +419,7 @@
for( int i = 0; i < replacefilters.size(); i++ )
{
- Replacefilter filter = ( Replacefilter
)replacefilters.elementAt( i );
+ Replacefilter filter = (Replacefilter)replacefilters.elementAt(
i );
//for each found token, replace with value
log( "Replacing in " + filename + ": " + filter.getToken() + "
--> " + filter.getReplaceValue(), Project.MSG_VERBOSE );
@@ -518,7 +519,7 @@
{
if( property != null )
{
- return ( String )properties.getProperty( property );
+ return (String)properties.getProperty( property );
}
else if( value != null )
{
@@ -546,26 +547,26 @@
}
public void validate()
- throws BuildException
+ throws TaskException
{
//Validate mandatory attributes
if( token == null )
{
String message = "token is a mandatory attribute " + "of
replacefilter.";
- throw new BuildException( message );
+ throw new TaskException( message );
}
if( "".equals( token ) )
{
String message = "The token attribute must not be an empty
string.";
- throw new BuildException( message );
+ throw new TaskException( message );
}
//value and property are mutually exclusive attributes
if( ( value != null ) && ( property != null ) )
{
String message = "Either value or property " + "can be
specified, but a replacefilter " + "element cannot have both.";
- throw new BuildException( message );
+ throw new TaskException( message );
}
if( ( property != null ) )
@@ -574,7 +575,7 @@
if( propertyFile == null )
{
String message = "The replacefilter's property attribute
" + "can only be used with the replacetask's " + "propertyFile attribute.";
- throw new BuildException( message );
+ throw new TaskException( message );
}
//Make sure property exists in property file
@@ -582,7 +583,7 @@
properties.getProperty( property ) == null )
{
String message = "property \"" + property + "\" was not
found in " + propertyFile.getPath();
- throw new BuildException( message );
+ throw new TaskException( message );
}
}
}
1.4 +1 -1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java
Index: Rmic.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Rmic.java 2001/12/15 15:20:23 1.3
+++ Rmic.java 2001/12/16 00:38:01 1.4
@@ -681,7 +681,7 @@
{
String msg = "Failed to copy " + oldFile + " to " +
newFile + " due to " + ioe.getMessage();
- newFile + " due to " + ioe.getMessage();
+ newFile + " due to " + ioe.getMessage();
throw new TaskException( msg, ioe );
}
}
1.3 +19 -15
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java
Index: SendEmail.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SendEmail.java 2001/12/15 14:55:54 1.2
+++ SendEmail.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -14,7 +15,7 @@
import java.util.Enumeration;
import java.util.StringTokenizer;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.mail.MailMessage;
@@ -173,11 +174,12 @@
private String subject;
private String toList;
-
/**
* Creates new SendEmail
*/
- public SendEmail() { }
+ public SendEmail()
+ {
+ }
/**
* Sets the FailOnError attribute of the MimeMail object
@@ -196,6 +198,7 @@
* @param filenames Filenames to include as the message body of this
email.
*/
public void setFiles( String filenames )
+ throws TaskException
{
StringTokenizer t = new StringTokenizer( filenames, ", " );
@@ -279,10 +282,10 @@
/**
* Executes this build task.
*
- * @throws BuildException if there is an error during task execution.
+ * @throws TaskException if there is an error during task execution.
*/
public void execute()
- throws BuildException
+ throws TaskException
{
try
{
@@ -295,7 +298,7 @@
}
else
{
- throw new BuildException( "Attribute \"from\" is required."
);
+ throw new TaskException( "Attribute \"from\" is required." );
}
if( toList != null )
@@ -309,7 +312,7 @@
}
else
{
- throw new BuildException( "Attribute \"toList\" is
required." );
+ throw new TaskException( "Attribute \"toList\" is required."
);
}
if( subject != null )
@@ -321,15 +324,15 @@
{
PrintStream out = mailMessage.getPrintStream();
- for( Enumeration e = files.elements(); e.hasMoreElements();
)
+ for( Enumeration e = files.elements(); e.hasMoreElements(); )
{
- File file = ( File )e.nextElement();
+ File file = (File)e.nextElement();
if( file.exists() && file.canRead() )
{
int bufsize = 1024;
int length;
- byte[] buf = new byte[bufsize];
+ byte[] buf = new byte[ bufsize ];
if( includefilenames )
{
String filename = file.getName();
@@ -364,15 +367,16 @@
in.close();
}
catch( IOException ioe )
- {}
+ {
+ }
}
}
}
else
{
- throw new BuildException( "File \"" + file.getName()
- + "\" does not exist or is not readable." );
+ throw new TaskException( "File \"" + file.getName()
+ + "\" does not exist or is
not readable." );
}
}
}
@@ -383,7 +387,7 @@
}
else
{
- throw new BuildException( "Attribute \"file\" or \"message\"
is required." );
+ throw new TaskException( "Attribute \"file\" or \"message\"
is required." );
}
log( "Sending email" );
@@ -394,7 +398,7 @@
String err = "IO error sending mail " + ioe.toString();
if( failOnError )
{
- throw new BuildException( err, ioe );
+ throw new TaskException( err, ioe );
}
else
{
1.2 +7 -7
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sequential.java
Index: Sequential.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sequential.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Sequential.java 2001/12/15 12:06:21 1.1
+++ Sequential.java 2001/12/16 00:38:01 1.2
@@ -6,13 +6,13 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.util.Enumeration;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.TaskContainer;
-
/**
* Implements a single threaded task execution. <p>
*
@@ -21,7 +21,7 @@
* @author Thomas Christen <a href="mailto:[EMAIL PROTECTED]">[EMAIL
PROTECTED]</a>
*/
public class Sequential extends Task
- implements TaskContainer
+ implements TaskContainer
{
/**
@@ -46,14 +46,14 @@
/**
* Execute all nestedTasks.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
- for( Enumeration e = nestedTasks.elements(); e.hasMoreElements(); )
+ for( Enumeration e = nestedTasks.elements(); e.hasMoreElements(); )
{
- Task nestedTask = ( Task )e.nextElement();
+ Task nestedTask = (Task)e.nextElement();
nestedTask.perform();
}
}
1.2 +15 -14
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SignJar.java
Index: SignJar.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SignJar.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SignJar.java 2001/12/15 12:06:21 1.1
+++ SignJar.java 2001/12/16 00:38:01 1.2
@@ -6,13 +6,14 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -133,13 +134,12 @@
filesets.addElement( set );
}
-
public void execute()
- throws BuildException
+ throws TaskException
{
if( null == jar && null == filesets )
{
- throw new BuildException( "jar must be set through jar attribute
or nested filesets" );
+ throw new TaskException( "jar must be set through jar attribute
or nested filesets" );
}
if( null != jar )
{
@@ -153,12 +153,12 @@
// deal with the filesets
for( int i = 0; i < filesets.size(); i++ )
{
- FileSet fs = ( FileSet )filesets.elementAt( i );
+ FileSet fs = (FileSet)filesets.elementAt( i );
DirectoryScanner ds = fs.getDirectoryScanner( project );
String[] jarFiles = ds.getIncludedFiles();
for( int j = 0; j < jarFiles.length; j++ )
{
- doOneJar( new File( fs.getDir( project ), jarFiles[j] ),
null );
+ doOneJar( new File( fs.getDir( project ), jarFiles[ j ]
), null );
}
}
}
@@ -182,7 +182,7 @@
Enumeration entries = jarFile.entries();
while( entries.hasMoreElements() )
{
- String name = ( ( ZipEntry )entries.nextElement()
).getName();
+ String name = ( (ZipEntry)entries.nextElement()
).getName();
if( name.startsWith( SIG_START ) && name.endsWith(
SIG_END ) )
{
return true;
@@ -193,7 +193,7 @@
else
{
return jarFile.getEntry( SIG_START + alias.toUpperCase() +
- SIG_END ) != null;
+ SIG_END ) != null;
}
}
catch( IOException e )
@@ -209,7 +209,8 @@
jarFile.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
@@ -245,21 +246,21 @@
}
private void doOneJar( File jarSource, File jarTarget )
- throws BuildException
+ throws TaskException
{
if( project.getJavaVersion().equals( Project.JAVA_1_1 ) )
{
- throw new BuildException( "The signjar task is only available on
JDK versions 1.2 or greater" );
+ throw new TaskException( "The signjar task is only available on
JDK versions 1.2 or greater" );
}
if( null == alias )
{
- throw new BuildException( "alias attribute must be set" );
+ throw new TaskException( "alias attribute must be set" );
}
if( null == storepass )
{
- throw new BuildException( "storepass attribute must be set" );
+ throw new TaskException( "storepass attribute must be set" );
}
if( isUpToDate( jarSource, jarTarget ) )
@@ -267,7 +268,7 @@
final StringBuffer sb = new StringBuffer();
- final ExecTask cmd = ( ExecTask )project.createTask( "exec" );
+ final ExecTask cmd = (ExecTask)project.createTask( "exec" );
cmd.setExecutable( "jarsigner" );
if( null != keystore )
1.3 +14 -21
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java
Index: Sleep.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Sleep.java 2001/12/15 14:55:54 1.2
+++ Sleep.java 2001/12/16 00:38:01 1.3
@@ -6,7 +6,8 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
-import org.apache.tools.ant.BuildException;
+
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -41,12 +42,12 @@
*/
private int milliseconds = 0;
-
/**
* Creates new instance
*/
- public Sleep() { }
-
+ public Sleep()
+ {
+ }
/**
* Sets the FailOnError attribute of the MimeMail object
@@ -58,7 +59,6 @@
this.failOnError = failOnError;
}
-
/**
* Sets the Hours attribute of the Sleep object
*
@@ -69,7 +69,6 @@
this.hours = hours;
}
-
/**
* Sets the Milliseconds attribute of the Sleep object
*
@@ -80,7 +79,6 @@
this.milliseconds = milliseconds;
}
-
/**
* Sets the Minutes attribute of the Sleep object
*
@@ -91,7 +89,6 @@
this.minutes = minutes;
}
-
/**
* Sets the Seconds attribute of the Sleep object
*
@@ -102,7 +99,6 @@
this.seconds = seconds;
}
-
/**
* sleep for a period of time
*
@@ -119,29 +115,28 @@
}
}
-
/**
- * Executes this build task. throws org.apache.tools.ant.BuildException
if
+ * Executes this build task. throws org.apache.tools.ant.TaskException if
* there is an error during task execution.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
try
{
validate();
long sleepTime = getSleepTime();
log( "sleeping for " + sleepTime + " milliseconds",
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
doSleep( sleepTime );
}
catch( Exception e )
{
if( failOnError )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
else
{
@@ -151,23 +146,21 @@
}
}
-
/**
* verify parameters
*
- * @throws BuildException if something is invalid
+ * @throws TaskException if something is invalid
*/
public void validate()
- throws BuildException
+ throws TaskException
{
long sleepTime = getSleepTime();
if( getSleepTime() < 0 )
{
- throw new BuildException( "Negative sleep periods are not
supported" );
+ throw new TaskException( "Negative sleep periods are not
supported" );
}
}
-
/**
* return time to sleep
*
@@ -176,7 +169,7 @@
private long getSleepTime()
{
- return ( ( ( ( long )hours * 60 ) + minutes ) * 60 + seconds ) *
1000 + milliseconds;
+ return ( ( ( (long)hours * 60 ) + minutes ) * 60 + seconds ) * 1000
+ milliseconds;
}
}
1.4 +1 -1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java
Index: SQLExec.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SQLExec.java 2001/12/15 15:20:23 1.3
+++ SQLExec.java 2001/12/16 00:38:01 1.4
@@ -30,6 +30,7 @@
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
@@ -38,7 +39,6 @@
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
import org.apache.tools.ant.types.Reference;
-import org.apache.myrmidon.api.TaskException;
/**
* Reads in a text file containing SQL statements seperated with semicolons
and
1.2 +6 -5
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java
Index: StreamPumper.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StreamPumper.java 2001/12/15 12:06:21 1.1
+++ StreamPumper.java 2001/12/16 00:38:01 1.2
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -26,7 +27,6 @@
private InputStream is;
private OutputStream os;
-
/**
* Create a new stream pumper.
*
@@ -39,14 +39,13 @@
this.os = os;
}
-
/**
* Copies data from the input stream to the output stream. Terminates as
* soon as the input stream is closed or an error occurs.
*/
public void run()
{
- final byte[] buf = new byte[SIZE];
+ final byte[] buf = new byte[ SIZE ];
int length;
try
@@ -59,10 +58,12 @@
Thread.sleep( SLEEP );
}
catch( InterruptedException e )
- {}
+ {
+ }
}
}
catch( IOException e )
- {}
+ {
+ }
}
}
1.3 +10 -10
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java
Index: Tar.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Tar.java 2001/12/15 14:55:54 1.2
+++ Tar.java 2001/12/16 00:38:01 1.3
@@ -13,7 +13,7 @@
import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.EnumeratedAttribute;
@@ -91,28 +91,28 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( tarFile == null )
{
- throw new BuildException( "tarfile attribute must be set!" );
+ throw new TaskException( "tarfile attribute must be set!" );
}
if( tarFile.exists() && tarFile.isDirectory() )
{
- throw new BuildException( "tarfile is a directory!" );
+ throw new TaskException( "tarfile is a directory!" );
}
if( tarFile.exists() && !tarFile.canWrite() )
{
- throw new BuildException( "Can not write to the specified
tarfile!" );
+ throw new TaskException( "Can not write to the specified
tarfile!" );
}
if( baseDir != null )
{
if( !baseDir.exists() )
{
- throw new BuildException( "basedir does not exist!" );
+ throw new TaskException( "basedir does not exist!" );
}
// add the main fileset to the list of filesets to process.
@@ -123,7 +123,7 @@
if( filesets.size() == 0 )
{
- throw new BuildException( "You must supply either a basdir
attribute or some nested filesets." );
+ throw new TaskException( "You must supply either a basdir
attribute or some nested filesets." );
}
// check if tr is out of date with respect to each
@@ -143,7 +143,7 @@
{
if( tarFile.equals( new File( fs.getDir( project ), files[ i
] ) ) )
{
- throw new BuildException( "A tar file cannot include
itself" );
+ throw new TaskException( "A tar file cannot include
itself" );
}
}
}
@@ -193,7 +193,7 @@
catch( IOException ioe )
{
String msg = "Problem creating TAR: " + ioe.getMessage();
- throw new BuildException( msg, ioe );
+ throw new TaskException( msg, ioe );
}
finally
{
@@ -258,7 +258,7 @@
}
else if( longFileMode.isFailMode() )
{
- throw new BuildException(
+ throw new TaskException(
"Entry: " + vPath + " longer than " +
TarConstants.NAMELEN + "characters." );
}
1.3 +21 -20
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java
Index: Touch.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Touch.java 2001/12/15 14:55:54 1.2
+++ Touch.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -13,7 +14,7 @@
import java.text.ParseException;
import java.util.Locale;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -89,39 +90,39 @@
/**
* Execute the touch operation.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
if( file == null && filesets.size() == 0 )
{
throw
- new BuildException( "Specify at least one source - a file or
a fileset." );
+ new TaskException( "Specify at least one source - a file or
a fileset." );
}
if( file != null && file.exists() && file.isDirectory() )
{
- throw new BuildException( "Use a fileset to touch directories."
);
+ throw new TaskException( "Use a fileset to touch directories." );
}
if( dateTime != null )
{
DateFormat df = DateFormat.getDateTimeInstance( DateFormat.SHORT,
- DateFormat.SHORT,
- Locale.US );
+ DateFormat.SHORT,
+ Locale.US );
try
{
setMillis( df.parse( dateTime ).getTime() );
if( millis < 0 )
{
- throw new BuildException( "Date of " + dateTime
- + " results in negative milliseconds value relative
to epoch (January 1, 1970, 00:00:00 GMT)." );
+ throw new TaskException( "Date of " + dateTime
+ + " results in negative
milliseconds value relative to epoch (January 1, 1970, 00:00:00 GMT)." );
}
}
catch( ParseException pe )
{
- throw new BuildException( pe.getMessage(), pe );
+ throw new TaskException( pe.getMessage(), pe );
}
}
@@ -131,10 +132,10 @@
/**
* Does the actual work. Entry point for Untar and Expand as well.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected void touch()
- throws BuildException
+ throws TaskException
{
if( file != null )
{
@@ -144,12 +145,12 @@
try
{
FileOutputStream fos = new FileOutputStream( file );
- fos.write( new byte[0] );
+ fos.write( new byte[ 0 ] );
fos.close();
}
catch( IOException ioe )
{
- throw new BuildException( "Could not create " + file,
ioe );
+ throw new TaskException( "Could not create " + file, ioe
);
}
}
}
@@ -157,7 +158,7 @@
if( millis >= 0 && project.getJavaVersion() == Project.JAVA_1_1 )
{
log( "modification time of files cannot be set in JDK 1.1",
- Project.MSG_WARN );
+ Project.MSG_WARN );
return;
}
@@ -176,7 +177,7 @@
// deal with the filesets
for( int i = 0; i < filesets.size(); i++ )
{
- FileSet fs = ( FileSet )filesets.elementAt( i );
+ FileSet fs = (FileSet)filesets.elementAt( i );
DirectoryScanner ds = fs.getDirectoryScanner( project );
File fromDir = fs.getDir( project );
@@ -185,12 +186,12 @@
for( int j = 0; j < srcFiles.length; j++ )
{
- touch( new File( fromDir, srcFiles[j] ) );
+ touch( new File( fromDir, srcFiles[ j ] ) );
}
for( int j = 0; j < srcDirs.length; j++ )
{
- touch( new File( fromDir, srcDirs[j] ) );
+ touch( new File( fromDir, srcDirs[ j ] ) );
}
}
@@ -201,11 +202,11 @@
}
protected void touch( File file )
- throws BuildException
+ throws TaskException
{
if( !file.canWrite() )
{
- throw new BuildException( "Can not change modification date of
read-only file " + file );
+ throw new TaskException( "Can not change modification date of
read-only file " + file );
}
if( project.getJavaVersion() == Project.JAVA_1_1 )
1.3 +12 -11
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tstamp.java
Index: Tstamp.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tstamp.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Tstamp.java 2001/12/15 14:55:54 1.2
+++ Tstamp.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
@@ -16,7 +17,7 @@
import java.util.StringTokenizer;
import java.util.TimeZone;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Location;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
@@ -54,7 +55,7 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
try
{
@@ -72,14 +73,14 @@
Enumeration i = customFormats.elements();
while( i.hasMoreElements() )
{
- CustomFormat cts = ( CustomFormat )i.nextElement();
+ CustomFormat cts = (CustomFormat)i.nextElement();
cts.execute( project, d, location );
}
}
catch( Exception e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
@@ -104,14 +105,14 @@
WEEK,
MONTH,
YEAR
- };
+ };
private Hashtable calendarFields = new Hashtable();
public Unit()
{
calendarFields.put( MILLISECOND,
- new Integer( Calendar.MILLISECOND ) );
+ new Integer( Calendar.MILLISECOND ) );
calendarFields.put( SECOND, new Integer( Calendar.SECOND ) );
calendarFields.put( MINUTE, new Integer( Calendar.MINUTE ) );
calendarFields.put( HOUR, new Integer( Calendar.HOUR_OF_DAY ) );
@@ -124,7 +125,7 @@
public int getCalendarField()
{
String key = getValue().toLowerCase();
- Integer i = ( Integer )calendarFields.get( key );
+ Integer i = (Integer)calendarFields.get( key );
return i.intValue();
}
@@ -165,7 +166,7 @@
country = st.nextToken();
if( st.hasMoreElements() )
{
- throw new BuildException( "bad locale format" );
+ throw new TaskException( "bad locale format" );
}
}
}
@@ -176,7 +177,7 @@
}
catch( NoSuchElementException e )
{
- throw new BuildException( "bad locale format", e );
+ throw new TaskException( "bad locale format", e );
}
}
@@ -209,12 +210,12 @@
{
if( propertyName == null )
{
- throw new BuildException( "property attribute must be
provided" );
+ throw new TaskException( "property attribute must be
provided" );
}
if( pattern == null )
{
- throw new BuildException( "pattern attribute must be
provided" );
+ throw new TaskException( "pattern attribute must be
provided" );
}
SimpleDateFormat sdf;
1.3 +12 -9
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Unpack.java
Index: Unpack.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Unpack.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Unpack.java 2001/12/15 14:55:54 1.2
+++ Unpack.java 2001/12/16 00:38:01 1.3
@@ -6,8 +6,9 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Task;
/**
@@ -23,17 +24,19 @@
protected File source;
public void setDest( String dest )
+ throws TaskException
{
this.dest = resolveFile( dest );
}
public void setSrc( String src )
+ throws TaskException
{
source = resolveFile( src );
}
public void execute()
- throws BuildException
+ throws TaskException
{
validate();
extract();
@@ -48,11 +51,11 @@
String sourceName = source.getName();
int len = sourceName.length();
if( defaultExtension != null
- && len > defaultExtension.length()
- && defaultExtension.equalsIgnoreCase( sourceName.substring( len
- defaultExtension.length() ) ) )
+ && len > defaultExtension.length()
+ && defaultExtension.equalsIgnoreCase( sourceName.substring( len
- defaultExtension.length() ) ) )
{
dest = new File( dest, sourceName.substring( 0,
- len - defaultExtension.length() ) );
+ len -
defaultExtension.length() ) );
}
else
{
@@ -61,21 +64,21 @@
}
private void validate()
- throws BuildException
+ throws TaskException
{
if( source == null )
{
- throw new BuildException( "No Src for gunzip specified" );
+ throw new TaskException( "No Src for gunzip specified" );
}
if( !source.exists() )
{
- throw new BuildException( "Src doesn't exist" );
+ throw new TaskException( "Src doesn't exist" );
}
if( source.isDirectory() )
{
- throw new BuildException( "Cannot expand a directory" );
+ throw new TaskException( "Cannot expand a directory" );
}
if( dest == null )
1.3 +7 -6
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java
Index: Untar.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Untar.java 2001/12/15 14:55:54 1.2
+++ Untar.java 2001/12/16 00:38:01 1.3
@@ -6,11 +6,11 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.util.Date;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.tar.TarEntry;
@@ -38,15 +38,15 @@
while( ( te = tis.getNextEntry() ) != null )
{
extractFile( fileUtils, srcF, dir, tis,
- te.getName(),
- te.getModTime(), te.isDirectory() );
+ te.getName(),
+ te.getModTime(), te.isDirectory() );
}
log( "expand complete", Project.MSG_VERBOSE );
}
catch( IOException ioe )
{
- throw new BuildException( "Error while expanding " +
srcF.getPath(), ioe );
+ throw new TaskException( "Error while expanding " +
srcF.getPath(), ioe );
}
finally
{
@@ -57,7 +57,8 @@
tis.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
1.3 +13 -13
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
Index: UpToDate.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UpToDate.java 2001/12/15 14:55:54 1.2
+++ UpToDate.java 2001/12/16 00:38:01 1.3
@@ -6,10 +6,11 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.util.Enumeration;
import java.util.Vector;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.condition.Condition;
@@ -87,14 +88,14 @@
* Defines the FileNameMapper to use (nested mapper element).
*
* @return Description of the Returned Value
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public Mapper createMapper()
- throws BuildException
+ throws TaskException
{
if( mapperElement != null )
{
- throw new BuildException( "Cannot define more than one mapper"
);
+ throw new TaskException( "Cannot define more than one mapper" );
}
mapperElement = new Mapper( project );
return mapperElement;
@@ -109,12 +110,12 @@
{
if( sourceFileSets.size() == 0 )
{
- throw new BuildException( "At least one <srcfiles> element must
be set" );
+ throw new TaskException( "At least one <srcfiles> element must
be set" );
}
if( _targetFile == null && mapperElement == null )
{
- throw new BuildException( "The targetfile attribute or a nested
mapper element must be set" );
+ throw new TaskException( "The targetfile attribute or a nested
mapper element must be set" );
}
// if not there then it can't be up to date
@@ -125,23 +126,22 @@
boolean upToDate = true;
while( upToDate && enum.hasMoreElements() )
{
- FileSet fs = ( FileSet )enum.nextElement();
+ FileSet fs = (FileSet)enum.nextElement();
DirectoryScanner ds = fs.getDirectoryScanner( project );
upToDate = upToDate && scanDir( fs.getDir( project ),
- ds.getIncludedFiles() );
+ ds.getIncludedFiles() );
}
return upToDate;
}
-
/**
* Sets property to true if target files have a more recent timestamp
than
* each of the corresponding source files.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
boolean upToDate = eval();
if( upToDate )
@@ -150,12 +150,12 @@
if( mapperElement == null )
{
log( "File \"" + _targetFile.getAbsolutePath() + "\" is up
to date.",
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
}
else
{
log( "All target files have been up to date.",
- Project.MSG_VERBOSE );
+ Project.MSG_VERBOSE );
}
}
}
1.2 +9 -8
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/WaitFor.java
Index: WaitFor.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/WaitFor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- WaitFor.java 2001/12/15 12:06:21 1.1
+++ WaitFor.java 2001/12/16 00:38:01 1.2
@@ -6,8 +6,9 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.util.Hashtable;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.taskdefs.condition.Condition;
import org.apache.tools.ant.taskdefs.condition.ConditionBase;
import org.apache.tools.ant.types.EnumeratedAttribute;
@@ -96,20 +97,20 @@
* Check repeatedly for the specified conditions until they become true
or
* the timeout expires.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
if( countConditions() > 1 )
{
- throw new BuildException( "You must not nest more than one
condition into <waitfor>" );
+ throw new TaskException( "You must not nest more than one
condition into <waitfor>" );
}
if( countConditions() < 1 )
{
- throw new BuildException( "You must nest a condition into
<waitfor>" );
+ throw new TaskException( "You must nest a condition into
<waitfor>" );
}
- Condition c = ( Condition )getConditions().nextElement();
+ Condition c = (Condition)getConditions().nextElement();
maxWaitMillis *= maxWaitMultiplier;
checkEveryMillis *= checkEveryMultiplier;
@@ -149,7 +150,7 @@
private final static String[] units = {
MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK
- };
+ };
private Hashtable timeTable = new Hashtable();
@@ -166,7 +167,7 @@
public long getMultiplier()
{
String key = getValue().toLowerCase();
- Long l = ( Long )timeTable.get( key );
+ Long l = (Long)timeTable.get( key );
return l.longValue();
}
1.3 +6 -6
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java
Index: War.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- War.java 2001/12/15 14:55:54 1.2
+++ War.java 2001/12/16 00:38:01 1.3
@@ -6,14 +6,14 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
import java.io.IOException;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.ZipFileSet;
import org.apache.tools.zip.ZipOutputStream;
-
/**
* Creates a WAR archive.
*
@@ -36,7 +36,7 @@
{
deploymentDescriptor = descr;
if( !deploymentDescriptor.exists() )
- throw new BuildException( "Deployment descriptor: " +
deploymentDescriptor + " does not exist." );
+ throw new TaskException( "Deployment descriptor: " +
deploymentDescriptor + " does not exist." );
// Create a ZipFileSet for this file, and pass it up.
ZipFileSet fs = new ZipFileSet();
@@ -78,12 +78,12 @@
}
protected void initZipOutputStream( ZipOutputStream zOut )
- throws IOException, BuildException
+ throws IOException, TaskException
{
// If no webxml file is specified, it's an error.
if( deploymentDescriptor == null && !isInUpdateMode() )
{
- throw new BuildException( "webxml attribute is required" );
+ throw new TaskException( "webxml attribute is required" );
}
super.initZipOutputStream( zOut );
@@ -101,7 +101,7 @@
if( deploymentDescriptor == null ||
!deploymentDescriptor.equals( file ) || descriptorAdded )
{
log( "Warning: selected " + archiveType + " files include a
WEB-INF/web.xml which will be ignored " +
- "(please use webxml attribute to " + archiveType + "
task)", Project.MSG_WARN );
+ "(please use webxml attribute to " + archiveType + "
task)", Project.MSG_WARN );
}
else
{
1.2 +1 -0
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java
Index: XSLTLiaison.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSLTLiaison.java 2001/12/15 12:06:21 1.1
+++ XSLTLiaison.java 2001/12/16 00:38:01 1.2
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.File;
/**
1.3 +22 -22
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
Index: XSLTProcess.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSLTProcess.java 2001/12/15 14:55:54 1.2
+++ XSLTProcess.java 2001/12/16 00:38:01 1.3
@@ -10,8 +10,8 @@
import java.io.File;
import java.util.Enumeration;
import java.util.Vector;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.AntClassLoader;
-import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
@@ -209,11 +209,11 @@
/**
* Executes the task.
*
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
public void execute()
- throws BuildException
+ throws TaskException
{
DirectoryScanner scanner;
String[] list;
@@ -221,7 +221,7 @@
if( xslFile == null )
{
- throw new BuildException( "no stylesheet specified" );
+ throw new TaskException( "no stylesheet specified" );
}
if( baseDir == null )
@@ -256,7 +256,7 @@
if( destDir == null )
{
String msg = "destdir attributes must be set!";
- throw new BuildException( msg );
+ throw new TaskException( msg );
}
scanner = getDirectoryScanner( baseDir );
log( "Transforming into " + destDir, Project.MSG_INFO );
@@ -292,7 +292,7 @@
}
catch( Exception e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
else
@@ -324,7 +324,7 @@
e4.printStackTrace();
e3.printStackTrace();
e2.printStackTrace();
- throw new BuildException( "Error", e1 );
+ throw new TaskException( "Error", e1 );
}
}
}
@@ -338,10 +338,10 @@
* Loads the stylesheet and set xsl:param parameters.
*
* @param stylesheet Description of Parameter
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
protected void configureLiaison( File stylesheet )
- throws BuildException
+ throws TaskException
{
if( stylesheetLoaded )
{
@@ -362,20 +362,20 @@
catch( Exception ex )
{
log( "Failed to read stylesheet " + stylesheet, Project.MSG_INFO
);
- throw new BuildException( "Error", ex );
+ throw new TaskException( "Error", ex );
}
}
private void ensureDirectoryFor( File targetFile )
- throws BuildException
+ throws TaskException
{
File directory = new File( targetFile.getParent() );
if( !directory.exists() )
{
if( !directory.mkdirs() )
{
- throw new BuildException( "Unable to create directory: "
- + directory.getAbsolutePath() );
+ throw new TaskException( "Unable to create directory: "
+ + directory.getAbsolutePath() );
}
}
}
@@ -412,11 +412,11 @@
* @param xmlFile Description of Parameter
* @param destDir Description of Parameter
* @param stylesheet Description of Parameter
- * @exception BuildException Description of Exception
+ * @exception TaskException Description of Exception
*/
private void process( File baseDir, String xmlFile, File destDir,
File stylesheet )
- throws BuildException
+ throws TaskException
{
String fileExt = targetExtension;
@@ -457,13 +457,13 @@
outFile.delete();
}
- throw new BuildException( "Error", ex );
+ throw new TaskException( "Error", ex );
}
}//-- processXML
private void process( File inFile, File outFile, File stylesheet )
- throws BuildException
+ throws TaskException
{
try
{
@@ -486,7 +486,7 @@
log( "Failed to process " + inFile, Project.MSG_INFO );
if( outFile != null )
outFile.delete();
- throw new BuildException( "Error", ex );
+ throw new TaskException( "Error", ex );
}
}
@@ -534,18 +534,18 @@
}
public String getExpression()
- throws BuildException
+ throws TaskException
{
if( expression == null )
- throw new BuildException( "Expression attribute is missing."
);
+ throw new TaskException( "Expression attribute is missing."
);
return expression;
}
public String getName()
- throws BuildException
+ throws TaskException
{
if( name == null )
- throw new BuildException( "Name attribute is missing." );
+ throw new TaskException( "Name attribute is missing." );
return name;
}
}
1.3 +69 -66
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Zip.java 2001/12/15 14:55:54 1.2
+++ Zip.java 2001/12/16 00:38:01 1.3
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -19,7 +20,7 @@
import java.util.Vector;
import java.util.zip.CRC32;
import java.util.zip.ZipInputStream;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.FileScanner;
import org.apache.tools.ant.Project;
@@ -71,14 +72,14 @@
protected static String[][] grabFileNames( FileScanner[] scanners )
{
- String[][] result = new String[scanners.length][];
+ String[][] result = new String[ scanners.length ][];
for( int i = 0; i < scanners.length; i++ )
{
- String[] files = scanners[i].getIncludedFiles();
- String[] dirs = scanners[i].getIncludedDirectories();
- result[i] = new String[files.length + dirs.length];
- System.arraycopy( files, 0, result[i], 0, files.length );
- System.arraycopy( dirs, 0, result[i], files.length, dirs.length
);
+ String[] files = scanners[ i ].getIncludedFiles();
+ String[] dirs = scanners[ i ].getIncludedDirectories();
+ result[ i ] = new String[ files.length + dirs.length ];
+ System.arraycopy( files, 0, result[ i ], 0, files.length );
+ System.arraycopy( dirs, 0, result[ i ], files.length,
dirs.length );
}
return result;
}
@@ -94,11 +95,11 @@
Vector files = new Vector();
for( int i = 0; i < fileNames.length; i++ )
{
- File thisBaseDir = scanners[i].getBasedir();
- for( int j = 0; j < fileNames[i].length; j++ )
- files.addElement( new File( thisBaseDir, fileNames[i][j] ) );
+ File thisBaseDir = scanners[ i ].getBasedir();
+ for( int j = 0; j < fileNames[ i ].length; j++ )
+ files.addElement( new File( thisBaseDir, fileNames[ i ][ j ]
) );
}
- File[] toret = new File[files.size()];
+ File[] toret = new File[ files.size() ];
files.copyInto( toret );
return toret;
}
@@ -216,17 +217,17 @@
}
public void execute()
- throws BuildException
+ throws TaskException
{
if( baseDir == null && filesets.size() == 0 && "zip".equals(
archiveType ) )
{
- throw new BuildException( "basedir attribute must be set, or at
least " +
- "one fileset must be given!" );
+ throw new TaskException( "basedir attribute must be set, or at
least " +
+ "one fileset must be given!" );
}
if( zipFile == null )
{
- throw new BuildException( "You must specify the " + archiveType
+ " file to create!" );
+ throw new TaskException( "You must specify the " + archiveType +
" file to create!" );
}
// Renamed version of original file, if it exists
@@ -240,18 +241,18 @@
{
FileUtils fileUtils = FileUtils.newFileUtils();
renamedFile = fileUtils.createTempFile( "zip", ".tmp",
- fileUtils.getParentFile( zipFile ) );
+ fileUtils.getParentFile(
zipFile ) );
try
{
if( !zipFile.renameTo( renamedFile ) )
{
- throw new BuildException( "Unable to rename old file to
temporary file" );
+ throw new TaskException( "Unable to rename old file to
temporary file" );
}
}
catch( SecurityException e )
{
- throw new BuildException( "Not allowed to rename old file to
temporary file" );
+ throw new TaskException( "Not allowed to rename old file to
temporary file" );
}
}
@@ -263,11 +264,11 @@
}
for( int i = 0; i < filesets.size(); i++ )
{
- FileSet fs = ( FileSet )filesets.elementAt( i );
+ FileSet fs = (FileSet)filesets.elementAt( i );
dss.addElement( fs.getDirectoryScanner( project ) );
}
int dssSize = dss.size();
- FileScanner[] scanners = new FileScanner[dssSize];
+ FileScanner[] scanners = new FileScanner[ dssSize ];
dss.copyInto( scanners );
// quick exit if the target is up to date
@@ -319,7 +320,7 @@
{
exclusionPattern.append( "," );
}
- exclusionPattern.append( ( String
)addedFiles.elementAt( i ) );
+ exclusionPattern.append(
(String)addedFiles.elementAt( i ) );
}
oldFiles.setExcludes( exclusionPattern.toString() );
Vector tmp = new Vector();
@@ -371,7 +372,7 @@
}
}
- throw new BuildException( msg, ioe );
+ throw new TaskException( msg, ioe );
}
finally
{
@@ -384,7 +385,7 @@
if( !renamedFile.delete() )
{
log( "Warning: unable to delete temporary file " +
- renamedFile.getName(), Project.MSG_WARN );
+ renamedFile.getName(), Project.MSG_WARN );
}
}
}
@@ -400,7 +401,6 @@
return addingNewFiles;
}
-
/**
* Check whether the archive is up-to-date; and handle behavior for empty
* archives.
@@ -409,10 +409,10 @@
* @param zipFile intended archive file (may or may not exist)
* @return true if nothing need be done (may have done something
already);
* false if archive creation should proceed
- * @exception BuildException if it likes
+ * @exception TaskException if it likes
*/
protected boolean isUpToDate( FileScanner[] scanners, File zipFile )
- throws BuildException
+ throws TaskException
{
String[][] fileNames = grabFileNames( scanners );
File[] files = grabFiles( scanners, fileNames );
@@ -421,13 +421,13 @@
if( emptyBehavior.equals( "skip" ) )
{
log( "Warning: skipping " + archiveType + " archive " +
zipFile +
- " because no files were included.", Project.MSG_WARN );
+ " because no files were included.", Project.MSG_WARN );
return true;
}
else if( emptyBehavior.equals( "fail" ) )
{
- throw new BuildException( "Cannot create " + archiveType + "
archive " + zipFile +
- ": no files were included." );
+ throw new TaskException( "Cannot create " + archiveType + "
archive " + zipFile +
+ ": no files were included." );
}
else
{
@@ -439,9 +439,9 @@
{
for( int i = 0; i < files.length; ++i )
{
- if( files[i].equals( zipFile ) )
+ if( files[ i ].equals( zipFile ) )
{
- throw new BuildException( "A zip file cannot include
itself" );
+ throw new TaskException( "A zip file cannot include
itself" );
}
}
@@ -453,8 +453,8 @@
mm.setTo( zipFile.getAbsolutePath() );
for( int i = 0; i < scanners.length; i++ )
{
- if( sfs.restrict( fileNames[i], scanners[i].getBasedir(),
null,
- mm ).length > 0 )
+ if( sfs.restrict( fileNames[ i ], scanners[ i
].getBasedir(), null,
+ mm ).length > 0 )
{
return false;
}
@@ -480,21 +480,21 @@
throws IOException
{
if( prefix.length() > 0 && fullpath.length() > 0 )
- throw new BuildException( "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." );
File thisBaseDir = scanner.getBasedir();
// directories that matched include patterns
String[] dirs = scanner.getIncludedDirectories();
if( dirs.length > 0 && fullpath.length() > 0 )
- throw new BuildException( "fullpath attribute may only be
specified for filesets that specify a single file." );
+ throw new TaskException( "fullpath attribute may only be
specified for filesets that specify a single file." );
for( int i = 0; i < dirs.length; i++ )
{
- if( "".equals( dirs[i] ) )
+ if( "".equals( dirs[ i ] ) )
{
continue;
}
- String name = dirs[i].replace( File.separatorChar, '/' );
+ String name = dirs[ i ].replace( File.separatorChar, '/' );
if( !name.endsWith( "/" ) )
{
name += "/";
@@ -505,10 +505,10 @@
// files that matched include patterns
String[] files = scanner.getIncludedFiles();
if( files.length > 1 && fullpath.length() > 0 )
- throw new BuildException( "fullpath attribute may only be
specified for filesets that specify a single file." );
+ throw new TaskException( "fullpath attribute may only be
specified for filesets that specify a single file." );
for( int i = 0; i < files.length; i++ )
{
- File f = new File( thisBaseDir, files[i] );
+ File f = new File( thisBaseDir, files[ i ] );
if( fullpath.length() > 0 )
{
// Add this file at the specified location.
@@ -518,7 +518,7 @@
else
{
// Add this file with the specified prefix.
- String name = files[i].replace( File.separatorChar, '/' );
+ String name = files[ i ].replace( File.separatorChar, '/' );
addParentDirs( thisBaseDir, name, zOut, prefix );
zipFile( f, zOut, prefix + name );
}
@@ -539,21 +539,21 @@
// Add each fileset in the Vector.
for( int i = 0; i < filesets.size(); i++ )
{
- FileSet fs = ( FileSet )filesets.elementAt( i );
+ FileSet fs = (FileSet)filesets.elementAt( i );
DirectoryScanner ds = fs.getDirectoryScanner( project );
String prefix = "";
String fullpath = "";
if( fs instanceof ZipFileSet )
{
- ZipFileSet zfs = ( ZipFileSet )fs;
+ ZipFileSet zfs = (ZipFileSet)fs;
prefix = zfs.getPrefix();
fullpath = zfs.getFullpath();
}
if( prefix.length() > 0
- && !prefix.endsWith( "/" )
- && !prefix.endsWith( "\\" ) )
+ && !prefix.endsWith( "/" )
+ && !prefix.endsWith( "\\" ) )
{
prefix += "/";
}
@@ -571,9 +571,9 @@
}
if( fs instanceof ZipFileSet
- && ( ( ZipFileSet )fs ).getSrc() != null )
+ && ( (ZipFileSet)fs ).getSrc() != null )
{
- addZipEntries( ( ZipFileSet )fs, ds, zOut, prefix, fullpath
);
+ addZipEntries( (ZipFileSet)fs, ds, zOut, prefix, fullpath );
}
else
{
@@ -601,7 +601,7 @@
Stack directories = new Stack();
int slashPos = entry.length();
- while( ( slashPos = entry.lastIndexOf( ( int )'/', slashPos - 1
) ) != -1 )
+ while( ( slashPos = entry.lastIndexOf( (int)'/', slashPos - 1 )
) != -1 )
{
String dir = entry.substring( 0, slashPos + 1 );
if( addedDirs.get( prefix + dir ) != null )
@@ -613,7 +613,7 @@
while( !directories.isEmpty() )
{
- String dir = ( String )directories.pop();
+ String dir = (String)directories.pop();
File f = null;
if( baseDir != null )
{
@@ -633,9 +633,9 @@
throws IOException
{
if( prefix.length() > 0 && fullpath.length() > 0 )
- throw new BuildException( "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." );
- ZipScanner zipScanner = ( ZipScanner )ds;
+ ZipScanner zipScanner = (ZipScanner)ds;
File zipSrc = fs.getSrc();
ZipEntry entry;
@@ -714,11 +714,11 @@
try
{
// Cf. PKZIP specification.
- byte[] empty = new byte[22];
- empty[0] = 80;// P
- empty[1] = 75;// K
- empty[2] = 5;
- empty[3] = 6;
+ byte[] empty = new byte[ 22 ];
+ empty[ 0 ] = 80;// P
+ empty[ 1 ] = 75;// K
+ empty[ 2 ] = 5;
+ empty[ 3 ] = 6;
// remainder zeros
os.write( empty );
}
@@ -729,16 +729,20 @@
}
catch( IOException ioe )
{
- throw new BuildException( "Could not create empty ZIP archive",
ioe );
+ throw new TaskException( "Could not create empty ZIP archive",
ioe );
}
return true;
}
protected void finalizeZipOutputStream( ZipOutputStream zOut )
- throws IOException, BuildException { }
+ throws IOException, TaskException
+ {
+ }
protected void initZipOutputStream( ZipOutputStream zOut )
- throws IOException, BuildException { }
+ throws IOException, TaskException
+ {
+ }
protected void zipDir( File dir, ZipOutputStream zOut, String vPath )
throws IOException
@@ -797,7 +801,7 @@
// Store data into a byte[]
ByteArrayOutputStream bos = new ByteArrayOutputStream();
- byte[] buffer = new byte[8 * 1024];
+ byte[] buffer = new byte[ 8 * 1024 ];
int count = 0;
do
{
@@ -805,21 +809,21 @@
cal.update( buffer, 0, count );
bos.write( buffer, 0, count );
count = in.read( buffer, 0, buffer.length );
- }while ( count != -1 );
+ } while( count != -1 );
in = new ByteArrayInputStream( bos.toByteArray() );
}
else
{
in.mark( Integer.MAX_VALUE );
- byte[] buffer = new byte[8 * 1024];
+ byte[] buffer = new byte[ 8 * 1024 ];
int count = 0;
do
{
size += count;
cal.update( buffer, 0, count );
count = in.read( buffer, 0, buffer.length );
- }while ( count != -1 );
+ } while( count != -1 );
in.reset();
}
ze.setSize( size );
@@ -828,7 +832,7 @@
zOut.putNextEntry( ze );
- byte[] buffer = new byte[8 * 1024];
+ byte[] buffer = new byte[ 8 * 1024 ];
int count = 0;
do
{
@@ -837,7 +841,7 @@
zOut.write( buffer, 0, count );
}
count = in.read( buffer, 0, buffer.length );
- }while ( count != -1 );
+ } while( count != -1 );
addedFiles.addElement( vPath );
}
@@ -846,7 +850,7 @@
{
if( file.equals( zipFile ) )
{
- throw new BuildException( "A zip file cannot include itself" );
+ throw new TaskException( "A zip file cannot include itself" );
}
FileInputStream fIn = new FileInputStream( file );
@@ -859,7 +863,6 @@
fIn.close();
}
}
-
/**
* Possible behaviors when there are no matching files for the task.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>