diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/AntStructure.java index 39416e5a4..a6a487755 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/AntStructure.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/AntStructure.java @@ -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.io.UnsupportedEncodingException; 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; @@ -31,7 +32,6 @@ import org.apache.tools.ant.types.EnumeratedAttribute; public class AntStructure extends Task { - private final String lSep = System.getProperty( "line.separator" ); private final String BOOLEAN = "%boolean;"; @@ -53,12 +53,12 @@ public class AntStructure extends Task } 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 @@ public class AntStructure extends Task } 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 @@ public class AntStructure extends Task } catch( IOException ioe ) { - throw new BuildException( "Error writing " + output.getAbsolutePath(), - ioe ); + throw new TaskException( "Error writing " + output.getAbsolutePath(), + ioe ); } finally { @@ -152,7 +152,7 @@ public class AntStructure extends Task { for( int i = 0; i < s.length; i++ ) { - if( !isNmtoken( s[i] ) ) + if( !isNmtoken( s[ i ] ) ) { return false; } @@ -161,7 +161,7 @@ public class AntStructure extends Task } private void printElementDecl( PrintWriter out, String name, Class element ) - throws BuildException + throws TaskException { if( visited.containsKey( name ) ) @@ -213,7 +213,7 @@ public class AntStructure extends Task Enumeration enum = ih.getNestedElements(); while( enum.hasMoreElements() ) { - v.addElement( ( String )enum.nextElement() ); + v.addElement( (String)enum.nextElement() ); } if( v.isEmpty() ) @@ -247,7 +247,7 @@ public class AntStructure extends Task 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 @@ public class AntStructure extends Task 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 @@ public class AntStructure extends Task { sb.append( " | " ); } - sb.append( values[i] ); + sb.append( values[ i ] ); } sb.append( ") " ); } @@ -309,11 +309,11 @@ public class AntStructure extends Task 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 @@ public class AntStructure extends Task boolean first = true; while( tasks.hasMoreElements() ) { - String taskName = ( String )tasks.nextElement(); + String taskName = (String)tasks.nextElement(); if( !first ) { out.print( " | " ); @@ -345,7 +345,7 @@ public class AntStructure extends Task first = true; while( types.hasMoreElements() ) { - String typeName = ( String )types.nextElement(); + String typeName = (String)types.nextElement(); if( !first ) { out.print( " | " ); @@ -370,7 +370,9 @@ public class AntStructure extends Task out.println( "" ); } - private void printTail( PrintWriter out ) { } + private void printTail( PrintWriter out ) + { + } private void printTargetDecl( PrintWriter out ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java index 94c6e8c5a..de7d75ec8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Available.java @@ -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.EnumeratedAttribute; 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 @@ public class Available this.resource = resource; } - - public void setType( FileDir type ) + public void setType( FileDir type ) { this.type = type; } @@ -114,7 +113,7 @@ public class Available { 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 @@ public class Available { if( property == null ) { - throw new BuildException( "property attribute is required"); + throw new TaskException( "property attribute is required" ); } if( eval() ) @@ -218,6 +217,7 @@ public class Available } private boolean checkFile() + throws TaskException { if( filepath == null ) { @@ -228,7 +228,7 @@ public class Available 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 ) @@ -242,11 +242,11 @@ public class Available * 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 @@ public class Available 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 @@ public class Available 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 @@ public class Available if( path.exists() && path.isDirectory() ) { if( checkFile( new File( path, file ), - file + " in " + path ) ) + file + " in " + path ) ) { return true; } @@ -303,7 +303,7 @@ public class Available if( parent != null && parent.exists() ) { if( checkFile( new File( parent, file ), - file + " in " + parent ) ) + file + " in " + parent ) ) { return true; } @@ -316,7 +316,7 @@ public class Available if( grandParent != null && grandParent.exists() ) { if( checkFile( new File( grandParent, file ), - file + " in " + grandParent ) ) + file + " in " + grandParent ) ) { return true; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java index 3b2dc6fdf..b33901acd 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java @@ -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 @@ public class BUnzip2 extends Unpack 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 @@ public class BUnzip2 extends Unpack bis.close(); } catch( IOException ioex ) - {} + { + } } if( fis != null ) { @@ -88,7 +90,8 @@ public class BUnzip2 extends Unpack fis.close(); } catch( IOException ioex ) - {} + { + } } if( out != null ) { @@ -97,7 +100,8 @@ public class BUnzip2 extends Unpack out.close(); } catch( IOException ioex ) - {} + { + } } if( zIn != null ) { @@ -106,7 +110,8 @@ public class BUnzip2 extends Unpack zIn.close(); } catch( IOException ioex ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BZip2.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BZip2.java index be8635f3f..8a06764c1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BZip2.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/BZip2.java @@ -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 @@ public class BZip2 extends Pack 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 @@ public class BZip2 extends Pack zOut.close(); } catch( IOException e ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/CVSPass.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/CVSPass.java index 44b7ed617..6c82ee6df 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/CVSPass.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/CVSPass.java @@ -6,15 +6,15 @@ * 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 @@ -100,10 +100,10 @@ public class CVSPass extends Task /** * 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 @@ public class CVSPass extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } @@ -158,7 +158,7 @@ public class CVSPass extends Task 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(); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java index e9b444d54..6f971a1b5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Checksum.java @@ -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.security.NoSuchProviderException; 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 @@ public class Checksum extends MatchingTask implements Condition * * @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 @@ public class Checksum extends MatchingTask implements Condition /** * 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 @@ public class Checksum extends MatchingTask implements Condition * 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 @@ public class Checksum extends MatchingTask implements Condition else { log( file + " omitted as " + dest + " is up to date.", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); } } else @@ -229,10 +228,10 @@ public class Checksum extends MatchingTask implements Condition 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 @@ public class Checksum extends MatchingTask implements Condition * 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 @@ public class Checksum extends MatchingTask implements Condition 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 @@ public class Checksum extends MatchingTask implements Condition 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 @@ public class Checksum extends MatchingTask implements Condition { if( isCondition ) { - File existingFile = ( File )destination; + File existingFile = (File)destination; if( existingFile.exists() && existingFile.length() == checksum.length() ) { @@ -318,7 +317,7 @@ public class Checksum extends MatchingTask implements Condition } else { - File dest = ( File )destination; + File dest = (File)destination; fos = new FileOutputStream( dest ); fos.write( checksum.getBytes() ); fos.close(); @@ -329,7 +328,7 @@ public class Checksum extends MatchingTask implements Condition } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } finally { @@ -340,7 +339,8 @@ public class Checksum extends MatchingTask implements Condition fis.close(); } catch( IOException e ) - {} + { + } } if( fos != null ) { @@ -349,7 +349,8 @@ public class Checksum extends MatchingTask implements Condition fos.close(); } catch( IOException e ) - {} + { + } } } return checksumMatches; @@ -359,10 +360,10 @@ public class Checksum extends MatchingTask implements Condition * 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 @@ public class Checksum extends MatchingTask implements Condition 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 @@ public class Checksum extends MatchingTask implements Condition 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 ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Chmod.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Chmod.java index 6df33d6bd..2c61b6613 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Chmod.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Chmod.java @@ -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 class Chmod extends ExecuteOn 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 @@ public class Chmod extends ExecuteOn 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 class Chmod extends ExecuteOn 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 class Chmod extends ExecuteOn } public void execute() - throws BuildException + throws TaskException { if( defaultSetDefined || defaultSet.getDir( project ) == null ) { @@ -161,7 +160,7 @@ public class Chmod extends ExecuteOn } catch( IOException e ) { - throw new BuildException( "Execute failed: " + e, e ); + throw new TaskException( "Execute failed: " + e, e ); } finally { @@ -180,7 +179,7 @@ public class Chmod extends ExecuteOn { 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 ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java index db05c6075..16261d965 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ConditionTask.java @@ -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 @@ -54,7 +54,7 @@ public class ConditionTask extends ConditionBase /** * 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 @@ public class ConditionTask extends ConditionBase { throw new TaskException( "You must nest a condition into " ); } - Condition c = ( Condition )getConditions().nextElement(); + Condition c = (Condition)getConditions().nextElement(); if( c.eval() ) { getProject().setNewProperty( property, value ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Copy.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Copy.java index ba97365c5..54713ad34 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Copy.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Copy.java @@ -13,7 +13,6 @@ import java.util.Enumeration; 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 @@ public class Copy extends Task * 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 @@ public class Copy extends Task /** * Performs the copy operation. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() throws TaskException @@ -369,7 +368,7 @@ public class Copy extends Task { 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 @@ public class Copy extends Task * 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 diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Cvs.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Cvs.java index 371f6ca9d..be8acb91b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Cvs.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Cvs.java @@ -14,7 +14,6 @@ import java.io.IOException; 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 class Cvs extends Task 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) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Delete.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Delete.java index f96f39b7d..939b01b5a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -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 @@ public class Delete extends MatchingTask this.file = file; } - /** * Used to delete empty directories. * @@ -225,10 +225,10 @@ public class Delete extends MatchingTask /** * 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask { 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 @@ public class Delete extends MatchingTask // 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask else { log( be.getMessage(), - quiet ? Project.MSG_VERBOSE : Project.MSG_WARN ); + quiet ? Project.MSG_VERBOSE : Project.MSG_WARN ); } } } @@ -328,7 +328,7 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask { 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 @@ public class Delete extends MatchingTask { 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask if( dirCount > 0 ) { log( "Deleted " + dirCount + " director" + - ( dirCount == 1 ? "y" : "ies" ) + - " from " + d.getAbsolutePath() ); + ( dirCount == 1 ? "y" : "ies" ) + + " from " + d.getAbsolutePath() ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java index 0768f88e9..8e786d664 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/DependSet.java @@ -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; @@ -72,7 +73,9 @@ public class DependSet extends MatchingTask /** * Creates a new DependSet Task. */ - public DependSet() { } + public DependSet() + { + } /** * Nested <srcfilelist> element. @@ -117,21 +120,19 @@ public class DependSet extends MatchingTask /** * 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 or element must be set" ); + throw new TaskException( "At least one or element must be set" ); } if( ( targetFileSets.size() == 0 ) && ( targetFileLists.size() == 0 ) ) { - throw new BuildException( "At least one or element must be set" ); + throw new TaskException( "At least one or element must be set" ); } long now = ( new Date() ).getTime(); @@ -153,20 +154,20 @@ public class DependSet extends MatchingTask 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 @@ public class DependSet extends MatchingTask 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 @@ public class DependSet extends MatchingTask } 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 @@ public class DependSet extends MatchingTask 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 @@ public class DependSet extends MatchingTask 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 @@ public class DependSet extends MatchingTask 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(); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java index 3456e63e8..6d177d0fe 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Ear.java @@ -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 @@ public class Ear extends Jar { 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 @@ public class Ear extends Jar 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 @@ public class Ear extends Jar 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 { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Echo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Echo.java index 1dbd30558..87b5e280c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Echo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Echo.java @@ -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 @@ public class Echo extends Task /** * 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 @@ public class Echo extends Task } catch( IOException ioe ) { - throw new BuildException( "Error", ioe); + throw new TaskException( "Error", ioe ); } finally { @@ -143,7 +143,8 @@ public class Echo extends Task out.close(); } catch( IOException ioex ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecTask.java index d81f23827..1aac3b0c2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecTask.java @@ -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.FileNotFoundException; 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 @@ public class ExecTask extends Task } /** - * 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 @@ public class ExecTask extends Task /** * 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 @@ public class ExecTask extends Task { if( failOnError ) { - throw new BuildException( taskType + " returned: " + err ); + throw new TaskException( taskType + " returned: " + err ); } else { @@ -271,22 +272,22 @@ public class ExecTask extends Task /** * 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 @@ public class ExecTask extends Task * 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 @@ public class ExecTask extends Task } 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 @@ public class ExecTask extends Task else { return new LogStreamHandler( this, - Project.MSG_INFO, Project.MSG_WARN ); + Project.MSG_INFO, Project.MSG_WARN ); } } @@ -333,10 +334,10 @@ public class ExecTask extends Task * 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 @@ public class ExecTask extends Task baos.close(); } catch( IOException io ) - {} + { + } } /** @@ -378,10 +380,10 @@ public class ExecTask extends Task * 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 @@ public class ExecTask extends Task { 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 @@ public class ExecTask extends Task * 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 @@ public class ExecTask extends Task { if( failIfExecFails ) { - throw new BuildException( "Execute failed: " + e.toString(), e ); + throw new TaskException( "Execute failed: " + e.toString(), e ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Execute.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Execute.java index c9b0ddf72..8b323717d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Execute.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Execute.java @@ -18,11 +18,10 @@ import java.util.Locale; 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 @@ public class Execute * * @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 @@ public class Execute 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 @@ public class Execute * 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 @@ public class Execute } 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 ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java index 1c20e5ffd..4d015623d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java @@ -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 @@ import org.apache.tools.ant.types.Path; * @author thomas.haas@softwired-inc.com * @author Stefan Bodewig */ + public class ExecuteJava { @@ -43,7 +44,7 @@ public class ExecuteJava } public void execute( Project project ) - throws BuildException + throws TaskException { final String classname = javaCommand.getExecutable(); final Object[] argument = {javaCommand.getArguments()}; @@ -75,27 +76,27 @@ public class ExecuteJava } 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 { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index 02598c18d..daa6903b3 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -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 @@ public class ExecuteOn extends ExecTask this.destDir = destDir; } - /** * Shall the command work on all specified files in parallel? * @@ -110,14 +110,14 @@ public class ExecuteOn extends ExecTask * 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 @@ public class ExecuteOn extends ExecTask { 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 @@ public class ExecuteOn extends ExecTask { 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask } } } - 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 @@ public class ExecuteOn extends ExecTask int targetIndex = targetFilePos.getPosition(); if( srcIndex < targetIndex - || ( srcIndex == targetIndex && srcIsFirst ) ) + || ( srcIndex == targetIndex && srcIsFirst ) ) { // 0 --> srcIndex @@ -220,18 +220,18 @@ public class ExecuteOn extends ExecTask // 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 @@ public class ExecuteOn extends ExecTask // 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask { 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 @@ public class ExecuteOn extends ExecTask { SourceFileScanner sfs = new SourceFileScanner( this ); return sfs.restrict( ds.getIncludedDirectories(), baseDir, destDir, - mapper ); + mapper ); } else { @@ -332,7 +332,7 @@ public class ExecuteOn extends ExecTask { SourceFileScanner sfs = new SourceFileScanner( this ); return sfs.restrict( ds.getIncludedFiles(), baseDir, destDir, - mapper ); + mapper ); } else { @@ -345,27 +345,27 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask ; for( int j = 0; j < s.length; j++ ) { - fileNames.addElement( s[j] ); + fileNames.addElement( s[ j ] ); baseDirs.addElement( base ); } } @@ -408,13 +408,13 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask } catch( IOException e ) { - throw new BuildException( "Execute failed: " + e, e ); + throw new TaskException( "Execute failed: " + e, e ); } finally { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java index f9f64cca6..4129b61d2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java @@ -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; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java index 318e622aa..4edcfc65f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java @@ -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; /** * Destroys a process running for too long. For example:
@@ -84,16 +85,16 @@ public class ExecuteWatchdog implements Runnable
      * 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 @@ public class ExecuteWatchdog implements Runnable
         return killedProcess;
     }
 
-
     /**
      * Watches the process and terminates it, if it runs for to long.
      */
@@ -127,7 +127,8 @@ public class ExecuteWatchdog implements Runnable
                     wait( until - now );
                 }
                 catch( InterruptedException e )
-                {}
+                {
+                }
             }
 
             // if we are here, either someone stopped the watchdog,
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Exit.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Exit.java
index 60ae24009..0f441a1e7 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Exit.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Exit.java
@@ -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 class Exit extends Task
     }
 
     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" );
             }
         }
     }
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java
index 88e1bd21d..ac86f32ac 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Expand.java
@@ -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.Date;
 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 @@ public class Expand extends MatchingTask
     /**
      * 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 @@ public class Expand extends MatchingTask
         {
             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 @@ public class Expand extends MatchingTask
         {
             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 @@ public class Expand extends MatchingTask
             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 @@ public class Expand extends MatchingTask
                     zis.close();
                 }
                 catch( IOException e )
-                {}
+                {
+                }
             }
         }
     }
@@ -199,13 +201,13 @@ public class Expand extends MatchingTask
             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 @@ public class Expand extends MatchingTask
                 {
                     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 @@ public class Expand extends MatchingTask
         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 @@ public class Expand extends MatchingTask
             }
             else
             {
-                byte[] buffer = new byte[1024];
+                byte[] buffer = new byte[ 1024 ];
                 int length = 0;
                 FileOutputStream fos = null;
                 try
@@ -282,7 +284,8 @@ public class Expand extends MatchingTask
                             fos.close();
                         }
                         catch( IOException e )
-                        {}
+                        {
+                        }
                     }
                 }
             }
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java
index b51e712f6..d8ac808ad 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Filter.java
@@ -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 class Filter extends Task
     }
 
     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 @@ public class Filter extends Task
     }
 
     protected void readFilters()
-        throws BuildException
+        throws TaskException
     {
         log( "Reading filters from " + filtersFile, Project.MSG_VERBOSE );
         project.getGlobalFilterSet().readFiltersFromFile( filtersFile );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
index 18c757c2d..2a2288eb0 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
@@ -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.Reader;
 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;
@@ -192,7 +193,6 @@ public class FixCRLF extends MatchingTask
         }
     }
 
-
     /**
      * Specify how EndOfLine characters are to be handled
      *
@@ -270,14 +270,14 @@ public class FixCRLF extends MatchingTask
      * 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 @@ public class FixCRLF extends MatchingTask
     /**
      * 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 @@ public class FixCRLF extends MatchingTask
         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 @@ public class FixCRLF extends MatchingTask
      *
      * @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 @@ public class FixCRLF extends MatchingTask
             }
         }// 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 @@ public class FixCRLF extends MatchingTask
      * 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 @@ public class FixCRLF extends MatchingTask
         //  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 @@ public class FixCRLF extends MatchingTask
         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 @@ public class FixCRLF extends MatchingTask
         // 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 @@ public class FixCRLF extends MatchingTask
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error", e );
+                throw new TaskException( "Error", e );
             }// end of try-catch
         }
         else
@@ -519,9 +517,9 @@ public class FixCRLF extends MatchingTask
                 ; 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 @@ public class FixCRLF extends MatchingTask
             }
             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 @@ public class FixCRLF extends MatchingTask
 
     }
 
-
     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 @@ public class FixCRLF extends MatchingTask
             {
                 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 @@ public class FixCRLF extends MatchingTask
 
                 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 @@ public class FixCRLF extends MatchingTask
                     }
                     catch( IOException e )
                     {
-                        throw new BuildException( "Error", e );
+                        throw new TaskException( "Error", e );
                     }// end of try-catch
 
                 }
@@ -630,78 +627,78 @@ public class FixCRLF extends MatchingTask
                     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;
+                                }
+
+                                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() ) );
                                 }
-                            }
-
-                            // 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;
+                                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 @@ public class FixCRLF extends MatchingTask
                 }
                 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 @@ public class FixCRLF extends MatchingTask
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error", e );
+                throw new TaskException( "Error", e );
             }
             finally
             {
@@ -743,7 +740,7 @@ public class FixCRLF extends MatchingTask
                 }
                 catch( IOException e )
                 {
-                    throw new BuildException( "Error", e );
+                    throw new TaskException( "Error", e );
                 }
             }
 
@@ -756,7 +753,7 @@ public class FixCRLF extends MatchingTask
             }
             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 @@ public class FixCRLF extends MatchingTask
                     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 @@ public class FixCRLF extends MatchingTask
                 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 @@ public class FixCRLF extends MatchingTask
         }
         catch( IOException e )
         {
-            throw new BuildException( "Error", e );
+            throw new TaskException( "Error", e );
         }
         finally
         {
@@ -860,7 +857,6 @@ public class FixCRLF extends MatchingTask
         }
     }
 
-
     class OneLiner implements Enumeration
     {
 
@@ -874,7 +870,7 @@ public class FixCRLF extends MatchingTask
         private BufferedReader reader;
 
         public OneLiner( File srcFile )
-            throws BuildException
+            throws TaskException
         {
             try
             {
@@ -884,7 +880,7 @@ public class FixCRLF extends MatchingTask
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error", e );
+                throw new TaskException( "Error", e );
             }
         }
 
@@ -931,7 +927,7 @@ public class FixCRLF extends MatchingTask
         }
 
         protected void nextLine()
-            throws BuildException
+            throws TaskException
         {
             int ch = -1;
             int eolcount = 0;
@@ -944,7 +940,7 @@ public class FixCRLF extends MatchingTask
                 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 @@ public class FixCRLF extends MatchingTask
                     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 @@ public class FixCRLF extends MatchingTask
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error", e );
+                throw new TaskException( "Error", e );
             }
         }
 
@@ -1026,7 +1022,7 @@ public class FixCRLF extends MatchingTask
             private String line;
 
             public BufferLine( String line, String eolStr )
-                throws BuildException
+                throws TaskException
             {
                 next = 0;
                 column = 0;
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GUnzip.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GUnzip.java
index 50088af38..bcd2aa6eb 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GUnzip.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GUnzip.java
@@ -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 @@ public class GUnzip extends Unpack
                 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 @@ public class GUnzip extends Unpack
                         fis.close();
                     }
                     catch( IOException ioex )
-                    {}
+                    {
+                    }
                 }
                 if( out != null )
                 {
@@ -76,7 +78,8 @@ public class GUnzip extends Unpack
                         out.close();
                     }
                     catch( IOException ioex )
-                    {}
+                    {
+                    }
                 }
                 if( zIn != null )
                 {
@@ -85,7 +88,8 @@ public class GUnzip extends Unpack
                         zIn.close();
                     }
                     catch( IOException ioex )
-                    {}
+                    {
+                    }
                 }
             }
         }
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GZip.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GZip.java
index 1469cccee..40fd8c279 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GZip.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GZip.java
@@ -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 @@ public class GZip extends Pack
         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 @@ public class GZip extends Pack
                     zOut.close();
                 }
                 catch( IOException e )
-                {}
+                {
+                }
             }
         }
     }
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
index 06a0425ea..4a3691a20 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
@@ -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 @@ public class GenerateKey extends Task
     {
         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 class GenerateKey extends Task
     }
 
     public void setKeysize( final String keysize )
-        throws BuildException
+        throws TaskException
     {
         try
         {
@@ -76,7 +77,7 @@ public class GenerateKey extends Task
         }
         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 class GenerateKey extends Task
     }
 
     public void setValidity( final String validity )
-        throws BuildException
+        throws TaskException
     {
         try
         {
@@ -109,7 +110,7 @@ public class GenerateKey extends Task
         }
         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 class GenerateKey extends Task
     }
 
     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 @@ public class GenerateKey extends Task
         }
 
         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 @@ public class GenerateKey extends Task
                 }
                 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() ) );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
index d05868236..b8288c89b 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Get.java
@@ -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.HttpURLConnection;
 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 @@ public class Get extends Task
         }
     }
 
-
     /**
      * Username for basic auth.
      *
@@ -121,33 +121,32 @@ public class Get extends Task
         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 @@ public class Get extends Task
                 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 @@ public class Get extends Task
             //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 @@ public class Get extends Task
                 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 @@ public class Get extends Task
             log( "Error getting " + source + " to " + dest );
             if( ignoreErrors )
                 return;
-            throw new BuildException( "Error", ioe);
+            throw new TaskException( "Error", ioe );
         }
     }
 
@@ -294,16 +293,16 @@ public class Get extends Task
      * @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 class Get extends Task
 
         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 @@ public class Get extends Task
             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 @@ public class Get extends Task
             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 );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java
index caf080870..21903f655 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Input.java
@@ -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 @@ public class Input extends Task
     /**
      * No arg constructor.
      */
-    public Input() { }
+    public Input()
+    {
+    }
 
     /**
      * Defines the name of a property to be created from input. Behaviour is
@@ -90,10 +93,10 @@ public class Input extends Task
     /**
      * 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 @@ public class Input extends Task
             }
             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 @@ public class Input extends Task
         {
             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
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java
index 8d5aec951..37877733c 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Jar.java
@@ -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 @@ public class Jar extends Zip
     {
         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 @@ public class Jar extends Zip
         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 class Jar extends Zip
     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 @@ public class Jar extends Zip
      * @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 @@ public class Jar extends Zip
             {
                 // 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 @@ public class Jar extends Zip
     }
 
     protected void finalizeZipOutputStream( ZipOutputStream zOut )
-        throws IOException, BuildException
+        throws IOException, TaskException
     {
         if( index )
         {
@@ -222,7 +231,7 @@ public class Jar extends Zip
     }
 
     protected void initZipOutputStream( ZipOutputStream zOut )
-        throws IOException, BuildException
+        throws IOException, TaskException
     {
         try
         {
@@ -232,9 +241,9 @@ public class Jar extends Zip
             {
                 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 @@ public class Jar extends Zip
         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 @@ public class Jar extends Zip
         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 @@ public class Jar extends Zip
             }
             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 @@ public class Jar extends Zip
         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 @@ public class Jar extends Zip
         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 @@ public class Jar extends Zip
         catch( ManifestException e )
         {
             log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR );
-            throw new BuildException( "Invalid Manifest", e );
+            throw new TaskException( "Invalid Manifest", e );
         }
     }
 }
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
index 2671c6e0f..24972620c 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Java.java
@@ -12,7 +12,7 @@ import java.io.FileOutputStream;
 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 @@ public class Java extends Task
      * 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 @@ public class Java extends Task
     }
 
     /**
-     * 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 @@ public class Java extends Task
      * 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 @@ public class Java extends Task
     /**
      * 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 @@ public class Java extends Task
      *
      * @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 @@ public class Java extends Task
      *
      * @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 @@ public class Java extends Task
      * 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 @@ public class Java extends Task
             }
             catch( IOException io )
             {
-                throw new BuildException( "Error", io );
+                throw new TaskException( "Error", io );
             }
             finally
             {
@@ -358,10 +358,10 @@ public class Java extends Task
      *
      * @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 @@ public class Java extends Task
             }
             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 @@ public class Java extends Task
             }
             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
         {
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
index 9ff441be4..b8cd75ea0 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
@@ -10,8 +10,8 @@ package org.apache.tools.ant.taskdefs;
 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 @@ public class Javac extends MatchingTask
     }
 
     /**
-     * Throw a BuildException if compilation fails
+     * Throw a TaskException if compilation fails
      *
      * @param fail The new Failonerror value
      */
@@ -715,26 +715,26 @@ public class Javac extends MatchingTask
     /**
      * 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 @@ public class Javac extends MatchingTask
             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 @@ public class Javac extends MatchingTask
             {
                 if( failOnError )
                 {
-                    throw new BuildException( FAIL_MSG );
+                    throw new TaskException( FAIL_MSG );
                 }
                 else
                 {
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
index 98adc71a3..d5a992bbd 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -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.io.PrintWriter;
 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 class Javadoc extends Task
     }
 
     public void setAdditionalparam( String add )
+        throws TaskException
     {
         cmd.createArgument().setLine( add );
     }
@@ -300,6 +301,7 @@ public class Javadoc extends Task
     }
 
     public void setLinkoffline( String src )
+        throws TaskException
     {
         if( !javadoc1 )
         {
@@ -309,14 +311,14 @@ public class Javadoc extends Task
                 "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 class Javadoc extends Task
     }
 
     public void setSourcefiles( String src )
+        throws TaskException
     {
         StringTokenizer tok = new StringTokenizer( src, "," );
         while( tok.hasMoreTokens() )
@@ -606,12 +609,12 @@ public class Javadoc extends Task
     }
 
     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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
         {
             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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
             {
                 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 @@ public class Javadoc extends Task
                         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 @@ public class Javadoc extends Task
             // 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 @@ public class Javadoc extends Task
                         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 @@ public class Javadoc extends Task
                         else
                         {
                             log( "Warning: No package list was found at " + packageListLocation,
-                                Project.MSG_VERBOSE );
+                                 Project.MSG_VERBOSE );
                         }
                     }
                     else
@@ -790,14 +793,14 @@ public class Javadoc extends Task
             // 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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
                 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 @@ public class Javadoc extends Task
                         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 @@ public class Javadoc extends Task
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error creating temporary file", e );
+                throw new TaskException( "Error creating temporary file", e );
             }
             finally
             {
@@ -917,12 +920,12 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
                 err.close();
             }
             catch( IOException e )
-            {}
+            {
+            }
         }
     }
 
@@ -967,7 +971,7 @@ public class Javadoc extends Task
         // 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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
      */
     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 @@ public class Javadoc extends Task
 
         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 @@ public class Javadoc extends Task
         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 @@ public class Javadoc extends Task
         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 @@ public class Javadoc extends Task
 
             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 @@ public class Javadoc extends Task
 
                 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 @@ public class Javadoc extends Task
 
                     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 @@ public class Javadoc extends Task
         }
         catch( IOException ioex )
         {
-            throw new BuildException( "Error creating temporary file", ioex );
+            throw new TaskException( "Error creating temporary file", ioex );
         }
         finally
         {
@@ -1323,7 +1327,9 @@ public class Javadoc extends Task
         private Vector packages = new Vector( 3 );
         private Html title;
 
-        public GroupArgument() { }
+        public GroupArgument()
+        {
+        }
 
         public void setPackages( String src )
         {
@@ -1380,7 +1386,9 @@ public class Javadoc extends Task
         private String href;
         private File packagelistLoc;
 
-        public LinkArgument() { }
+        public LinkArgument()
+        {
+        }
 
         public void setHref( String hr )
         {
@@ -1428,7 +1436,6 @@ public class Javadoc extends Task
             super( Javadoc.this, level );
         }
 
-
         protected void logFlush()
         {
             if( queuedLine != null )
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
index f715beaaa..f3684dd40 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java
@@ -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.
@@ -47,7 +47,6 @@ public class LogOutputStream extends OutputStream return level; } - /** * Writes all remaining * @@ -61,7 +60,6 @@ public class LogOutputStream extends OutputStream super.close(); } - /** * Write the data to the buffer and flush the buffer, if a line separator is * detected. @@ -72,7 +70,7 @@ public class LogOutputStream extends OutputStream public void write( int cc ) throws IOException { - final byte c = ( byte )cc; + final byte c = (byte)cc; if( ( c == '\n' ) || ( c == '\r' ) ) { if( !skip ) @@ -83,7 +81,6 @@ public class LogOutputStream extends OutputStream skip = ( c == '\r' ); } - /** * Converts the buffer to a string and sends it to processLine */ diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java index abb58ef52..42d371b7c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/LogStreamHandler.java @@ -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 class LogStreamHandler extends PumpStreamHandler 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 @@ public class LogStreamHandler extends PumpStreamHandler catch( IOException e ) { // plain impossible - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Manifest.java index fa0e3f61c..19fc3110b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Manifest.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Manifest.java @@ -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.io.UnsupportedEncodingException; 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task * 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task } 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 @@ public class Manifest extends Task { 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 @@ public class Manifest extends Task { 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 @@ public class Manifest extends Task return false; } - Manifest rhsManifest = ( Manifest )rhs; + Manifest rhsManifest = (Manifest)rhs; if( manifestVersion == null ) { if( rhsManifest.manifestVersion != null ) @@ -281,10 +282,10 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task /** * 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 @@ public class Manifest extends Task } 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 @@ public class Manifest extends Task f.close(); } catch( IOException e ) - {} + { + } } } } @@ -347,7 +349,7 @@ public class Manifest extends Task } catch( ManifestException m ) { - throw new BuildException( "Manifest is invalid", m ); + throw new TaskException( "Manifest is invalid", m ); } PrintWriter w = null; @@ -358,7 +360,8 @@ public class Manifest extends Task } catch( IOException e ) { - throw new BuildException( "Failed to write " + manifestFile e ); + throw new TaskException( "Failed to write " + manifestFile + e ); } finally { @@ -384,11 +387,11 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task } } - 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 @@ public class Manifest extends Task /** * Construct an empty attribute */ - public Attribute() { } + public Attribute() + { + } /** * Construct an attribute by parsing a line from the Manifest @@ -564,7 +569,7 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task } 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 @@ public class Manifest extends Task { 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task String check = addAttributeAndCheck( attribute ); if( check != null ) { - throw new BuildException( "Specify the section name using the \"name\" attribute of the
element rather " + - "than using a \"Name\" manifest attribute" ); + throw new TaskException( "Specify the section name using the \"name\" attribute of the
element rather " + + "than using a \"Name\" manifest attribute" ); } } @@ -784,16 +789,16 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task } // 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 @@ public class Manifest extends Task 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 ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ManifestException.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ManifestException.java index 813da555e..3ff9f756f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ManifestException.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ManifestException.java @@ -7,8 +7,6 @@ */ package org.apache.tools.ant.taskdefs; - - /** * Exception thrown indicating problems in a JAR Manifest * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java index 375d11526..6ba88ca64 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java @@ -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 @@ public abstract class MatchingTask extends Task * @return The DirectoryScanner value */ protected DirectoryScanner getDirectoryScanner( File baseDir ) + throws TaskException { fileset.setDir( baseDir ); fileset.setDefaultexcludes( useDefaultExcludes ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Mkdir.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Mkdir.java index f186760f1..0d10af461 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Mkdir.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Mkdir.java @@ -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 class Mkdir extends Task } 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 @@ public class Mkdir extends Task { 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() ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Move.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Move.java index 4d021bdf5..c71fa4c89 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Move.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Move.java @@ -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 @@ public class Move extends Copy 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 @@ public class Move extends Copy } 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy { 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy * @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 @@ public class Move extends Copy { 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 ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Pack.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Pack.java index 2bd1d6ee2..8bf3531f2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Pack.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Pack.java @@ -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 abstract class Pack extends Task } public void execute() - throws BuildException + throws TaskException { validate(); log( "Building: " + zipFile.getAbsolutePath() ); @@ -64,30 +65,30 @@ public abstract class Pack extends Task { 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 ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Parallel.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Parallel.java index 942d7f1cd..5f8cf0938 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Parallel.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Parallel.java @@ -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.

* @@ -23,7 +23,7 @@ import org.apache.tools.ant.TaskContainer; * @author Conor MacNeill */ public class Parallel extends Task - implements TaskContainer + implements TaskContainer { /** @@ -31,17 +31,16 @@ public class Parallel extends Task */ private Vector nestedTasks = new Vector(); - /** * Add a nested task to execute parallel (asynchron).

* * * * @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 @@ public class Parallel extends Task * 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 @@ public class Parallel extends Task { try { - threads[i].join(); + threads[ i ].join(); } catch( InterruptedException ie ) { @@ -91,7 +90,7 @@ public class Parallel extends Task ; 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 @@ public class Parallel extends Task { 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 @@ public class Parallel extends Task 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() ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Patch.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Patch.java index f1edcac78..4a6e9709d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Patch.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Patch.java @@ -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 @@ public class Patch extends Task { 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 @@ public class Patch extends Task * patch's -p 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 @@ public class Patch extends Task } 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 @@ public class Patch extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java index e508b580a..d844183c7 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PathConvert.java @@ -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 @@ public class PathConvert extends Task 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 @@ public class PathConvert extends Task /** * 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 @@ public class PathConvert extends Task } 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 @@ public class PathConvert extends Task 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 @@ public class PathConvert extends Task 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 @@ public class PathConvert extends Task * * @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 @@ public class PathConvert extends Task { 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 diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java index 590e86fd1..04d0f1b06 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java @@ -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 @@ import java.util.Vector; * @author Michael Newcomb */ class ProcessDestroyer - extends Thread + extends Thread { private Vector processes = new Vector(); @@ -83,7 +84,7 @@ class ProcessDestroyer Enumeration e = processes.elements(); while( e.hasMoreElements() ) { - ( ( Process )e.nextElement() ).destroy(); + ( (Process)e.nextElement() ).destroy(); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java index 6ec1b4fa7..31a7e773f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -16,7 +16,6 @@ import java.util.Properties; 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; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java index ab5109052..b8c13478b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/PumpStreamHandler.java @@ -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 @@ public class PumpStreamHandler implements ExecuteStreamHandler 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 @@ public class PumpStreamHandler implements ExecuteStreamHandler 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() @@ -111,7 +114,6 @@ public class PumpStreamHandler implements ExecuteStreamHandler inputThread = createPump( is, os ); } - /** * Creates a stream pumper to copy the given input stream to the given * output stream. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java index ebe3fcc92..7c5cc8875 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Recorder.java @@ -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 @@ public class Recorder extends Task /** * 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 @@ public class Recorder extends Task * @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 @@ public class Recorder extends Task } 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 class Recorder extends Task public static class VerbosityLevelChoices extends EnumeratedAttribute { private final static String[] values = {"error", "warn", "info", - "verbose", "debug"}; + "verbose", "debug"}; public String[] getValues() { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java index 4dad6229e..6d93689fd 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/RecorderEntry.java @@ -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 @@ public class RecorderEntry implements BuildLogger 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" ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java index 381d8ef91..3756b06d4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Replace.java @@ -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.Reader; 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 @@ public class Replace extends MatchingTask private int fileCount; private int replaceCount; - /** * Set the source files path when using matching tasks. * @@ -80,7 +80,6 @@ public class Replace extends MatchingTask this.encoding = encoding; } - /** * Set the source file. * @@ -133,7 +132,7 @@ public class Replace extends MatchingTask } public Properties getProperties( File propertyFile ) - throws BuildException + throws TaskException { Properties properties = new Properties(); @@ -144,12 +143,12 @@ public class Replace extends MatchingTask 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 @@ public class Replace extends MatchingTask /** * 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 @@ public class Replace extends MatchingTask 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 @@ public class Replace extends MatchingTask /** * 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 @@ public class Replace extends MatchingTask * 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 @@ public class Replace extends MatchingTask // 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 @@ public class Replace extends MatchingTask { break; } - tmpBuf.append( ( char )readChar ); + tmpBuf.append( (char)readChar ); totread++; } @@ -381,8 +380,8 @@ public class Replace extends MatchingTask } 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 @@ public class Replace extends MatchingTask reader.close(); } catch( IOException e ) - {} + { + } } if( writer != null ) { @@ -402,7 +402,8 @@ public class Replace extends MatchingTask writer.close(); } catch( IOException e ) - {} + { + } } if( temp != null ) { @@ -418,7 +419,7 @@ public class Replace extends MatchingTask 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 @@ public class Replace extends MatchingTask { if( property != null ) { - return ( String )properties.getProperty( property ); + return (String)properties.getProperty( property ); } else if( value != null ) { @@ -546,26 +547,26 @@ public class Replace extends MatchingTask } 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 @@ public class Replace extends MatchingTask 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 @@ public class Replace extends MatchingTask properties.getProperty( property ) == null ) { String message = "property \"" + property + "\" was not found in " + propertyFile.getPath(); - throw new BuildException( message ); + throw new TaskException( message ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java index 947e94329..932bcdbc4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Rmic.java @@ -681,7 +681,7 @@ public class Rmic extends MatchingTask { 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 ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 87c397bc2..6f80e8dc9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -30,6 +30,7 @@ import java.util.Enumeration; 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.EnumeratedAttribute; 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 diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java index d69728485..cca459009 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SendEmail.java @@ -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.io.PrintStream; 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 @@ public class SendEmail extends Task 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 @@ public class SendEmail extends Task * @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 @@ public class SendEmail extends Task /** * 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 @@ public class SendEmail extends Task } else { - throw new BuildException( "Attribute \"from\" is required." ); + throw new TaskException( "Attribute \"from\" is required." ); } if( toList != null ) @@ -309,7 +312,7 @@ public class SendEmail extends Task } else { - throw new BuildException( "Attribute \"toList\" is required." ); + throw new TaskException( "Attribute \"toList\" is required." ); } if( subject != null ) @@ -321,15 +324,15 @@ public class SendEmail extends Task { 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 @@ public class SendEmail extends Task 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 @@ public class SendEmail extends Task } 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 @@ public class SendEmail extends Task String err = "IO error sending mail " + ioe.toString(); if( failOnError ) { - throw new BuildException( err, ioe ); + throw new TaskException( err, ioe ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sequential.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sequential.java index 59fa575be..15f042962 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sequential.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sequential.java @@ -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.

* @@ -21,7 +21,7 @@ import org.apache.tools.ant.TaskContainer; * @author Thomas Christen chr@active.ch */ public class Sequential extends Task - implements TaskContainer + implements TaskContainer { /** @@ -46,14 +46,14 @@ public class Sequential extends Task /** * 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(); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SignJar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SignJar.java index 29ffddd1a..b21068d41 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SignJar.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/SignJar.java @@ -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 @@ public class SignJar extends Task 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 @@ public class SignJar extends Task // 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 @@ public class SignJar extends Task 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 @@ public class SignJar extends Task else { return jarFile.getEntry( SIG_START + alias.toUpperCase() + - SIG_END ) != null; + SIG_END ) != null; } } catch( IOException e ) @@ -209,7 +209,8 @@ public class SignJar extends Task jarFile.close(); } catch( IOException e ) - {} + { + } } } } @@ -245,21 +246,21 @@ public class SignJar extends Task } 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 @@ public class SignJar extends Task 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 ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java index 6c1b9b734..2238b2c53 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Sleep.java @@ -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 @@ public class Sleep extends Task */ private int milliseconds = 0; - /** * Creates new instance */ - public Sleep() { } - + public Sleep() + { + } /** * Sets the FailOnError attribute of the MimeMail object @@ -58,7 +59,6 @@ public class Sleep extends Task this.failOnError = failOnError; } - /** * Sets the Hours attribute of the Sleep object * @@ -69,7 +69,6 @@ public class Sleep extends Task this.hours = hours; } - /** * Sets the Milliseconds attribute of the Sleep object * @@ -80,7 +79,6 @@ public class Sleep extends Task this.milliseconds = milliseconds; } - /** * Sets the Minutes attribute of the Sleep object * @@ -91,7 +89,6 @@ public class Sleep extends Task this.minutes = minutes; } - /** * Sets the Seconds attribute of the Sleep object * @@ -102,7 +99,6 @@ public class Sleep extends Task this.seconds = seconds; } - /** * sleep for a period of time * @@ -119,29 +115,28 @@ public class Sleep extends Task } } - /** - * 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 @@ public class Sleep extends Task } } - /** * 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 @@ public class Sleep extends Task private long getSleepTime() { - return ( ( ( ( long )hours * 60 ) + minutes ) * 60 + seconds ) * 1000 + milliseconds; + return ( ( ( (long)hours * 60 ) + minutes ) * 60 + seconds ) * 1000 + milliseconds; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java index 8e8a8e9ef..1af5ffe86 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/StreamPumper.java @@ -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 @@ public class StreamPumper implements Runnable private InputStream is; private OutputStream os; - /** * Create a new stream pumper. * @@ -39,14 +39,13 @@ public class StreamPumper implements Runnable 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 @@ public class StreamPumper implements Runnable Thread.sleep( SLEEP ); } catch( InterruptedException e ) - {} + { + } } } catch( IOException e ) - {} + { + } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java index cbcae1f7d..f50c8fb7e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tar.java @@ -13,7 +13,7 @@ import java.io.FileOutputStream; 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 class Tar extends MatchingTask } 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 @@ public class Tar extends MatchingTask 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 @@ public class Tar extends MatchingTask { 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 @@ public class Tar extends MatchingTask 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 @@ public class Tar extends MatchingTask } else if( longFileMode.isFailMode() ) { - throw new BuildException( + throw new TaskException( "Entry: " + vPath + " longer than " + TarConstants.NAMELEN + "characters." ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java index d53db1655..6339d5980 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Touch.java @@ -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.DateFormat; 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 @@ public class Touch extends Task /** * 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 @@ public class Touch extends Task /** * 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 @@ public class Touch extends Task 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 @@ public class Touch extends Task 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 @@ public class Touch extends Task // 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 @@ public class Touch extends Task 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 @@ public class Touch extends Task } 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 ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tstamp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tstamp.java index 5c97426a0..655b4919e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tstamp.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Tstamp.java @@ -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.NoSuchElementException; 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 class Tstamp extends Task } public void execute() - throws BuildException + throws TaskException { try { @@ -72,14 +73,14 @@ public class Tstamp extends Task 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 @@ public class Tstamp extends Task 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 class Tstamp extends Task 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 @@ public class Tstamp extends Task country = st.nextToken(); if( st.hasMoreElements() ) { - throw new BuildException( "bad locale format" ); + throw new TaskException( "bad locale format" ); } } } @@ -176,7 +177,7 @@ public class Tstamp extends Task } catch( NoSuchElementException e ) { - throw new BuildException( "bad locale format", e ); + throw new TaskException( "bad locale format", e ); } } @@ -209,12 +210,12 @@ public class Tstamp extends Task { 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; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Unpack.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Unpack.java index 98bbf8f86..cc449a245 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Unpack.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Unpack.java @@ -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 @@ public abstract class Unpack extends Task 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 @@ public abstract class Unpack extends Task 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 @@ public abstract class Unpack extends Task } 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 ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java index ea7539ffe..0f98af71b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Untar.java @@ -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 @@ public class Untar extends Expand 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 @@ public class Untar extends Expand tis.close(); } catch( IOException e ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java index 43ae44064..6dc8399a2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/UpToDate.java @@ -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 @@ public class UpToDate extends MatchingTask implements Condition * 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 @@ public class UpToDate extends MatchingTask implements Condition { if( sourceFileSets.size() == 0 ) { - throw new BuildException( "At least one element must be set" ); + throw new TaskException( "At least one 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 @@ public class UpToDate extends MatchingTask implements Condition 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 @@ public class UpToDate extends MatchingTask implements Condition 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 ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/WaitFor.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/WaitFor.java index 9f87abb1d..a96faa7ef 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/WaitFor.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/WaitFor.java @@ -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 @@ public class WaitFor extends ConditionBase * 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 " ); + throw new TaskException( "You must not nest more than one condition into " ); } if( countConditions() < 1 ) { - throw new BuildException( "You must nest a condition into " ); + throw new TaskException( "You must nest a condition into " ); } - Condition c = ( Condition )getConditions().nextElement(); + Condition c = (Condition)getConditions().nextElement(); maxWaitMillis *= maxWaitMultiplier; checkEveryMillis *= checkEveryMultiplier; @@ -149,7 +150,7 @@ public class WaitFor extends ConditionBase private final static String[] units = { MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK - }; + }; private Hashtable timeTable = new Hashtable(); @@ -166,7 +167,7 @@ public class WaitFor extends ConditionBase public long getMultiplier() { String key = getValue().toLowerCase(); - Long l = ( Long )timeTable.get( key ); + Long l = (Long)timeTable.get( key ); return l.longValue(); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java index 33dc1e83b..8e1649fa0 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/War.java @@ -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 @@ public class War extends Jar { 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 @@ public class War extends Jar } 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 @@ public class War extends Jar 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 { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java index a4d01bd8e..4a64f3f54 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTLiaison.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs; + import java.io.File; /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index 37d5d6c41..18332d0ef 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -10,8 +10,8 @@ package org.apache.tools.ant.taskdefs; 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger /** * 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger if( xslFile == null ) { - throw new BuildException( "no stylesheet specified" ); + throw new TaskException( "no stylesheet specified" ); } if( baseDir == null ) @@ -256,7 +256,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } else @@ -324,7 +324,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger e4.printStackTrace(); e3.printStackTrace(); e2.printStackTrace(); - throw new BuildException( "Error", e1 ); + throw new TaskException( "Error", e1 ); } } } @@ -338,10 +338,10 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger * 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger * @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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger 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 class XSLTProcess extends MatchingTask implements XSLTLogger } 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; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java index 6317eb017..5bd0059de 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -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.Stack; 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask 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 class Zip extends MatchingTask } 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 @@ public class Zip extends MatchingTask { 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 @@ public class Zip extends MatchingTask } 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 @@ public class Zip extends MatchingTask { 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 @@ public class Zip extends MatchingTask } } - throw new BuildException( msg, ioe ); + throw new TaskException( msg, ioe ); } finally { @@ -384,7 +385,7 @@ public class Zip extends MatchingTask if( !renamedFile.delete() ) { log( "Warning: unable to delete temporary file " + - renamedFile.getName(), Project.MSG_WARN ); + renamedFile.getName(), Project.MSG_WARN ); } } } @@ -400,7 +401,6 @@ public class Zip extends MatchingTask return addingNewFiles; } - /** * Check whether the archive is up-to-date; and handle behavior for empty * archives. @@ -409,10 +409,10 @@ public class Zip extends MatchingTask * @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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask { 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask // 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask // 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 @@ public class Zip extends MatchingTask } 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask while( !directories.isEmpty() ) { - String dir = ( String )directories.pop(); + String dir = (String)directories.pop(); File f = null; if( baseDir != null ) { @@ -633,9 +633,9 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask } 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 @@ public class Zip extends MatchingTask // 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask zOut.putNextEntry( ze ); - byte[] buffer = new byte[8 * 1024]; + byte[] buffer = new byte[ 8 * 1024 ]; int count = 0; do { @@ -837,7 +841,7 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask { 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 ); @@ -860,7 +864,6 @@ public class Zip extends MatchingTask } } - /** * Possible behaviors when there are no matching files for the task. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java index f82338b01..a7a52a947 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.taskdefs.Javac; /** @@ -36,8 +37,8 @@ public interface CompilerAdapter * Executes the task. * * @return has the compilation been successful - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean execute() - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java index 5e0e91536..b030ff97d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; @@ -21,7 +22,9 @@ public class CompilerAdapterFactory /** * This is a singlton -- can't create instances!! */ - private CompilerAdapterFactory() { } + private CompilerAdapterFactory() + { + } /** * Based on the parameter passed in, this method creates the necessary @@ -45,11 +48,11 @@ public class CompilerAdapterFactory * classname of the compiler's adapter. * @param task a task to log through. * @return The Compiler value - * @throws BuildException if the compiler type could not be resolved into a + * @throws TaskException if the compiler type could not be resolved into a * compiler adapter. */ public static CompilerAdapter getCompiler( String compilerType, Task task ) - throws BuildException + throws TaskException { /* * If I've done things right, this should be the extent of the @@ -81,7 +84,7 @@ public class CompilerAdapterFactory catch( ClassNotFoundException cnfe ) { task.log( "Modern compiler is not available - using " - + "classic compiler", Project.MSG_WARN ); + + "classic compiler", Project.MSG_WARN ); return new Javac12(); } return new Javac13(); @@ -113,32 +116,32 @@ public class CompilerAdapterFactory * * @param className The fully qualified classname to be created. * @return Description of the Returned Value - * @throws BuildException This is the fit that is thrown if className isn't + * @throws TaskException This is the fit that is thrown if className isn't * an instance of CompilerAdapter. */ private static CompilerAdapter resolveClassName( String className ) - throws BuildException + throws TaskException { try { Class c = Class.forName( className ); Object o = c.newInstance(); - return ( CompilerAdapter )o; + return (CompilerAdapter)o; } catch( ClassNotFoundException cnfe ) { - throw new BuildException( className + " can\'t be found.", cnfe ); + throw new TaskException( className + " can\'t be found.", cnfe ); } catch( ClassCastException cce ) { - throw new BuildException( className + " isn\'t the classname of " - + "a compiler adapter.", cce ); + throw new TaskException( className + " isn\'t the classname of " + + "a compiler adapter.", cce ); } catch( Throwable t ) { // for all other possibilities - throw new BuildException( className + " caused an interesting " - + "exception.", t ); + throw new TaskException( className + " caused an interesting " + + "exception.", t ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 8396985a1..d8263ddf5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -6,18 +6,18 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; -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.taskdefs.Execute; import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; -import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.FileUtils; @@ -140,7 +140,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter if( !attributes.isForkedJavac() ) { attributes.log( "Since fork is false, ignoring memoryInitialSize setting.", - Project.MSG_WARN ); + Project.MSG_WARN ); } else { @@ -153,7 +153,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter if( !attributes.isForkedJavac() ) { attributes.log( "Since fork is false, ignoring memoryMaximumSize setting.", - Project.MSG_WARN ); + Project.MSG_WARN ); } else { @@ -229,8 +229,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter if( debug ) { if( useDebugLevel - && Project.getJavaVersion() != Project.JAVA_1_0 - && Project.getJavaVersion() != Project.JAVA_1_1 ) + && Project.getJavaVersion() != Project.JAVA_1_0 + && Project.getJavaVersion() != Project.JAVA_1_1 ) { String debugLevel = attributes.getDebugLevel(); @@ -271,7 +271,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter else { attributes.log( "depend attribute is not supported by the modern compiler", - Project.MSG_WARN ); + Project.MSG_WARN ); } } @@ -405,16 +405,16 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter out = new PrintWriter( new FileWriter( tmpFile ) ); for( int i = firstFileName; i < args.length; i++ ) { - out.println( args[i] ); + out.println( args[ i ] ); } out.flush(); - commandArray = new String[firstFileName + 1]; + commandArray = new String[ firstFileName + 1 ]; System.arraycopy( args, 0, commandArray, 0, firstFileName ); - commandArray[firstFileName] = "@" + tmpFile.getAbsolutePath(); + commandArray[ firstFileName ] = "@" + tmpFile.getAbsolutePath(); } catch( IOException e ) { - throw new BuildException( "Error creating temporary file", e ); + throw new TaskException( "Error creating temporary file", e ); } finally { @@ -425,7 +425,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter out.close(); } catch( Throwable t ) - {} + { + } } } } @@ -437,8 +438,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter try { Execute exe = new Execute( new LogStreamHandler( attributes, - Project.MSG_INFO, - Project.MSG_WARN ) ); + Project.MSG_INFO, + Project.MSG_WARN ) ); exe.setAntRun( project ); exe.setWorkingDirectory( project.getBaseDir() ); exe.setCommandline( commandArray ); @@ -447,8 +448,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter } catch( IOException e ) { - throw new BuildException( "Error running " + args[0] - + " compiler", e ); + throw new TaskException( "Error running " + args[ 0 ] + + " compiler", e ); } } finally @@ -469,7 +470,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter protected void logAndAddFilesToCompile( Commandline cmd ) { attributes.log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); StringBuffer niceSourceList = new StringBuffer( "File" ); if( compileList.length != 1 ) @@ -482,7 +483,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter for( int i = 0; i < compileList.length; i++ ) { - String arg = compileList[i].getAbsolutePath(); + String arg = compileList[ i ].getAbsolutePath(); cmd.createArgument().setValue( arg ); niceSourceList.append( " " + arg + lSep ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java index ee0918e10..015b4dc9a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Gcj.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -24,11 +25,11 @@ public class Gcj extends DefaultCompilerAdapter * Performs a compile using the gcj compiler. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @author tora@debian.org */ public boolean execute() - throws BuildException + throws TaskException { Commandline cmd; attributes.log( "Using gcj compiler", Project.MSG_VERBOSE ); @@ -76,7 +77,7 @@ public class Gcj extends DefaultCompilerAdapter if( destDir.mkdirs() ) { - throw new BuildException( "Can't make output directories. Maybe permission is wrong. " ); + throw new TaskException( "Can't make output directories. Maybe permission is wrong. " ); } ; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java index c5927bacd..11a91a862 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; + import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.Commandline; @@ -29,7 +30,7 @@ public class Javac12 extends DefaultCompilerAdapter { public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using classic compiler", Project.MSG_VERBOSE ); Commandline cmd = setupJavacCommand( true ); @@ -45,24 +46,24 @@ public class Javac12 extends DefaultCompilerAdapter // Call the compile() method Method compile = c.getMethod( "compile", new Class[]{String[].class} ); - Boolean ok = ( Boolean )compile.invoke( compiler, new Object[]{cmd.getArguments()} ); + Boolean ok = (Boolean)compile.invoke( compiler, new Object[]{cmd.getArguments()} ); return ok.booleanValue(); } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use classic compiler, as it is not available" + - " A common solution is to set the environment variable" + - " JAVA_HOME to your jdk directory." ); + throw new TaskException( "Cannot use classic compiler, as it is not available" + + " A common solution is to set the environment variable" + + " JAVA_HOME to your jdk directory." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting classic compiler: ", ex ); + throw new TaskException( "Error starting classic compiler: ", ex ); } } finally @@ -74,7 +75,7 @@ public class Javac12 extends DefaultCompilerAdapter catch( IOException e ) { // plain impossible - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java index c0f5f4bc7..ab153015b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java @@ -6,12 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; + import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - /** * The implementation of the javac compiler for JDK 1.3 This is primarily a * cut-and-paste from the original javac task before it was refactored. @@ -31,7 +31,7 @@ public class Javac13 extends DefaultCompilerAdapter private final static int MODERN_COMPILER_SUCCESS = 0; public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using modern compiler", Project.MSG_VERBOSE ); Commandline cmd = setupModernJavacCommand(); @@ -42,20 +42,20 @@ public class Javac13 extends DefaultCompilerAdapter Class c = Class.forName( "com.sun.tools.javac.Main" ); Object compiler = c.newInstance(); Method compile = c.getMethod( "compile", - new Class[]{( new String[]{} ).getClass()} ); - int result = ( ( Integer )compile.invoke + new Class[]{( new String[]{} ).getClass()} ); + int result = ( (Integer)compile.invoke ( compiler, new Object[]{cmd.getArguments()} ) ).intValue(); return ( result == MODERN_COMPILER_SUCCESS ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting modern compiler", ex ); + throw new TaskException( "Error starting modern compiler", ex ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java index 528b7cd43..365a8bf02 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; @@ -22,10 +23,10 @@ public class JavacExternal extends DefaultCompilerAdapter * Performs a compile using the Javac externally. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using external javac compiler", Project.MSG_VERBOSE ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java index e6e869e60..d35e19944 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jikes.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -32,11 +33,11 @@ public class Jikes extends DefaultCompilerAdapter * been successfully tested with jikes >1.10 * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @author skanthak@muehlheim.de */ public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using jikes compiler", Project.MSG_VERBOSE ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java index ccb0b0f2a..69ede663d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Jvc.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -25,7 +26,7 @@ public class Jvc extends DefaultCompilerAdapter { public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using jvc compiler", Project.MSG_VERBOSE ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java index 4aa6a8c5d..d0d3ca27f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Kjc.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; + import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -22,7 +23,7 @@ public class Kjc extends DefaultCompilerAdapter { public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using kjc compiler", Project.MSG_VERBOSE ); Commandline cmd = setupKjcCommand(); @@ -33,26 +34,26 @@ public class Kjc extends DefaultCompilerAdapter // Call the compile() method Method compile = c.getMethod( "compile", - new Class[]{String[].class} ); - Boolean ok = ( Boolean )compile.invoke( null, - new Object[]{cmd.getArguments()} ); + new Class[]{String[].class} ); + Boolean ok = (Boolean)compile.invoke( null, + new Object[]{cmd.getArguments()} ); return ok.booleanValue(); } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use kjc compiler, as it is not available" + - " A common solution is to set the environment variable" + - " CLASSPATH to your kjc archive (kjc.jar)." ); + throw new TaskException( "Cannot use kjc compiler, as it is not available" + + " A common solution is to set the environment variable" + + " CLASSPATH to your kjc archive (kjc.jar)." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting kjc compiler: ", ex ); + throw new TaskException( "Error starting kjc compiler: ", ex ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java index 3ab63f48b..590af2f2f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/Sj.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; @@ -23,11 +24,11 @@ public class Sj extends DefaultCompilerAdapter * Performs a compile using the sj compiler from Symantec. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @author don@bea.com */ public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using symantec java compiler", Project.MSG_VERBOSE ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/And.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/And.java index 44b9810ac..7c99b98fa 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/And.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/And.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; + import java.util.Enumeration; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * <and> condition container.

@@ -22,12 +23,12 @@ public class And extends ConditionBase implements Condition { public boolean eval() - throws BuildException + throws TaskException { Enumeration enum = getConditions(); while( enum.hasMoreElements() ) { - Condition c = ( Condition )enum.nextElement(); + Condition c = (Condition)enum.nextElement(); if( !c.eval() ) { return false; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Condition.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Condition.java index fc589867c..b1cab7b2a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Condition.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Condition.java @@ -21,7 +21,7 @@ public interface Condition * Is this condition true? * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean eval() throws TaskException; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java index a8a13820d..ceeb8af59 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; + import java.util.Enumeration; import java.util.NoSuchElementException; import java.util.Vector; +import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.taskdefs.Available; import org.apache.tools.ant.taskdefs.Checksum; import org.apache.tools.ant.taskdefs.UpToDate; -import org.apache.myrmidon.framework.Os; /** * Baseclass for the <condition> task as well as several conditions - @@ -201,7 +202,7 @@ public abstract class ConditionBase extends ProjectComponent if( o instanceof ProjectComponent ) { - ( ( ProjectComponent )o ).setProject( getProject() ); + ( (ProjectComponent)o ).setProject( getProject() ); } return o; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java index 306f7928f..732e1c187 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Equals.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Simple String comparison condition. @@ -30,11 +31,11 @@ public class Equals implements Condition } public boolean eval() - throws BuildException + throws TaskException { if( arg1 == null || arg2 == null ) { - throw new BuildException( "both arg1 and arg2 are required in equals" ); + throw new TaskException( "both arg1 and arg2 are required in equals" ); } return arg1.equals( arg2 ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java index b70aa228a..de3eaabd4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Http.java @@ -6,12 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; -import java.io.IOException; + import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; @@ -31,11 +31,11 @@ public class Http extends ProjectComponent implements Condition } public boolean eval() - throws BuildException + throws TaskException { if( spec == null ) { - throw new BuildException( "No url specified in HTTP task" ); + throw new TaskException( "No url specified in HTTP task" ); } log( "Checking for " + spec, Project.MSG_VERBOSE ); try @@ -46,7 +46,7 @@ public class Http extends ProjectComponent implements Condition URLConnection conn = url.openConnection(); if( conn instanceof HttpURLConnection ) { - HttpURLConnection http = ( HttpURLConnection )conn; + HttpURLConnection http = (HttpURLConnection)conn; int code = http.getResponseCode(); log( "Result code for " + spec + " was " + code, Project.MSG_VERBOSE ); if( code > 0 && code < 500 ) @@ -66,7 +66,7 @@ public class Http extends ProjectComponent implements Condition } catch( MalformedURLException e ) { - throw new BuildException( "Badly formed URL: " + spec, e ); + throw new TaskException( "Badly formed URL: " + spec, e ); } return true; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java index e7a6a11be..a5a7f3ffe 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/IsSet.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.ProjectComponent; /** @@ -25,11 +26,11 @@ public class IsSet extends ProjectComponent implements Condition } public boolean eval() - throws BuildException + throws TaskException { if( property == null ) { - throw new BuildException( "No property specified for isset condition" ); + throw new TaskException( "No property specified for isset condition" ); } return getProject().getProperty( property ) != null; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Not.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Not.java index 1af3b0bdb..b03c452a6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Not.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Not.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * <not> condition. Evaluates to true if the single condition nested into @@ -19,17 +20,17 @@ public class Not extends ConditionBase implements Condition { public boolean eval() - throws BuildException + throws TaskException { if( countConditions() > 1 ) { - throw new BuildException( "You must not nest more than one condition into " ); + throw new TaskException( "You must not nest more than one condition into " ); } if( countConditions() < 1 ) { - throw new BuildException( "You must nest a condition into " ); + throw new TaskException( "You must nest a condition into " ); } - return !( ( Condition )getConditions().nextElement() ).eval(); + return !( (Condition)getConditions().nextElement() ).eval(); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Or.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Or.java index 62ca4641c..1a9521ce5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Or.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Or.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; + import java.util.Enumeration; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * <or> condition container.

@@ -22,12 +23,12 @@ public class Or extends ConditionBase implements Condition { public boolean eval() - throws BuildException + throws TaskException { Enumeration enum = getConditions(); while( enum.hasMoreElements() ) { - Condition c = ( Condition )enum.nextElement(); + Condition c = (Condition)enum.nextElement(); if( c.eval() ) { return true; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java index b1e47526a..3ecef0857 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/condition/Socket.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; + 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.ProjectComponent; @@ -33,15 +34,15 @@ public class Socket extends ProjectComponent implements Condition } public boolean eval() - throws BuildException + throws TaskException { if( server == null ) { - throw new BuildException( "No server specified in Socket task" ); + throw new TaskException( "No server specified in Socket task" ); } if( port == 0 ) { - throw new BuildException( "No port specified in Socket task" ); + throw new TaskException( "No port specified in Socket task" ); } log( "Checking for listener at " + server + ":" + port, Project.MSG_VERBOSE ); try diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java index 2508be19e..12eb748d2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java @@ -12,7 +12,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; import java.net.URL; -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.taskdefs.Execute; @@ -110,7 +110,7 @@ public class ANTLR extends Task } public void execute() - throws BuildException + throws TaskException { validateAttributes(); @@ -127,7 +127,7 @@ public class ANTLR extends Task int err = run( commandline.getCommandline() ); if( err == 1 ) { - throw new BuildException( "ANTLR returned: " + err ); + throw new TaskException( "ANTLR returned: " + err ); } } else @@ -144,10 +144,10 @@ public class ANTLR extends Task * Adds the jars or directories containing Antlr this should make the forked * JVM work without having to specify it directly. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void init() - throws BuildException + throws TaskException { addClasspathEntry( "/antlr/Tool.class" ); } @@ -196,7 +196,7 @@ public class ANTLR extends Task } private File getGeneratedFile() - throws BuildException + throws TaskException { String generatedFileName = null; try @@ -216,11 +216,11 @@ public class ANTLR extends Task } catch( Exception e ) { - throw new BuildException( "Unable to determine generated class", e ); + throw new TaskException( "Unable to determine generated class", e ); } if( generatedFileName == null ) { - throw new BuildException( "Unable to determine generated class" ); + throw new TaskException( "Unable to determine generated class" ); } return new File( outputDirectory, generatedFileName + ".java" ); } @@ -230,10 +230,10 @@ public class ANTLR extends Task * * @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 { Execute exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ), null ); @@ -249,16 +249,16 @@ public class ANTLR extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } private void validateAttributes() - throws BuildException + throws TaskException { if( target == null || !target.isFile() ) { - throw new BuildException( "Invalid target: " + target ); + throw new TaskException( "Invalid target: " + target ); } // if no output directory is specified, used the target's directory @@ -269,7 +269,7 @@ public class ANTLR extends Task } if( !outputDirectory.isDirectory() ) { - throw new BuildException( "Invalid output directory: " + outputDirectory ); + throw new TaskException( "Invalid output directory: " + outputDirectory ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java index 65510cf56..34364ae10 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -13,17 +14,16 @@ import java.io.OutputStream; import java.io.PrintWriter; 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.tools.ant.taskdefs.ExecTask; import org.apache.tools.ant.taskdefs.MatchingTask; -import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.util.FileUtils; - /** * Create a CAB archive. * @@ -106,7 +106,7 @@ public class Cab extends MatchingTask } public void execute() - throws BuildException + throws TaskException { checkConfiguration(); @@ -144,7 +144,7 @@ public class Cab extends MatchingTask catch( IOException ex ) { String msg = "Problem creating " + cabFile + " " + ex.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } else @@ -178,7 +178,7 @@ public class Cab extends MatchingTask catch( IOException ioe ) { String msg = "Problem creating " + cabFile + " " + ioe.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } } @@ -189,10 +189,10 @@ public class Cab extends MatchingTask * traditional include parameters. * * @return The FileList value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected Vector getFileList() - throws BuildException + throws TaskException { Vector files = new Vector(); @@ -206,7 +206,7 @@ public class Cab extends MatchingTask // get files from filesets for( int i = 0; i < filesets.size(); i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); if( fs != null ) { appendFiles( files, fs.getDirectoryScanner( project ) ); @@ -248,7 +248,7 @@ public class Cab extends MatchingTask for( int i = 0; i < dsfiles.length; i++ ) { - files.addElement( dsfiles[i] ); + files.addElement( dsfiles[ i ] ); } } @@ -258,19 +258,19 @@ public class Cab extends MatchingTask * for side-effects to me... */ protected void checkConfiguration() - throws BuildException + throws TaskException { if( baseDir == null ) { - throw new BuildException( "basedir attribute must be set!" ); + throw new TaskException( "basedir attribute must be set!" ); } if( !baseDir.exists() ) { - throw new BuildException( "basedir does not exist!" ); + throw new TaskException( "basedir does not exist!" ); } if( cabFile == null ) { - throw new BuildException( "cabfile attribute must be set!" ); + throw new TaskException( "cabfile attribute must be set!" ); } } @@ -281,6 +281,7 @@ public class Cab extends MatchingTask * @return Description of the Returned Value */ protected Commandline createCommand( File listFile ) + throws TaskException { Commandline command = new Commandline(); command.setExecutable( "cabarc" ); @@ -310,12 +311,12 @@ public class Cab extends MatchingTask * appears in the logs to be the same task as this one. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected ExecTask createExec() - throws BuildException + throws TaskException { - ExecTask exec = ( ExecTask )project.createTask( "exec" ); + ExecTask exec = (ExecTask)project.createTask( "exec" ); exec.setOwningTarget( this.getOwningTarget() ); exec.setTaskName( this.getTaskName() ); exec.setDescription( this.getDescription() ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java index 8f60da24c..7d6980d65 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -13,8 +14,8 @@ import java.io.IOException; import java.io.PrintStream; import java.util.Date; import java.util.Properties; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; @@ -682,10 +683,10 @@ public class IContract extends MatchingTask /** * Executes the task * - * @exception BuildException if the instrumentation fails + * @exception TaskException if the instrumentation fails */ public void execute() - throws BuildException + throws TaskException { preconditions(); scan(); @@ -720,7 +721,7 @@ public class IContract extends MatchingTask // Prepare the directories for iContract. iContract will make them if they // don't exist, but for some reason I don't know, it will complain about the REP files // afterwards - Mkdir mkdir = ( Mkdir )project.createTask( "mkdir" ); + Mkdir mkdir = (Mkdir)project.createTask( "mkdir" ); mkdir.setDir( instrumentDir ); mkdir.execute(); mkdir.setDir( buildDir ); @@ -737,25 +738,25 @@ public class IContract extends MatchingTask classpathHelper.modify( baseClasspath ); // Create the classpath required to compile the sourcefiles BEFORE instrumentation - Path beforeInstrumentationClasspath = ( ( Path )baseClasspath.clone() ); + Path beforeInstrumentationClasspath = ( (Path)baseClasspath.clone() ); beforeInstrumentationClasspath.append( new Path( getProject(), srcDir.getAbsolutePath() ) ); // Create the classpath required to compile the sourcefiles AFTER instrumentation - Path afterInstrumentationClasspath = ( ( Path )baseClasspath.clone() ); + Path afterInstrumentationClasspath = ( (Path)baseClasspath.clone() ); afterInstrumentationClasspath.append( new Path( getProject(), instrumentDir.getAbsolutePath() ) ); afterInstrumentationClasspath.append( new Path( getProject(), repositoryDir.getAbsolutePath() ) ); afterInstrumentationClasspath.append( new Path( getProject(), srcDir.getAbsolutePath() ) ); afterInstrumentationClasspath.append( new Path( getProject(), buildDir.getAbsolutePath() ) ); // Create the classpath required to automatically compile the repository files - Path repositoryClasspath = ( ( Path )baseClasspath.clone() ); + Path repositoryClasspath = ( (Path)baseClasspath.clone() ); repositoryClasspath.append( new Path( getProject(), instrumentDir.getAbsolutePath() ) ); repositoryClasspath.append( new Path( getProject(), srcDir.getAbsolutePath() ) ); repositoryClasspath.append( new Path( getProject(), repositoryDir.getAbsolutePath() ) ); repositoryClasspath.append( new Path( getProject(), buildDir.getAbsolutePath() ) ); // Create the classpath required for iContract itself - Path iContractClasspath = ( ( Path )baseClasspath.clone() ); + Path iContractClasspath = ( (Path)baseClasspath.clone() ); iContractClasspath.append( new Path( getProject(), System.getProperty( "java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar" ) ); iContractClasspath.append( new Path( getProject(), srcDir.getAbsolutePath() ) ); iContractClasspath.append( new Path( getProject(), repositoryDir.getAbsolutePath() ) ); @@ -763,7 +764,7 @@ public class IContract extends MatchingTask iContractClasspath.append( new Path( getProject(), buildDir.getAbsolutePath() ) ); // Create a forked java process - Java iContract = ( Java )project.createTask( "java" ); + Java iContract = (Java)project.createTask( "java" ); iContract.setTaskName( getTaskName() ); iContract.setFork( true ); iContract.setClassname( "com.reliablesystems.iContract.Tool" ); @@ -784,7 +785,7 @@ public class IContract extends MatchingTask args.append( "@" ).append( targets.getAbsolutePath() ); iContract.createArg().setLine( args.toString() ); -//System.out.println( "JAVA -classpath " + iContractClasspath + " com.reliablesystems.iContract.Tool " + args.toString() ); + //System.out.println( "JAVA -classpath " + iContractClasspath + " com.reliablesystems.iContract.Tool " + args.toString() ); // update iControlProperties if it's set. if( updateIcontrol ) @@ -825,7 +826,7 @@ public class IContract extends MatchingTask log( classpath.toString() ); log( "If you don't have the iContract jar, go get it at http://www.reliable-systems.com/tools/" ); } - throw new BuildException( "iContract instrumentation failed. Code=" + result ); + throw new TaskException( "iContract instrumentation failed. Code=" + result ); } } @@ -835,7 +836,6 @@ public class IContract extends MatchingTask } } - /** * Creates the -m option based on the values of controlFile, pre, post and * invariant. @@ -890,34 +890,34 @@ public class IContract extends MatchingTask /** * Checks that the required attributes are set. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void preconditions() - throws BuildException + throws TaskException { 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 \"" + srcDir.getPath() + "\" does not exist!"); + throw new TaskException( "srcdir \"" + srcDir.getPath() + "\" does not exist!" ); } if( instrumentDir == null ) { - throw new BuildException( "instrumentdir attribute must be set!"); + throw new TaskException( "instrumentdir attribute must be set!" ); } if( repositoryDir == null ) { - throw new BuildException( "repositorydir attribute must be set!" ); + throw new TaskException( "repositorydir attribute must be set!" ); } if( updateIcontrol == true && classDir == null ) { - throw new BuildException( "classdir attribute must be specified when updateicontrol=true!" ); + throw new TaskException( "classdir attribute must be specified when updateicontrol=true!" ); } if( updateIcontrol == true && controlFile == null ) { - throw new BuildException( "controlfile attribute must be specified when updateicontrol=true!" ); + throw new TaskException( "controlfile attribute must be specified when updateicontrol=true!" ); } } @@ -929,10 +929,10 @@ public class IContract extends MatchingTask * Also creates a temporary file with a list of the source files, that will * be deleted upon exit. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void scan() - throws BuildException + throws TaskException { long now = ( new Date() ).getTime(); @@ -965,20 +965,20 @@ public class IContract extends MatchingTask } for( int i = 0; i < files.length; i++ ) { - File srcFile = new File( srcDir, files[i] ); - if( files[i].endsWith( ".java" ) ) + File srcFile = new File( srcDir, files[ i ] ); + if( files[ i ].endsWith( ".java" ) ) { // print the target, while we're at here. (Only if generatetarget=true). if( targetPrinter != null ) { targetPrinter.println( srcFile.getAbsolutePath() ); } - File classFile = new File( buildDir, files[i].substring( 0, files[i].indexOf( ".java" ) ) + ".class" ); + File classFile = new File( buildDir, files[ i ].substring( 0, files[ i ].indexOf( ".java" ) ) + ".class" ); if( srcFile.lastModified() > now ) { log( "Warning: file modified in the future: " + - files[i], Project.MSG_WARN ); + files[ i ], Project.MSG_WARN ); } if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() ) @@ -996,7 +996,7 @@ public class IContract extends MatchingTask } catch( IOException e ) { - throw new BuildException( "Could not create target file:" + e.getMessage() ); + throw new TaskException( "Could not create target file:" + e.getMessage() ); } // also, check controlFile timestamp @@ -1012,8 +1012,8 @@ public class IContract extends MatchingTask files = ds.getIncludedFiles(); for( int i = 0; i < files.length; i++ ) { - File srcFile = new File( srcDir, files[i] ); - if( files[i].endsWith( ".class" ) ) + File srcFile = new File( srcDir, files[ i ] ); + if( files[ i ].endsWith( ".class" ) ) { if( controlFileTime > srcFile.lastModified() ) { @@ -1031,7 +1031,7 @@ public class IContract extends MatchingTask } catch( Throwable t ) { - throw new BuildException( "Got an interesting exception:" + t.getMessage() ); + throw new TaskException( "Got an interesting exception:" + t.getMessage() ); } } @@ -1053,7 +1053,9 @@ public class IContract extends MatchingTask } // dummy implementation. Never called - public void setJavac( Javac javac ) { } + public void setJavac( Javac javac ) + { + } public boolean execute() { @@ -1082,9 +1084,13 @@ public class IContract extends MatchingTask */ private class IContractPresenceDetector implements BuildListener { - public void buildFinished( BuildEvent event ) { } + public void buildFinished( BuildEvent event ) + { + } - public void buildStarted( BuildEvent event ) { } + public void buildStarted( BuildEvent event ) + { + } public void messageLogged( BuildEvent event ) { @@ -1094,12 +1100,20 @@ public class IContract extends MatchingTask } } - public void targetFinished( BuildEvent event ) { } + public void targetFinished( BuildEvent event ) + { + } - public void targetStarted( BuildEvent event ) { } + public void targetStarted( BuildEvent event ) + { + } - public void taskFinished( BuildEvent event ) { } + public void taskFinished( BuildEvent event ) + { + } - public void taskStarted( BuildEvent event ) { } + public void taskStarted( BuildEvent event ) + { + } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java index cdd5faaaf..7d0f030f9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional; + import java.io.File; 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.ant.types.Commandline; @@ -229,32 +230,32 @@ public class Javah extends Task /** * 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( ( cls == null ) && ( classes.size() == 0 ) ) { - throw new BuildException( "class attribute must be set!" ); + throw new TaskException( "class attribute must be set!" ); } if( ( cls != null ) && ( classes.size() > 0 ) ) { - throw new BuildException( "set class attribute or class element, not both." ); + throw new TaskException( "set class attribute or class element, not both." ); } if( destDir != null ) { if( !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" ); } if( outputFile != null ) { - throw new BuildException( "destdir and outputFile are mutually exclusive"); + throw new TaskException( "destdir and outputFile are mutually exclusive" ); } } @@ -290,7 +291,7 @@ public class Javah extends Task { int n = 0; log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); StringBuffer niceClassList = new StringBuffer(); if( cls != null ) @@ -308,7 +309,7 @@ public class Javah extends Task Enumeration enum = classes.elements(); while( enum.hasMoreElements() ) { - ClassArgument arg = ( ClassArgument )enum.nextElement(); + ClassArgument arg = (ClassArgument)enum.nextElement(); String aClass = arg.getName(); cmd.createArgument().setValue( aClass ); niceClassList.append( " " + aClass + lSep ); @@ -381,7 +382,7 @@ public class Javah extends Task { if( !old ) { - throw new BuildException( "stubs only available in old mode." ); + throw new TaskException( "stubs only available in old mode." ); } cmd.createArgument().setValue( "-stubs" ); } @@ -402,11 +403,11 @@ public class Javah extends Task * Peforms a compile using the classic compiler that shipped with JDK 1.1 * and 1.2. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void doClassicCompile() - throws BuildException + throws TaskException { Commandline cmd = setupJavahCommand(); @@ -416,7 +417,7 @@ public class Javah extends Task * sun.tools.javac.Main compiler = * new sun.tools.javac.Main(new LogOutputStream(this, Project.MSG_WARN), "javac"); * if (!compiler.compile(cmd.getArguments())) { - * throw new BuildException("Compile failed"); + * throw new TaskException("Compile failed"); * } */ try @@ -429,20 +430,20 @@ public class Javah extends Task com.sun.tools.javah.Main main = new com.sun.tools.javah.Main( cmd.getArguments() ); main.run(); } - //catch (ClassNotFoundException ex) { - // throw new BuildException("Cannot use javah because it is not available"+ - // " A common solution is to set the environment variable"+ - // " JAVA_HOME to your jdk directory.", location); - //} + //catch (ClassNotFoundException ex) { + // throw new TaskException("Cannot use javah because it is not available"+ + // " A common solution is to set the environment variable"+ + // " JAVA_HOME to your jdk directory.", location); + //} catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting javah: ", ex ); + throw new TaskException( "Error starting javah: ", ex ); } } } @@ -451,7 +452,9 @@ public class Javah extends Task { private String name; - public ClassArgument() { } + public ClassArgument() + { + } public void setName( String name ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java index 29c3680f4..218859ac7 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -17,10 +18,9 @@ import java.util.Enumeration; import java.util.ListIterator; 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.Task; - /** * Task for creating a manifest file for a jar archiv. use:

  *   
@@ -86,10 +86,10 @@ public class ManifestFile extends Task
     /**
      * execute task
      *
-     * @exception BuildException : Failure in building
+     * @exception TaskException : Failure in building
      */
     public void execute()
-        throws BuildException
+        throws TaskException
     {
         checkParameters();
         if( isUpdate( currentMethod ) )
@@ -111,7 +111,6 @@ public class ManifestFile extends Task
         return method.equals( REPLACEALL_.toUpperCase() );
     }
 
-
     private boolean isUpdate( String method )
     {
         return method.equals( UPDATE_.toUpperCase() );
@@ -125,7 +124,6 @@ public class ManifestFile extends Task
         entry.addTo( container );
     }
 
-
     private StringBuffer buildBuffer()
     {
         StringBuffer buffer = new StringBuffer();
@@ -134,10 +132,10 @@ public class ManifestFile extends Task
 
         while( iterator.hasNext() )
         {
-            Entry entry = ( Entry )iterator.next();
+            Entry entry = (Entry)iterator.next();
 
-            String key = ( String )entry.getKey();
-            String value = ( String )entry.getValue();
+            String key = (String)entry.getKey();
+            String value = (String)entry.getValue();
             String entry_string = key + keyValueSeparator + value;
 
             buffer.append( entry_string + this.newLine );
@@ -157,33 +155,33 @@ public class ManifestFile extends Task
     }
 
     private void checkParameters()
-        throws BuildException
+        throws TaskException
     {
         if( !checkParam( manifestFile ) )
         {
-            throw new BuildException( "file token must not be null." );
+            throw new TaskException( "file token must not be null." );
         }
     }
 
     /**
      * adding entries to a container
      *
-     * @exception BuildException
+     * @exception TaskException
      */
     private void executeOperation()
-        throws BuildException
+        throws TaskException
     {
         Enumeration enum = entries.elements();
 
         while( enum.hasMoreElements() )
         {
-            Entry entry = ( Entry )enum.nextElement();
+            Entry entry = (Entry)enum.nextElement();
             entry.addTo( container );
         }
     }
 
     private void readFile()
-        throws BuildException
+        throws TaskException
     {
 
         if( manifestFile.exists() )
@@ -207,32 +205,31 @@ public class ManifestFile extends Task
                             stop = true;
                         }
                         else
-                            buffer.append( ( char )c );
+                            buffer.append( (char)c );
                     }
                     fis.close();
                     StringTokenizer lineTokens = getLineTokens( buffer );
                     while( lineTokens.hasMoreElements() )
                     {
-                        String currentLine = ( String )lineTokens.nextElement();
+                        String currentLine = (String)lineTokens.nextElement();
                         addLine( currentLine );
                     }
                 }
                 catch( FileNotFoundException fnfe )
                 {
-                    throw new BuildException( "File not found exception " + fnfe.toString() );
+                    throw new TaskException( "File not found exception " + fnfe.toString() );
                 }
                 catch( IOException ioe )
                 {
-                    throw new BuildException( "Unknown input/output exception " + ioe.toString() );
+                    throw new TaskException( "Unknown input/output exception " + ioe.toString() );
                 }
             }
         }
 
     }
 
-
     private void writeFile()
-        throws BuildException
+        throws TaskException
     {
         try
         {
@@ -248,7 +245,7 @@ public class ManifestFile extends Task
 
                 for( int i = 0; i < size; i++ )
                 {
-                    fos.write( ( char )buffer.charAt( i ) );
+                    fos.write( (char)buffer.charAt( i ) );
                 }
 
                 fos.flush();
@@ -256,13 +253,13 @@ public class ManifestFile extends Task
             }
             else
             {
-                throw new BuildException( "Can't create manifest file" );
+                throw new TaskException( "Can't create manifest file" );
             }
 
         }
         catch( IOException ioe )
         {
-            throw new BuildException( "An input/ouput error occured" + ioe.toString() );
+            throw new TaskException( "An input/ouput error occured" + ioe.toString() );
         }
     }
 
@@ -275,7 +272,9 @@ public class ManifestFile extends Task
         private String val = null;
         private String key = null;
 
-        public Entry() { }
+        public Entry()
+        {
+        }
 
         public void setValue( String value )
         {
@@ -298,8 +297,8 @@ public class ManifestFile extends Task
 
             try
             {
-                Entry e1 = ( Entry )o1;
-                Entry e2 = ( Entry )o2;
+                Entry e1 = (Entry)o1;
+                Entry e2 = (Entry)o2;
 
                 String key_1 = e1.getKey();
                 String key_2 = e2.getKey();
@@ -313,21 +312,19 @@ public class ManifestFile extends Task
             return result;
         }
 
-
         public boolean equals( Object obj )
         {
             Entry ent = new Entry();
             boolean result = false;
-            int res = ent.compare( this, ( Entry )obj );
+            int res = ent.compare( this, (Entry)obj );
             if( res == 0 )
                 result = true;
 
             return result;
         }
 
-
         protected void addTo( EntryContainer container )
-            throws BuildException
+            throws TaskException
         {
             checkFormat();
             split();
@@ -335,12 +332,12 @@ public class ManifestFile extends Task
         }
 
         private void checkFormat()
-            throws BuildException
+            throws TaskException
         {
 
             if( value == null )
             {
-                throw new BuildException( "no argument for value" );
+                throw new TaskException( "no argument for value" );
             }
 
             StringTokenizer st = new StringTokenizer( value, ManifestFile.keyValueSeparator );
@@ -348,15 +345,15 @@ public class ManifestFile extends Task
 
             if( size < 2 )
             {
-                throw new BuildException( "value has not the format of a manifest entry" );
+                throw new TaskException( "value has not the format of a manifest entry" );
             }
         }
 
         private void split()
         {
             StringTokenizer st = new StringTokenizer( value, ManifestFile.keyValueSeparator );
-            key = ( String )st.nextElement();
-            val = ( String )st.nextElement();
+            key = (String)st.nextElement();
+            val = (String)st.nextElement();
         }
 
     }
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
index 413aec28c..0e343ceec 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
@@ -6,8 +6,9 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
-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;
@@ -34,7 +35,6 @@ public class Native2Ascii extends MatchingTask
 
     private Mapper mapper;
 
-
     /**
      * Set the destination dirctory to place converted files into.
      *
@@ -93,21 +93,21 @@ public class Native2Ascii extends MatchingTask
      * 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( mapper != null )
         {
-            throw new BuildException( "Cannot define more than one mapper" );
+            throw new TaskException( "Cannot define more than one mapper" );
         }
         mapper = new Mapper( project );
         return mapper;
     }
 
     public void execute()
-        throws BuildException
+        throws TaskException
     {
 
         Commandline baseCmd = null;// the common portion of our cmd line
@@ -123,7 +123,7 @@ public class Native2Ascii extends MatchingTask
         // Require destDir
         if( destDir == null )
         {
-            throw new BuildException( "The dest attribute must be set." );
+            throw new TaskException( "The dest attribute must be set." );
         }
 
         // if src and dest dirs are the same, require the extension
@@ -131,8 +131,8 @@ public class Native2Ascii extends MatchingTask
         // include a file with the same extension, but ....
         if( srcDir.equals( destDir ) && extension == null && mapper == null )
         {
-            throw new BuildException( "The ext attribute or a mapper must be set if"
-                 + " src and dest dirs are the same." );
+            throw new TaskException( "The ext attribute or a mapper must be set if"
+                                     + " src and dest dirs are the same." );
         }
 
         FileNameMapper m = null;
@@ -162,11 +162,11 @@ public class Native2Ascii extends MatchingTask
             return;
         }
         String message = "Converting " + count + " file"
-             + ( count != 1 ? "s" : "" ) + " from ";
+            + ( count != 1 ? "s" : "" ) + " from ";
         log( message + srcDir + " to " + destDir );
         for( int i = 0; i < files.length; i++ )
         {
-            convert( files[i], m.mapFileName( files[i] )[0] );
+            convert( files[ i ], m.mapFileName( files[ i ] )[ 0 ] );
         }
     }
 
@@ -175,10 +175,10 @@ public class Native2Ascii extends MatchingTask
      *
      * @param srcName Description of Parameter
      * @param destName Description of Parameter
-     * @exception BuildException Description of Exception
+     * @exception TaskException Description of Exception
      */
     private void convert( String srcName, String destName )
-        throws BuildException
+        throws TaskException
     {
 
         Commandline cmd = new Commandline();// Command line to run
@@ -207,8 +207,8 @@ public class Native2Ascii extends MatchingTask
         // Make sure we're not about to clobber something
         if( srcFile.equals( destFile ) )
         {
-            throw new BuildException( "file " + srcFile
-                 + " would overwrite its self" );
+            throw new TaskException( "file " + srcFile
+                                     + " would overwrite its self" );
         }
 
         // Make intermediate directories if needed
@@ -220,26 +220,30 @@ public class Native2Ascii extends MatchingTask
 
             if( ( !parentFile.exists() ) && ( !parentFile.mkdirs() ) )
             {
-                throw new BuildException( "cannot create parent directory "
-                     + parentName );
+                throw new TaskException( "cannot create parent directory "
+                                         + parentName );
             }
         }
 
         log( "converting " + srcName, Project.MSG_VERBOSE );
         sun.tools.native2ascii.Main n2a
-             = new sun.tools.native2ascii.Main();
+            = new sun.tools.native2ascii.Main();
         if( !n2a.convert( cmd.getArguments() ) )
         {
-            throw new BuildException( "conversion failed" );
+            throw new TaskException( "conversion failed" );
         }
     }
 
     private class ExtMapper implements FileNameMapper
     {
 
-        public void setFrom( String s ) { }
+        public void setFrom( String s )
+        {
+        }
 
-        public void setTo( String s ) { }
+        public void setTo( String s )
+        {
+        }
 
         public String[] mapFileName( String fileName )
         {
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
index a33bd080b..f203cb0ea 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
@@ -6,6 +6,7 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -16,11 +17,11 @@ import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.Vector;
 import netrexx.lang.Rexx;
-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;
 import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Task to compile NetRexx source files. This task can take the following
@@ -113,7 +114,6 @@ public class NetRexxC extends MatchingTask
     private boolean time;
     private boolean utf8;
 
-
     /**
      * Set whether literals are treated as binary, rather than NetRexx types
      *
@@ -263,7 +263,6 @@ public class NetRexxC extends MatchingTask
         this.java = java;
     }
 
-
     /**
      * Sets whether the generated java source file should be kept after
      * compilation. The generated files will have an extension of .java.keep,
@@ -392,7 +391,6 @@ public class NetRexxC extends MatchingTask
         this.strictprops = strictprops;
     }
 
-
     /**
      * Whether the compiler should force catching of exceptions by explicitly
      * named types
@@ -438,15 +436,15 @@ public class NetRexxC extends MatchingTask
     public void setTrace( String trace )
     {
         if( trace.equalsIgnoreCase( "trace" )
-             || trace.equalsIgnoreCase( "trace1" )
-             || trace.equalsIgnoreCase( "trace2" )
-             || trace.equalsIgnoreCase( "notrace" ) )
+            || trace.equalsIgnoreCase( "trace1" )
+            || trace.equalsIgnoreCase( "trace2" )
+            || trace.equalsIgnoreCase( "notrace" ) )
         {
             this.trace = trace;
         }
         else
         {
-            throw new BuildException( "Unknown trace value specified: '" + trace + "'" );
+            throw new TaskException( "Unknown trace value specified: '" + trace + "'" );
         }
     }
 
@@ -475,16 +473,16 @@ public class NetRexxC extends MatchingTask
     /**
      * Executes the task, i.e. does the actual compiler call
      *
-     * @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 || destDir == null )
         {
-            throw new BuildException( "srcDir and destDir attributes must be set!" );
+            throw new TaskException( "srcDir and destDir attributes must be set!" );
         }
 
         // scan source and dest dirs to build up both copy lists and
@@ -515,6 +513,7 @@ public class NetRexxC extends MatchingTask
      * @return The CompileClasspath value
      */
     private String getCompileClasspath()
+        throws TaskException
     {
         StringBuffer classpath = new StringBuffer();
 
@@ -567,7 +566,7 @@ public class NetRexxC extends MatchingTask
         options.addElement( "-" + trace );
         options.addElement( utf8 ? "-utf8" : "-noutf8" );
         options.addElement( "-" + verbose );
-        String[] results = new String[options.size()];
+        String[] results = new String[ options.size() ];
         options.copyInto( results );
         return results;
     }
@@ -582,9 +581,10 @@ public class NetRexxC extends MatchingTask
      * @param source - source classpath to get file objects.
      */
     private void addExistingToClasspath( StringBuffer target, String source )
+        throws TaskException
     {
         StringTokenizer tok = new StringTokenizer( source,
-            System.getProperty( "path.separator" ), false );
+                                                   System.getProperty( "path.separator" ), false );
         while( tok.hasMoreTokens() )
         {
             File f = resolveFile( tok.nextToken() );
@@ -597,7 +597,7 @@ public class NetRexxC extends MatchingTask
             else
             {
                 log( "Dropping from classpath: " +
-                    f.getAbsolutePath(), Project.MSG_VERBOSE );
+                     f.getAbsolutePath(), Project.MSG_VERBOSE );
             }
         }
 
@@ -616,8 +616,8 @@ public class NetRexxC extends MatchingTask
             Enumeration enum = filecopyList.keys();
             while( enum.hasMoreElements() )
             {
-                String fromFile = ( String )enum.nextElement();
-                String toFile = ( String )filecopyList.get( fromFile );
+                String fromFile = (String)enum.nextElement();
+                String toFile = (String)filecopyList.get( fromFile );
                 try
                 {
                     FileUtils.newFileUtils().copyFile( fromFile, toFile );
@@ -625,8 +625,8 @@ public class NetRexxC extends MatchingTask
                 catch( IOException ioe )
                 {
                     String msg = "Failed to copy " + fromFile + " to " + toFile
-                         + " due to " + ioe.getMessage();
-                    throw new BuildException( msg, ioe );
+                        + " due to " + ioe.getMessage();
+                    throw new TaskException( msg, ioe );
                 }
             }
         }
@@ -635,10 +635,10 @@ public class NetRexxC extends MatchingTask
     /**
      * Peforms a copmile using the NetRexx 1.1.x compiler
      *
-     * @exception BuildException Description of Exception
+     * @exception TaskException Description of Exception
      */
     private void doNetRexxCompile()
-        throws BuildException
+        throws TaskException
     {
         log( "Using NetRexx compiler", Project.MSG_VERBOSE );
         String classpath = getCompileClasspath();
@@ -648,30 +648,30 @@ public class NetRexxC extends MatchingTask
         // create an array of strings for input to the compiler: one array
         // comes from the compile options, the other from the compileList
         String[] compileOptionsArray = getCompileOptionsAsArray();
-        String[] fileListArray = new String[compileList.size()];
+        String[] fileListArray = new String[ compileList.size() ];
         Enumeration e = compileList.elements();
         int j = 0;
         while( e.hasMoreElements() )
         {
-            fileListArray[j] = ( String )e.nextElement();
+            fileListArray[ j ] = (String)e.nextElement();
             j++;
         }
         // create a single array of arguments for the compiler
-        String compileArgs[] = new String[compileOptionsArray.length + fileListArray.length];
+        String compileArgs[] = new String[ compileOptionsArray.length + fileListArray.length ];
         for( int i = 0; i < compileOptionsArray.length; i++ )
         {
-            compileArgs[i] = compileOptionsArray[i];
+            compileArgs[ i ] = compileOptionsArray[ i ];
         }
         for( int i = 0; i < fileListArray.length; i++ )
         {
-            compileArgs[i + compileOptionsArray.length] = fileListArray[i];
+            compileArgs[ i + compileOptionsArray.length ] = fileListArray[ i ];
         }
 
         // print nice output about what we are doing for the log
         compileOptions.append( "Compilation args: " );
         for( int i = 0; i < compileOptionsArray.length; i++ )
         {
-            compileOptions.append( compileOptionsArray[i] );
+            compileOptions.append( compileOptionsArray[ i ] );
             compileOptions.append( " " );
         }
         log( compileOptions.toString(), Project.MSG_VERBOSE );
@@ -704,7 +704,7 @@ public class NetRexxC extends MatchingTask
             {// 1 is warnings from real NetRexxC
                 log( out.toString(), Project.MSG_ERR );
                 String msg = "Compile failed, messages should have been provided.";
-                throw new BuildException( msg );
+                throw new TaskException( msg );
             }
             else if( rc == 1 )
             {
@@ -736,9 +736,9 @@ public class NetRexxC extends MatchingTask
     {
         for( int i = 0; i < files.length; i++ )
         {
-            File srcFile = new File( srcDir, files[i] );
-            File destFile = new File( destDir, files[i] );
-            String filename = files[i];
+            File srcFile = new File( srcDir, files[ i ] );
+            File destFile = new File( destDir, files[ i ] );
+            String filename = files[ i ];
             // if it's a non source file, copy it if a later date than the
             // dest
             // if it's a source file, see if the destination class file
@@ -747,7 +747,7 @@ public class NetRexxC extends MatchingTask
             {
                 File classFile =
                     new File( destDir,
-                    filename.substring( 0, filename.lastIndexOf( '.' ) ) + ".class" );
+                              filename.substring( 0, filename.lastIndexOf( '.' ) ) + ".class" );
 
                 if( !compile || srcFile.lastModified() > classFile.lastModified() )
                 {
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
index c185769d7..61a8f6d3b 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
@@ -6,6 +6,7 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.File;
@@ -25,7 +26,7 @@ import java.util.Enumeration;
 import java.util.GregorianCalendar;
 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.Task;
 import org.apache.tools.ant.types.EnumeratedAttribute;
 
@@ -178,7 +179,7 @@ public class PropertyFile extends Task
      * Methods
      */
     public void execute()
-        throws BuildException
+        throws TaskException
     {
         checkParameters();
         readFile();
@@ -200,26 +201,26 @@ public class PropertyFile extends Task
     }
 
     private void checkParameters()
-        throws BuildException
+        throws TaskException
     {
         if( !checkParam( m_propertyfile ) )
         {
-            throw new BuildException( "file token must not be null." );
+            throw new TaskException( "file token must not be null." );
         }
     }
 
     private void executeOperation()
-        throws BuildException
+        throws TaskException
     {
-        for( Enumeration e = entries.elements(); e.hasMoreElements();  )
+        for( Enumeration e = entries.elements(); e.hasMoreElements(); )
         {
-            Entry entry = ( Entry )e.nextElement();
+            Entry entry = (Entry)e.nextElement();
             entry.executeOn( m_properties );
         }
     }
 
     private void readFile()
-        throws BuildException
+        throws TaskException
     {
         // Create the PropertyFile
         m_properties = new Properties();
@@ -246,7 +247,7 @@ public class PropertyFile extends Task
             else
             {
                 log( "Creating new property file: " +
-                    m_propertyfile.getAbsolutePath() );
+                     m_propertyfile.getAbsolutePath() );
                 FileOutputStream out = null;
                 try
                 {
@@ -264,12 +265,12 @@ public class PropertyFile extends Task
         }
         catch( IOException ioe )
         {
-            throw new BuildException( ioe.toString() );
+            throw new TaskException( ioe.toString() );
         }
     }
 
     private void writeFile()
-        throws BuildException
+        throws TaskException
     {
         BufferedOutputStream bos = null;
         try
@@ -279,10 +280,10 @@ public class PropertyFile extends Task
             // Properties.store is not available in JDK 1.1
             Method m =
                 Properties.class.getMethod( "store",
-                new Class[]{
-                OutputStream.class,
-                String.class}
-                 );
+                                            new Class[]{
+                                                OutputStream.class,
+                                                String.class}
+                );
             m.invoke( m_properties, new Object[]{bos, m_comment} );
 
         }
@@ -293,16 +294,16 @@ public class PropertyFile extends Task
         catch( InvocationTargetException ite )
         {
             Throwable t = ite.getTargetException();
-            throw new BuildException( "Error", t );
+            throw new TaskException( "Error", t );
         }
         catch( IllegalAccessException iae )
         {
             // impossible
-            throw new BuildException( "Error", iae );
+            throw new TaskException( "Error", iae );
         }
         catch( IOException ioe )
         {
-            throw new BuildException( "Error", ioe );
+            throw new TaskException( "Error", ioe );
         }
         finally
         {
@@ -313,7 +314,8 @@ public class PropertyFile extends Task
                     bos.close();
                 }
                 catch( IOException ioex )
-                {}
+                {
+                }
             }
         }
     }
@@ -385,7 +387,7 @@ public class PropertyFile extends Task
         }
 
         protected void executeOn( Properties props )
-            throws BuildException
+            throws TaskException
         {
             checkParameters();
 
@@ -394,19 +396,19 @@ public class PropertyFile extends Task
             {
                 if( m_type == Type.INTEGER_TYPE )
                 {
-                    executeInteger( ( String )props.get( m_key ) );
+                    executeInteger( (String)props.get( m_key ) );
                 }
                 else if( m_type == Type.DATE_TYPE )
                 {
-                    executeDate( ( String )props.get( m_key ) );
+                    executeDate( (String)props.get( m_key ) );
                 }
                 else if( m_type == Type.STRING_TYPE )
                 {
-                    executeString( ( String )props.get( m_key ) );
+                    executeString( (String)props.get( m_key ) );
                 }
                 else
                 {
-                    throw new BuildException( "Unknown operation type: " + m_type + "" );
+                    throw new TaskException( "Unknown operation type: " + m_type + "" );
                 }
             }
             catch( NullPointerException npe )
@@ -423,28 +425,28 @@ public class PropertyFile extends Task
         /**
          * Check if parameter combinations can be supported
          *
-         * @exception BuildException Description of Exception
+         * @exception TaskException Description of Exception
          */
         private void checkParameters()
-            throws BuildException
+            throws TaskException
         {
             if( m_type == Type.STRING_TYPE &&
                 m_operation == Operation.DECREMENT_OPER )
             {
-                throw new BuildException( "- is not suported for string properties (key:" + m_key + ")" );
+                throw new TaskException( "- is not suported for string properties (key:" + m_key + ")" );
             }
             if( m_value == null && m_default == null )
             {
-                throw new BuildException( "value and/or default must be specified (key:" + m_key + ")" );
+                throw new TaskException( "value and/or default must be specified (key:" + m_key + ")" );
             }
             if( m_key == null )
             {
-                throw new BuildException( "key is mandatory" );
+                throw new TaskException( "key is mandatory" );
             }
             if( m_type == Type.STRING_TYPE &&
                 m_pattern != null )
             {
-                throw new BuildException( "pattern is not suported for string properties (key:" + m_key + ")" );
+                throw new TaskException( "pattern is not suported for string properties (key:" + m_key + ")" );
             }
         }
 
@@ -454,10 +456,10 @@ public class PropertyFile extends Task
          * @param oldValue the current value read from the property file or
          *      null if the key was not contained in
          *      the property file.
-         * @exception BuildException Description of Exception
+         * @exception TaskException Description of Exception
          */
         private void executeDate( String oldValue )
-            throws BuildException
+            throws TaskException
         {
             GregorianCalendar value = new GregorianCalendar();
             GregorianCalendar newValue = new GregorianCalendar();
@@ -577,23 +579,22 @@ public class PropertyFile extends Task
             }
         }
 
-
         /**
          * Handle operations for type int.
          *
          * @param oldValue the current value read from the property file or
          *      null if the key was not contained in
          *      the property file.
-         * @exception BuildException Description of Exception
+         * @exception TaskException Description of Exception
          */
         private void executeInteger( String oldValue )
-            throws BuildException
+            throws TaskException
         {
             int value = 0;
             int newValue = 0;
 
             DecimalFormat fmt = ( m_pattern != null ) ? new DecimalFormat( m_pattern )
-                 : new DecimalFormat();
+                : new DecimalFormat();
 
             if( oldValue != null )
             {
@@ -674,10 +675,10 @@ public class PropertyFile extends Task
          * @param oldValue the current value read from the property file or
          *      null if the key was not contained in
          *      the property file.
-         * @exception BuildException Description of Exception
+         * @exception TaskException Description of Exception
          */
         private void executeString( String oldValue )
-            throws BuildException
+            throws TaskException
         {
             String value = "";
             String newValue = "";
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
index ece6ed56e..969c125ac 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
@@ -6,6 +6,7 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -14,9 +15,8 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.LineNumberReader;
 import java.io.PrintWriter;
-import java.util.Random;
 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;
@@ -117,18 +117,20 @@ public class ReplaceRegExp extends Task
     }
 
     public void setMatch( String match )
+        throws TaskException
     {
         if( regex != null )
-            throw new BuildException( "Only one regular expression is allowed" );
+            throw new TaskException( "Only one regular expression is allowed" );
 
         regex = new RegularExpression();
         regex.setPattern( match );
     }
 
     public void setReplace( String replace )
+        throws TaskException
     {
         if( subs != null )
-            throw new BuildException( "Only one substitution expression is allowed" );
+            throw new TaskException( "Only one substitution expression is allowed" );
 
         subs = new Substitution();
         subs.setExpression( replace );
@@ -140,33 +142,35 @@ public class ReplaceRegExp extends Task
     }
 
     public RegularExpression createRegularExpression()
+        throws TaskException
     {
         if( regex != null )
-            throw new BuildException( "Only one regular expression is allowed." );
+            throw new TaskException( "Only one regular expression is allowed." );
 
         regex = new RegularExpression();
         return regex;
     }
 
     public Substitution createSubstitution()
+        throws TaskException
     {
         if( subs != null )
-            throw new BuildException( "Only one substitution expression is allowed" );
+            throw new TaskException( "Only one substitution expression is allowed" );
 
         subs = new Substitution();
         return subs;
     }
 
     public void execute()
-        throws BuildException
+        throws TaskException
     {
         if( regex == null )
-            throw new BuildException( "No expression to match." );
+            throw new TaskException( "No expression to match." );
         if( subs == null )
-            throw new BuildException( "Nothing to replace expression with." );
+            throw new TaskException( "Nothing to replace expression with." );
 
         if( file != null && filesets.size() > 0 )
-            throw new BuildException( "You cannot supply the 'file' attribute and filesets at the same time." );
+            throw new TaskException( "You cannot supply the 'file' attribute and filesets at the same time." );
 
         int options = 0;
 
@@ -191,25 +195,25 @@ public class ReplaceRegExp extends Task
             catch( IOException e )
             {
                 log( "An error occurred processing file: '" + file.getAbsolutePath() + "': " + e.toString(),
-                    Project.MSG_ERR );
+                     Project.MSG_ERR );
             }
         }
         else if( file != null )
         {
             log( "The following file is missing: '" + file.getAbsolutePath() + "'",
-                Project.MSG_ERR );
+                 Project.MSG_ERR );
         }
 
         int sz = filesets.size();
         for( int i = 0; i < sz; i++ )
         {
-            FileSet fs = ( FileSet )( filesets.elementAt( i ) );
+            FileSet fs = (FileSet)( filesets.elementAt( i ) );
             DirectoryScanner ds = fs.getDirectoryScanner( getProject() );
 
             String files[] = ds.getIncludedFiles();
             for( int j = 0; j < files.length; j++ )
             {
-                File f = new File( files[j] );
+                File f = new File( files[ j ] );
                 if( f.exists() )
                 {
                     try
@@ -219,19 +223,18 @@ public class ReplaceRegExp extends Task
                     catch( Exception e )
                     {
                         log( "An error occurred processing file: '" + f.getAbsolutePath() + "': " + e.toString(),
-                            Project.MSG_ERR );
+                             Project.MSG_ERR );
                     }
                 }
                 else
                 {
                     log( "The following file is missing: '" + file.getAbsolutePath() + "'",
-                        Project.MSG_ERR );
+                         Project.MSG_ERR );
                 }
             }
         }
     }
 
-
     protected String doReplace( RegularExpression r,
                                 Substitution s,
                                 String input,
@@ -276,11 +279,11 @@ public class ReplaceRegExp extends Task
             boolean changes = false;
 
             log( "Replacing pattern '" + regex.getPattern( project ) + "' with '" + subs.getExpression( project ) +
-                "' in '" + f.getPath() + "'" +
-                ( byline ? " by line" : "" ) +
-                ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) +
-                ".",
-                Project.MSG_WARN );
+                 "' in '" + f.getPath() + "'" +
+                 ( byline ? " by line" : "" ) +
+                 ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) +
+                 ".",
+                 Project.MSG_WARN );
 
             if( byline )
             {
@@ -299,8 +302,8 @@ public class ReplaceRegExp extends Task
             }
             else
             {
-                int flen = ( int )( f.length() );
-                char tmpBuf[] = new char[flen];
+                int flen = (int)( f.length() );
+                char tmpBuf[] = new char[ flen ];
                 int numread = 0;
                 int totread = 0;
                 while( numread != -1 && totread < flen )
@@ -342,7 +345,8 @@ public class ReplaceRegExp extends Task
                     r.close();
             }
             catch( Exception e )
-            {}
+            {
+            }
             ;
 
             try
@@ -351,7 +355,8 @@ public class ReplaceRegExp extends Task
                     r.close();
             }
             catch( Exception e )
-            {}
+            {
+            }
             ;
         }
     }
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
index a681c349f..0496befd0 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
@@ -6,13 +6,14 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
-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.taskdefs.Execute;
@@ -102,7 +103,7 @@ public class Rpm extends Task
     {
         if( ( sf == null ) || ( sf.trim().equals( "" ) ) )
         {
-            throw new BuildException( "You must specify a spec file" );
+            throw new TaskException( "You must specify a spec file" );
         }
         this.specFile = sf;
     }
@@ -113,7 +114,7 @@ public class Rpm extends Task
     }
 
     public void execute()
-        throws BuildException
+        throws TaskException
     {
 
         Commandline toExecute = new Commandline();
@@ -148,7 +149,7 @@ public class Rpm extends Task
         if( error == null && output == null )
         {
             streamhandler = new LogStreamHandler( this, Project.MSG_INFO,
-                Project.MSG_WARN );
+                                                  Project.MSG_WARN );
         }
         else
         {
@@ -160,7 +161,7 @@ public class Rpm extends Task
                 }
                 catch( IOException e )
                 {
-                    throw new BuildException( "Error", e );
+                    throw new TaskException( "Error", e );
                 }
             }
             else
@@ -175,7 +176,7 @@ public class Rpm extends Task
                 }
                 catch( IOException e )
                 {
-                    throw new BuildException( "Error", e );
+                    throw new TaskException( "Error", e );
                 }
             }
             else
@@ -200,7 +201,7 @@ public class Rpm extends Task
         }
         catch( IOException e )
         {
-            throw new BuildException( "Error", e );
+            throw new TaskException( "Error", e );
         }
         finally
         {
@@ -211,7 +212,8 @@ public class Rpm extends Task
                     outputstream.close();
                 }
                 catch( IOException e )
-                {}
+                {
+                }
             }
             if( error != null )
             {
@@ -220,7 +222,8 @@ public class Rpm extends Task
                     errorstream.close();
                 }
                 catch( IOException e )
-                {}
+                {
+                }
             }
         }
     }
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Script.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Script.java
index 294ea0ba8..76bdf4376 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Script.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Script.java
@@ -6,6 +6,7 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import com.ibm.bsf.BSFException;
 import com.ibm.bsf.BSFManager;
 import java.io.File;
@@ -13,7 +14,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Hashtable;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
 import org.apache.tools.ant.Task;
 
 /**
@@ -46,10 +47,10 @@ public class Script extends Task
     {
         File file = new File( fileName );
         if( !file.exists() )
-            throw new BuildException( "file " + fileName + " not found." );
+            throw new TaskException( "file " + fileName + " not found." );
 
-        int count = ( int )file.length();
-        byte data[] = new byte[count];
+        int count = (int)file.length();
+        byte data[] = new byte[ count ];
 
         try
         {
@@ -59,7 +60,7 @@ public class Script extends Task
         }
         catch( IOException e )
         {
-            throw new BuildException( "Error", e );
+            throw new TaskException( "Error", e );
         }
 
         script += new String( data );
@@ -78,10 +79,10 @@ public class Script extends Task
     /**
      * Do 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
     {
         try
         {
@@ -96,9 +97,9 @@ public class Script extends Task
 
             BSFManager manager = new BSFManager();
 
-            for( Enumeration e = beans.keys(); e.hasMoreElements();  )
+            for( Enumeration e = beans.keys(); e.hasMoreElements(); )
             {
-                String key = ( String )e.nextElement();
+                String key = (String)e.nextElement();
                 Object value = beans.get( key );
                 manager.declareBean( key, value, value.getClass() );
             }
@@ -112,16 +113,16 @@ public class Script extends Task
             Throwable te = be.getTargetException();
             if( te != null )
             {
-                if( te instanceof BuildException )
+                if( te instanceof TaskException )
                 {
-                    throw ( BuildException )te;
+                    throw (TaskException)te;
                 }
                 else
                 {
                     t = te;
                 }
             }
-            throw new BuildException( "Error", t );
+            throw new TaskException( "Error", t );
         }
     }
 
@@ -132,9 +133,9 @@ public class Script extends Task
      */
     private void addBeans( Hashtable dictionary )
     {
-        for( Enumeration e = dictionary.keys(); e.hasMoreElements();  )
+        for( Enumeration e = dictionary.keys(); e.hasMoreElements(); )
         {
-            String key = ( String )e.nextElement();
+            String key = (String)e.nextElement();
 
             boolean isValid = key.length() > 0 &&
                 Character.isJavaIdentifierStart( key.charAt( 0 ) );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/StyleBook.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/StyleBook.java
index 0f37fc687..3ece9cc52 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/StyleBook.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/StyleBook.java
@@ -6,8 +6,9 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
 import org.apache.tools.ant.taskdefs.Java;
 
 /**
@@ -18,7 +19,7 @@ import org.apache.tools.ant.taskdefs.Java;
  *      Börger
  */
 public class StyleBook
-     extends Java
+    extends Java
 {
     protected File m_book;
     protected String m_loaderConfig;
@@ -53,22 +54,22 @@ public class StyleBook
     }
 
     public void execute()
-        throws BuildException
+        throws TaskException
     {
 
         if( null == m_targetDirectory )
         {
-            throw new BuildException( "TargetDirectory attribute not set." );
+            throw new TaskException( "TargetDirectory attribute not set." );
         }
 
         if( null == m_skinDirectory )
         {
-            throw new BuildException( "SkinDirectory attribute not set." );
+            throw new TaskException( "SkinDirectory attribute not set." );
         }
 
         if( null == m_book )
         {
-            throw new BuildException( "book attribute not set." );
+            throw new TaskException( "book attribute not set." );
         }
 
         createArg().setValue( "targetDirectory=" + m_targetDirectory );
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
index e608bfcd2..ddcbdc34f 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
@@ -6,13 +6,13 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Source;
 import javax.xml.transform.Templates;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
@@ -73,7 +73,7 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
         transformer.setOutputProperty( OutputKeys.METHOD, type );
     }
 
-//------------------- IMPORTANT
+    //------------------- IMPORTANT
     // 1) Don't use the StreamSource(File) ctor. It won't work with
     // xalan prior to 2.2 because of systemid bugs.
 
@@ -141,7 +141,8 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
             try
             {
                 if( fis != null )
@@ -150,7 +151,8 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
             try
             {
                 if( fos != null )
@@ -159,7 +161,8 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
         }
     }
 
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
index 3798629fc..beab0e881 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
@@ -6,11 +6,12 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
 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.ant.taskdefs.XSLTLiaison;
 import org.apache.xalan.xslt.XSLTInputSource;
 import org.apache.xalan.xslt.XSLTProcessor;
@@ -39,7 +40,7 @@ public class XalanLiaison implements XSLTLiaison
         throws Exception
     {
         if( !type.equals( "xml" ) )
-            throw new BuildException( "Unsupported output type: " + type );
+            throw new TaskException( "Unsupported output type: " + type );
     }
 
     public void setStylesheet( File stylesheet )
@@ -86,7 +87,8 @@ public class XalanLiaison implements XSLTLiaison
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
             try
             {
                 if( fis != null )
@@ -95,7 +97,8 @@ public class XalanLiaison implements XSLTLiaison
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
             try
             {
                 if( fos != null )
@@ -104,7 +107,8 @@ public class XalanLiaison implements XSLTLiaison
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
         }
     }
 }//-- XalanLiaison
diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
index 3105ead43..5aa07739f 100644
--- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
+++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
@@ -6,8 +6,9 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional.ccm;
+
 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.types.Commandline;
 
@@ -88,7 +89,6 @@ public class CCMCheck extends Continuus
         return _file;
     }
 
-
     /**
      * Get the value of task.
      *
@@ -99,17 +99,16 @@ public class CCMCheck extends Continuus
         return _task;
     }
 
-
     /**
      * Executes the task. 

* * Builds a command line to execute ccm and then calls Exec's run method to * execute the command line.

* - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -127,11 +126,10 @@ public class CCMCheck extends Continuus if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java index ed7d1d1f1..5d4112f95 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ccm; + import java.util.Date; /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java index 35f9391e7..0ec54a977 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java @@ -6,17 +6,17 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ccm; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.types.Commandline; - /** * Task allows to create new ccm task and set it as the default * @@ -108,7 +108,9 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler * @exception IOException Description of Exception */ public void setProcessInputStream( OutputStream param1 ) - throws IOException { } + throws IOException + { + } /** * read the output stream to retrieve the new task number. @@ -138,12 +140,12 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { log( "error procession stream , null pointer exception", Project.MSG_ERR ); npe.printStackTrace(); - throw new BuildException( npe.getClass().getName() ); + throw new TaskException( npe.getClass().getName() ); }// end of catch catch( Exception e ) { log( "error procession stream " + e.getMessage(), Project.MSG_ERR ); - throw new BuildException( e.getMessage() ); + throw new TaskException( e.getMessage() ); }// end of try-catch } @@ -188,7 +190,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler this.task = v; } - /** * Get the value of comment. * @@ -199,7 +200,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return comment; } - /** * Get the value of platform. * @@ -210,7 +210,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return platform; } - /** * Get the value of release. * @@ -221,7 +220,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return release; } - /** * Get the value of resolver. * @@ -242,7 +240,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return subSystem; } - /** * Get the value of task. * @@ -253,17 +250,16 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return task; } - /** * Executes the task.

* * Builds a command line to execute ccm and then calls Exec's run method to * execute the command line.

* - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -280,7 +276,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } //create task ok, set this task as the default one @@ -295,7 +291,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler if( result != 0 ) { String msg = "Failed executing: " + commandLine2.toString(); - throw new BuildException( msg); + throw new TaskException( msg ); } } @@ -307,12 +303,15 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler * @exception IOException Description of Exception */ public void start() - throws IOException { } + throws IOException + { + } /** */ - public void stop() { } - + public void stop() + { + } /** * Check the command line options. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java index 388599fba..f5d12753c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java @@ -6,11 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ccm; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - /** * Task allows to reconfigure a project, recurcively or not * @@ -84,7 +84,6 @@ public class CCMReconfigure extends Continuus return project; } - /** * Get the value of recurse. * @@ -95,7 +94,6 @@ public class CCMReconfigure extends Continuus return recurse; } - /** * Get the value of verbose. * @@ -106,17 +104,16 @@ public class CCMReconfigure extends Continuus return verbose; } - /** * Executes the task.

* * Builds a command line to execute ccm and then calls Exec's run method to * execute the command line.

* - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -133,11 +130,10 @@ public class CCMReconfigure extends Continuus if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java index ad7cdb5b5..654b19ad9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ccm; -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.taskdefs.Execute; @@ -14,7 +15,6 @@ import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; - /** * A base class for creating tasks for executing commands on Continuus 5.1

* @@ -58,7 +58,6 @@ public abstract class Continuus extends Task private String _ccmDir = ""; private String _ccmAction = ""; - /** * Set the directory where the ccm executable is located * @@ -107,7 +106,6 @@ public abstract class Continuus extends Task return toReturn; } - protected int run( Commandline cmd, ExecuteStreamHandler handler ) { try @@ -120,7 +118,7 @@ public abstract class Continuus extends Task } catch( java.io.IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java index 891d53a45..969ea23d8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java @@ -6,12 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - - /** * Task to perform Checkin command to ClearCase.

* @@ -194,7 +193,6 @@ public class CCCheckin extends ClearCase private boolean m_Keep = false; private boolean m_Identical = true; - /** * Set comment string * @@ -321,10 +319,10 @@ public class CCCheckin extends ClearCase * Builds a command line to execute cleartool and then calls Exec's run * method to execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -348,11 +346,10 @@ public class CCCheckin extends ClearCase if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } - /** * Get the 'comment' command * @@ -393,7 +390,6 @@ public class CCCheckin extends ClearCase } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java index 123c1d040..a3977bba6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java @@ -6,12 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - - /** * Task to perform Checkout command to ClearCase.

* @@ -408,10 +407,10 @@ public class CCCheckout extends ClearCase * Builds a command line to execute cleartool and then calls Exec's run * method to execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -435,7 +434,7 @@ public class CCCheckout extends ClearCase if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -459,7 +458,6 @@ public class CCCheckout extends ClearCase } } - /** * Get the 'comment' command * @@ -520,7 +518,6 @@ public class CCCheckout extends ClearCase } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java index 96b994bc4..693bd5975 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java @@ -6,12 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - - /** * Task to perform UnCheckout command to ClearCase.

* @@ -112,10 +111,10 @@ public class CCUnCheckout extends ClearCase * Builds a command line to execute cleartool and then calls Exec's run * method to execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -139,11 +138,10 @@ public class CCUnCheckout extends ClearCase if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java index 9d9e5f1de..3cdb5f7e9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java @@ -6,12 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - - /** * Task to perform an Update command to ClearCase.

* @@ -321,10 +320,10 @@ public class CCUpdate extends ClearCase * Builds a command line to execute cleartool and then calls Exec's run * method to execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -352,7 +351,7 @@ public class CCUpdate extends ClearCase if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java index 9f003d69f..941519ab8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java @@ -6,14 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -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.taskdefs.Execute; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; - /** * A base class for creating tasks for executing commands on ClearCase.

* @@ -102,7 +102,6 @@ public abstract class ClearCase extends Task return toReturn; } - protected int run( Commandline cmd ) { try @@ -116,7 +115,7 @@ public abstract class ClearCase extends Task } catch( java.io.IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java index f0479ae8c..aa239a0e1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend; + import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; @@ -40,7 +41,6 @@ public class ClassFile */ private ConstantPool constantPool; - /** * Get the classes which this class references. * @@ -57,7 +57,7 @@ public class ClassFile if( entry != null && entry.getTag() == ConstantPoolEntry.CONSTANT_Class ) { - ClassCPInfo classEntry = ( ClassCPInfo )entry; + ClassCPInfo classEntry = (ClassCPInfo)entry; if( !classEntry.getClassName().equals( className ) ) { @@ -112,7 +112,7 @@ public class ClassFile int accessFlags = classStream.readUnsignedShort(); int thisClassIndex = classStream.readUnsignedShort(); int superClassIndex = classStream.readUnsignedShort(); - className = ( ( ClassCPInfo )constantPool.getEntry( thisClassIndex ) ).getClassName(); + className = ( (ClassCPInfo)constantPool.getEntry( thisClassIndex ) ).getClassName(); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java index de4ad9499..2dfd222af 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.taskdefs.optional.depend; - public interface ClassFileIterator { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java index e003411d4..174481fa1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -101,7 +102,7 @@ public class DirectoryIterator implements ClassFileIterator { if( currentEnum.hasMoreElements() ) { - File element = ( File )currentEnum.nextElement(); + File element = (File)currentEnum.nextElement(); if( element.isDirectory() ) { @@ -141,7 +142,7 @@ public class DirectoryIterator implements ClassFileIterator } else { - currentEnum = ( Enumeration )enumStack.pop(); + currentEnum = (Enumeration)enumStack.pop(); } } } @@ -174,7 +175,7 @@ public class DirectoryIterator implements ClassFileIterator for( int i = 0; i < length; ++i ) { - files.addElement( new File( directory, filesInDir[i] ) ); + files.addElement( new File( directory, filesInDir[ i ] ) ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java index 1715255bf..cb831d9dc 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -78,7 +79,7 @@ public class JarFileIterator implements ClassFileIterator private byte[] getEntryBytes( InputStream stream ) throws IOException { - byte[] buffer = new byte[8192]; + byte[] buffer = new byte[ 8192 ]; ByteArrayOutputStream baos = new ByteArrayOutputStream( 2048 ); int n; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java index 919486a22..209c200d1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * The constant pool entry which stores class information. * @@ -70,7 +70,7 @@ public class ClassCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - className = ( ( Utf8CPInfo )constantPool.getEntry( index ) ).getValue(); + className = ( (Utf8CPInfo)constantPool.getEntry( index ) ).getValue(); super.resolve( constantPool ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java index f8ba55828..305677313 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; - /** * A Constant Pool entry which represents a constant value. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java index ee3131ec3..ab9f2023b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; import java.util.Enumeration; @@ -67,7 +68,7 @@ public class ConstantPool if( element instanceof ClassCPInfo ) { - ClassCPInfo classinfo = ( ClassCPInfo )element; + ClassCPInfo classinfo = (ClassCPInfo)element; if( classinfo.getClassName().equals( className ) ) { @@ -96,7 +97,7 @@ public class ConstantPool if( element instanceof ConstantCPInfo ) { - ConstantCPInfo constantEntry = ( ConstantCPInfo )element; + ConstantCPInfo constantEntry = (ConstantCPInfo)element; if( constantEntry.getValue().equals( constantValue ) ) { @@ -108,7 +109,6 @@ public class ConstantPool return index; } - /** * Get an constant pool entry at a particular index. * @@ -117,7 +117,7 @@ public class ConstantPool */ public ConstantPoolEntry getEntry( int index ) { - return ( ConstantPoolEntry )entries.elementAt( index ); + return (ConstantPoolEntry)entries.elementAt( index ); } /** @@ -140,10 +140,10 @@ public class ConstantPool if( element instanceof FieldRefCPInfo ) { - FieldRefCPInfo fieldRefEntry = ( FieldRefCPInfo )element; + FieldRefCPInfo fieldRefEntry = (FieldRefCPInfo)element; if( fieldRefEntry.getFieldClassName().equals( fieldClassName ) && fieldRefEntry.getFieldName().equals( fieldName ) - && fieldRefEntry.getFieldType().equals( fieldType ) ) + && fieldRefEntry.getFieldType().equals( fieldType ) ) { index = i; } @@ -175,11 +175,11 @@ public class ConstantPool if( element instanceof InterfaceMethodRefCPInfo ) { - InterfaceMethodRefCPInfo interfaceMethodRefEntry = ( InterfaceMethodRefCPInfo )element; + InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo)element; if( interfaceMethodRefEntry.getInterfaceMethodClassName().equals( interfaceMethodClassName ) - && interfaceMethodRefEntry.getInterfaceMethodName().equals( interfaceMethodName ) - && interfaceMethodRefEntry.getInterfaceMethodType().equals( interfaceMethodType ) ) + && interfaceMethodRefEntry.getInterfaceMethodName().equals( interfaceMethodName ) + && interfaceMethodRefEntry.getInterfaceMethodType().equals( interfaceMethodType ) ) { index = i; } @@ -209,10 +209,10 @@ public class ConstantPool if( element instanceof MethodRefCPInfo ) { - MethodRefCPInfo methodRefEntry = ( MethodRefCPInfo )element; + MethodRefCPInfo methodRefEntry = (MethodRefCPInfo)element; if( methodRefEntry.getMethodClassName().equals( methodClassName ) - && methodRefEntry.getMethodName().equals( methodName ) && methodRefEntry.getMethodType().equals( methodType ) ) + && methodRefEntry.getMethodName().equals( methodName ) && methodRefEntry.getMethodType().equals( methodType ) ) { index = i; } @@ -240,7 +240,7 @@ public class ConstantPool if( element instanceof NameAndTypeCPInfo ) { - NameAndTypeCPInfo nameAndTypeEntry = ( NameAndTypeCPInfo )element; + NameAndTypeCPInfo nameAndTypeEntry = (NameAndTypeCPInfo)element; if( nameAndTypeEntry.getName().equals( name ) && nameAndTypeEntry.getType().equals( type ) ) { @@ -262,7 +262,7 @@ public class ConstantPool public int getUTF8Entry( String value ) { int index = -1; - Integer indexInteger = ( Integer )utf8Indexes.get( value ); + Integer indexInteger = (Integer)utf8Indexes.get( value ); if( indexInteger != null ) { @@ -294,7 +294,7 @@ public class ConstantPool if( entry instanceof Utf8CPInfo ) { - Utf8CPInfo utf8Info = ( Utf8CPInfo )entry; + Utf8CPInfo utf8Info = (Utf8CPInfo)entry; utf8Indexes.put( utf8Info.getValue(), new Integer( index ) ); } @@ -314,7 +314,7 @@ public class ConstantPool { int numEntries = classStream.readUnsignedShort(); - for( int i = 1; i < numEntries; ) + for( int i = 1; i < numEntries; ) { ConstantPoolEntry nextEntry = ConstantPoolEntry.readEntry( classStream ); @@ -331,9 +331,9 @@ public class ConstantPool */ public void resolve() { - for( Enumeration i = entries.elements(); i.hasMoreElements(); ) + for( Enumeration i = entries.elements(); i.hasMoreElements(); ) { - ConstantPoolEntry poolInfo = ( ConstantPoolEntry )i.nextElement(); + ConstantPoolEntry poolInfo = (ConstantPoolEntry)i.nextElement(); if( poolInfo != null && !poolInfo.isResolved() ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java index 7e1a89c31..5ab7c7d90 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * An entry in the constant pool. This class contains a represenation of the * constant pool entries. It is an abstract base class for all the different @@ -126,55 +126,55 @@ public abstract class ConstantPoolEntry ConstantPoolEntry cpInfo = null; int cpTag = cpStream.readUnsignedByte(); - switch ( cpTag ) + switch( cpTag ) { - case CONSTANT_Utf8: - cpInfo = new Utf8CPInfo(); + case CONSTANT_Utf8: + cpInfo = new Utf8CPInfo(); - break; - case CONSTANT_Integer: - cpInfo = new IntegerCPInfo(); + break; + case CONSTANT_Integer: + cpInfo = new IntegerCPInfo(); - break; - case CONSTANT_Float: - cpInfo = new FloatCPInfo(); + break; + case CONSTANT_Float: + cpInfo = new FloatCPInfo(); - break; - case CONSTANT_Long: - cpInfo = new LongCPInfo(); + break; + case CONSTANT_Long: + cpInfo = new LongCPInfo(); - break; - case CONSTANT_Double: - cpInfo = new DoubleCPInfo(); + break; + case CONSTANT_Double: + cpInfo = new DoubleCPInfo(); - break; - case CONSTANT_Class: - cpInfo = new ClassCPInfo(); + break; + case CONSTANT_Class: + cpInfo = new ClassCPInfo(); - break; - case CONSTANT_String: - cpInfo = new StringCPInfo(); + break; + case CONSTANT_String: + cpInfo = new StringCPInfo(); - break; - case CONSTANT_FieldRef: - cpInfo = new FieldRefCPInfo(); + break; + case CONSTANT_FieldRef: + cpInfo = new FieldRefCPInfo(); - break; - case CONSTANT_MethodRef: - cpInfo = new MethodRefCPInfo(); + break; + case CONSTANT_MethodRef: + cpInfo = new MethodRefCPInfo(); - break; - case CONSTANT_InterfaceMethodRef: - cpInfo = new InterfaceMethodRefCPInfo(); + break; + case CONSTANT_InterfaceMethodRef: + cpInfo = new InterfaceMethodRefCPInfo(); - break; - case CONSTANT_NameAndType: - cpInfo = new NameAndTypeCPInfo(); + break; + case CONSTANT_NameAndType: + cpInfo = new NameAndTypeCPInfo(); - break; - default: - throw new ClassFormatError( "Invalid Constant Pool entry Type " + cpTag ); + break; + default: + throw new ClassFormatError( "Invalid Constant Pool entry Type " + cpTag ); } cpInfo.read( cpStream ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java index 94122a060..b649e3073 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * The constant pool entry subclass used to represent double constant values. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java index bf56aee85..e4d400fe0 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A FieldRef CP Info * @@ -70,13 +70,13 @@ public class FieldRefCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - ClassCPInfo fieldClass = ( ClassCPInfo )constantPool.getEntry( classIndex ); + ClassCPInfo fieldClass = (ClassCPInfo)constantPool.getEntry( classIndex ); fieldClass.resolve( constantPool ); fieldClassName = fieldClass.getClassName(); - NameAndTypeCPInfo nt = ( NameAndTypeCPInfo )constantPool.getEntry( nameAndTypeIndex ); + NameAndTypeCPInfo nt = (NameAndTypeCPInfo)constantPool.getEntry( nameAndTypeIndex ); nt.resolve( constantPool ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java index affdeefc1..d4778e697 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java index ce7acbc52..5dd108a68 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java index bc2077fed..81acfb7f3 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A InterfaceMethodRef CP Info * @@ -70,13 +70,13 @@ public class InterfaceMethodRefCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - ClassCPInfo interfaceMethodClass = ( ClassCPInfo )constantPool.getEntry( classIndex ); + ClassCPInfo interfaceMethodClass = (ClassCPInfo)constantPool.getEntry( classIndex ); interfaceMethodClass.resolve( constantPool ); interfaceMethodClassName = interfaceMethodClass.getClassName(); - NameAndTypeCPInfo nt = ( NameAndTypeCPInfo )constantPool.getEntry( nameAndTypeIndex ); + NameAndTypeCPInfo nt = (NameAndTypeCPInfo)constantPool.getEntry( nameAndTypeIndex ); nt.resolve( constantPool ); @@ -98,7 +98,7 @@ public class InterfaceMethodRefCPInfo extends ConstantPoolEntry if( isResolved() ) { value = "InterfaceMethod : Class = " + interfaceMethodClassName + ", name = " + interfaceMethodName + ", type = " - + interfaceMethodType; + + interfaceMethodType; } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java index 12f981faf..8c3a97c30 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java index a284adcf9..4c85ddb75 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A MethodRef CP Info * @@ -70,13 +70,13 @@ public class MethodRefCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - ClassCPInfo methodClass = ( ClassCPInfo )constantPool.getEntry( classIndex ); + ClassCPInfo methodClass = (ClassCPInfo)constantPool.getEntry( classIndex ); methodClass.resolve( constantPool ); methodClassName = methodClass.getClassName(); - NameAndTypeCPInfo nt = ( NameAndTypeCPInfo )constantPool.getEntry( nameAndTypeIndex ); + NameAndTypeCPInfo nt = (NameAndTypeCPInfo)constantPool.getEntry( nameAndTypeIndex ); nt.resolve( constantPool ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java index 8b769629b..e5a5d9f56 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A NameAndType CP Info * @@ -65,8 +65,8 @@ public class NameAndTypeCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - name = ( ( Utf8CPInfo )constantPool.getEntry( nameIndex ) ).getValue(); - type = ( ( Utf8CPInfo )constantPool.getEntry( descriptorIndex ) ).getValue(); + name = ( (Utf8CPInfo)constantPool.getEntry( nameIndex ) ).getValue(); + type = ( (Utf8CPInfo)constantPool.getEntry( descriptorIndex ) ).getValue(); super.resolve( constantPool ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java index f65ad291b..9f50ec681 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A String Constant Pool Entry. The String info contains an index into the * constant pool where a UTF8 string is stored. @@ -54,7 +54,7 @@ public class StringCPInfo extends ConstantCPInfo */ public void resolve( ConstantPool constantPool ) { - setValue( ( ( Utf8CPInfo )constantPool.getEntry( index ) ).getValue() ); + setValue( ( (Utf8CPInfo)constantPool.getEntry( index ) ).getValue() ); super.resolve( constantPool ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java index dc42d1984..203f5807c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A UTF8 Constant Pool Entry. * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java index fabadd12b..305d521ab 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java @@ -6,15 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.dotnet; -import java.io.File;// ==================================================================== -// imports -// ==================================================================== -import org.apache.tools.ant.BuildException; + +import java.io.File; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.types.Path; - // ==================================================================== + /** * This task compiles CSharp source into executables or modules. The task will * only work on win2K until other platforms support csc.exe or an equivalent. @@ -95,7 +94,7 @@ import org.apache.tools.ant.types.Path; */ public class CSharp - extends org.apache.tools.ant.taskdefs.MatchingTask + extends org.apache.tools.ant.taskdefs.MatchingTask { /** @@ -449,11 +448,11 @@ public class CSharp * define the target * * @param targetType The new TargetType value - * @exception BuildException if target is not one of + * @exception TaskException if target is not one of * exe|library|module|winexe */ public void setTargetType( String targetType ) - throws BuildException + throws TaskException { targetType = targetType.toLowerCase(); if( targetType.equals( "exe" ) || targetType.equals( "library" ) || @@ -462,7 +461,7 @@ public class CSharp _targetType = targetType; } else - throw new BuildException( "targetType " + targetType + " is not a valid type" ); + throw new TaskException( "targetType " + targetType + " is not a valid type" ); } /** @@ -643,10 +642,10 @@ public class CSharp /** * do the work by building the command line and then calling it * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { if( _srcDir == null ) _srcDir = resolveFile( "." ); @@ -686,7 +685,7 @@ public class CSharp //add to the command for( int i = 0; i < dependencies.length; i++ ) { - String targetFile = dependencies[i]; + String targetFile = dependencies[ i ]; targetFile = baseDir + File.separator + targetFile; command.addArgument( targetFile ); } @@ -723,7 +722,6 @@ public class CSharp return "/debug" + ( _debug ? "+" : "-" ); } - /** * get default reference list * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java index c5e94ca64..1625cd28d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java @@ -5,15 +5,13 @@ * version 1.1, a copy of which has been included with this distribution in * the LICENSE file. */ -package org.apache.tools.ant.taskdefs.optional.dotnet;// ==================================================================== -// imports -// ==================================================================== +package org.apache.tools.ant.taskdefs.optional.dotnet; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; - /** * Task to assemble .net 'Intermediate Language' files. The task will only work * on win2K until other platforms support csc.exe or an equivalent. ilasm.exe @@ -39,7 +37,7 @@ import org.apache.tools.ant.Project; */ public class Ilasm - extends org.apache.tools.ant.taskdefs.MatchingTask + extends org.apache.tools.ant.taskdefs.MatchingTask { /** @@ -181,7 +179,6 @@ public class Ilasm _outputFile = params; } - /** * Sets the Owner attribute * @@ -217,12 +214,12 @@ public class Ilasm * define the target * * @param targetType one of exe|library| - * @exception BuildException if target is not one of + * @exception TaskException if target is not one of * exe|library|module|winexe */ public void setTargetType( String targetType ) - throws BuildException + throws TaskException { targetType = targetType.toLowerCase(); if( targetType.equals( "exe" ) || targetType.equals( "library" ) ) @@ -230,7 +227,7 @@ public class Ilasm _targetType = targetType; } else - throw new BuildException( "targetType " + targetType + " is not a valid type" ); + throw new TaskException( "targetType " + targetType + " is not a valid type" ); } /** @@ -299,15 +296,14 @@ public class Ilasm _extraOptions = null; } - /** * This is the execution entry point. Build a list of files and call ilasm * on each of them. * - * @throws BuildException if the assembly failed and FailOnError is true + * @throws TaskException if the assembly failed and FailOnError is true */ public void execute() - throws BuildException + throws TaskException { if( _srcDir == null ) _srcDir = resolveFile( "." ); @@ -320,22 +316,21 @@ public class Ilasm //add to the command for( int i = 0; i < dependencies.length; i++ ) { - String targetFile = dependencies[i]; + String targetFile = dependencies[ i ]; targetFile = baseDir + File.separator + targetFile; executeOneFile( targetFile ); } }// end execute - /** * do the work for one file by building the command line then calling it * * @param targetFile name of the the file to assemble - * @throws BuildException if the assembly failed and FailOnError is true + * @throws TaskException if the assembly failed and FailOnError is true */ public void executeOneFile( String targetFile ) - throws BuildException + throws TaskException { NetCommand command = new NetCommand( this, exe_title, exe_name ); command.setFailOnError( getFailFailOnError() ); @@ -444,8 +439,7 @@ public class Ilasm return null; if( _targetType.equals( "exe" ) ) return "/exe"; - else - if( _targetType.equals( "library" ) ) + else if( _targetType.equals( "library" ) ) return "/dll"; else return null; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java index 74ed0e33e..0cd68c4de 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.dotnet;// imports + 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.taskdefs.Execute; @@ -16,7 +17,6 @@ import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; - /** * This is a helper class to spawn net commands out. In its initial form it * contains no .net specifics, just contains all the command line/exe @@ -133,12 +133,12 @@ public class NetCommand /** * Run the command using the given Execute instance. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @throws an exception of something goes wrong and the failOnError flag is * true */ public void runCommand() - throws BuildException + throws TaskException { int err = -1;// assume the worst try @@ -158,7 +158,7 @@ public class NetCommand { if( _failOnError ) { - throw new BuildException( _title + " returned: " + err ); + throw new TaskException( _title + " returned: " + err ); } else { @@ -168,11 +168,10 @@ public class NetCommand } catch( IOException e ) { - throw new BuildException( _title + " failed: " + e, e ); + throw new TaskException( _title + " failed: " + e, e ); } } - /** * error text log * @@ -201,7 +200,7 @@ public class NetCommand // default directory to the project's base directory File dir = _owner.getProject().getBaseDir(); ExecuteStreamHandler handler = new LogStreamHandler( _owner, - Project.MSG_INFO, Project.MSG_WARN ); + Project.MSG_INFO, Project.MSG_WARN ); _exe = new Execute( handler, null ); _exe.setAntRun( _owner.getProject() ); _exe.setWorkingDirectory( dir ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java index 5f37ba9c4..378c5d1ce 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -15,7 +16,7 @@ import java.io.OutputStream; import java.util.Hashtable; import java.util.Iterator; 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.taskdefs.Execute; import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; @@ -23,7 +24,6 @@ import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; - /** * BorlandDeploymentTool is dedicated to the Borland Application Server 4.5 and * 4.5.1 This task generates and compiles the stubs and skeletons for all ejb @@ -60,13 +60,13 @@ import org.apache.tools.ant.types.Path; public class BorlandDeploymentTool extends GenericDeploymentTool implements ExecuteStreamHandler { public final static String PUBLICID_BORLAND_EJB - = "-//Inprise Corporation//DTD Enterprise JavaBeans 1.1//EN"; + = "-//Inprise Corporation//DTD Enterprise JavaBeans 1.1//EN"; protected final static String DEFAULT_BAS45_EJB11_DTD_LOCATION - = "/com/inprise/j2ee/xml/dtds/ejb-jar.dtd"; + = "/com/inprise/j2ee/xml/dtds/ejb-jar.dtd"; protected final static String DEFAULT_BAS_DTD_LOCATION - = "/com/inprise/j2ee/xml/dtds/ejb-inprise.dtd"; + = "/com/inprise/j2ee/xml/dtds/ejb-inprise.dtd"; protected final static String BAS_DD = "ejb-inprise.xml"; @@ -130,7 +130,6 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec this.java2iiopdebug = debug; } - /** * setter used to store whether the task will include the generate client * task. (see : BorlandGenerateClient task) @@ -158,7 +157,9 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec } public void setProcessInputStream( OutputStream param1 ) - throws IOException { } + throws IOException + { + } /** * @param is @@ -188,11 +189,10 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec catch( Exception e ) { String msg = "Exception while parsing java2iiop output. Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } - /** * Setter used to store the suffix for the generated borland jar file. * @@ -213,7 +213,6 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec this.verify = verify; } - /** * sets some additional args to send to verify command * @@ -227,10 +226,13 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec // implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface public void start() - throws IOException { } - - public void stop() { } + throws IOException + { + } + public void stop() + { + } protected DescriptorHandler getBorlandDescriptorHandler( final File srcDir ) { @@ -245,7 +247,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String fileNameWithMETA = currentText; //trim the META_INF\ off of the file name String fileName = fileNameWithMETA.substring( META_DIR.length(), - fileNameWithMETA.length() ); + fileNameWithMETA.length() ); File descriptorFile = new File( srcDir, fileName ); ejbFiles.put( fileNameWithMETA, descriptorFile ); @@ -253,11 +255,11 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec } }; handler.registerDTD( PUBLICID_BORLAND_EJB, - borlandDTD == null ? DEFAULT_BAS_DTD_LOCATION : borlandDTD ); + borlandDTD == null ? DEFAULT_BAS_DTD_LOCATION : borlandDTD ); - for( Iterator i = getConfig().dtdLocations.iterator(); i.hasNext(); ) + for( Iterator i = getConfig().dtdLocations.iterator(); i.hasNext(); ) { - EjbJar.DTDLocation dtdLocation = ( EjbJar.DTDLocation )i.next(); + EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation)i.next(); handler.registerDTD( dtdLocation.getPublicId(), dtdLocation.getLocation() ); } return handler; @@ -281,7 +283,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec else { log( "Unable to locate borland deployment descriptor. It was expected to be in " + - borlandDD.getPath(), Project.MSG_WARN ); + borlandDD.getPath(), Project.MSG_WARN ); return; } } @@ -295,17 +297,17 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec * @param jarFile Description of Parameter * @param files Description of Parameter * @param publicId Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void writeJar( String baseName, File jarFile, Hashtable files, String publicId ) - throws BuildException + throws TaskException { //build the home classes list. Vector homes = new Vector(); Iterator it = files.keySet().iterator(); while( it.hasNext() ) { - String clazz = ( String )it.next(); + String clazz = (String)it.next(); if( clazz.endsWith( "Home.class" ) ) { //remove .class extension @@ -396,13 +398,13 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec if( result != 0 ) { String msg = "Failed executing java2iiop (ret code is " + result + ")"; - throw new BuildException( msg ); + throw new TaskException( msg ); } } catch( java.io.IOException e ) { log( "java2iiop exception :" + e.getMessage(), Project.MSG_ERR ); - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } @@ -415,7 +417,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec private void generateClient( File sourceJar ) { getTask().getProject().addTaskDefinition( "internal_bas_generateclient", - org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class ); + org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class ); org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null; log( "generate client for " + sourceJar, Project.MSG_INFO ); @@ -424,7 +426,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String args = verifyArgs; args += " " + sourceJar.getPath(); - gentask = ( BorlandGenerateClient )getTask().getProject().createTask( "internal_bas_generateclient" ); + gentask = (BorlandGenerateClient)getTask().getProject().createTask( "internal_bas_generateclient" ); gentask.setEjbjar( sourceJar ); gentask.setDebug( java2iiopdebug ); Path classpath = getCombinedClasspath(); @@ -439,7 +441,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec { //TO DO : delete the file if it is not a valid file. String msg = "Exception while calling " + VERIFY + " Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } @@ -487,7 +489,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String args = verifyArgs; args += " " + sourceJar.getPath(); - javaTask = ( Java )getTask().getProject().createTask( "java" ); + javaTask = (Java)getTask().getProject().createTask( "java" ); javaTask.setTaskName( "verify" ); javaTask.setClassname( VERIFY ); Commandline.Argument arguments = javaTask.createArg(); @@ -506,7 +508,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec { //TO DO : delete the file if it is not a valid file. String msg = "Exception while calling " + VERIFY + " Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java index 1dab7dd20..52abf8e41 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + 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; import org.apache.tools.ant.taskdefs.ExecTask; @@ -15,7 +16,6 @@ import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; - /** * BorlandGenerateClient is dedicated to the Borland Application Server 4.5 This * task generates the client jar using as input the ejb jar file. Two mode are @@ -100,20 +100,19 @@ public class BorlandGenerateClient extends Task return this.classpath.createPath(); } - /** * Do the work. The work is actually done by creating a separate JVM to run * a java task. * - * @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( ejbjarfile == null || ejbjarfile.isDirectory() ) { - throw new BuildException( "invalid ejb jar file." ); + throw new TaskException( "invalid ejb jar file." ); }// end of if () if( clientjarfile == null || @@ -149,17 +148,17 @@ public class BorlandGenerateClient extends Task /** * launch the generate client using system api * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void executeFork() - throws BuildException + throws TaskException { try { log( "mode : fork" ); org.apache.tools.ant.taskdefs.ExecTask execTask = null; - execTask = ( ExecTask )getProject().createTask( "exec" ); + execTask = (ExecTask)getProject().createTask( "exec" ); execTask.setDir( new File( "." ) ); execTask.setExecutable( "iastool" ); @@ -186,7 +185,7 @@ public class BorlandGenerateClient extends Task { // Have to catch this because of the semantics of calling main() String msg = "Exception while calling generateclient Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } @@ -194,17 +193,17 @@ public class BorlandGenerateClient extends Task /** * launch the generate client using java api * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void executeJava() - throws BuildException + throws TaskException { try { log( "mode : java" ); org.apache.tools.ant.taskdefs.Java execTask = null; - execTask = ( Java )getProject().createTask( "java" ); + execTask = (Java)getProject().createTask( "java" ); execTask.setDir( new File( "." ) ); execTask.setClassname( "com.inprise.server.commandline.EJBUtilities" ); @@ -238,7 +237,7 @@ public class BorlandGenerateClient extends Task { // Have to catch this because of the semantics of calling main() String msg = "Exception while calling generateclient Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java index 25218e180..0d54b678c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; @@ -86,22 +87,22 @@ public class DDCreator extends MatchingTask * interfaces to be available in the classpath, this also avoids having to * start ant with the class path of the project it is building. * - * @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( descriptorDirectory == null || !descriptorDirectory.isDirectory() ) { - throw new BuildException( "descriptors directory " + descriptorDirectory.getPath() + - " is not valid" ); + throw new TaskException( "descriptors directory " + descriptorDirectory.getPath() + + " is not valid" ); } if( generatedFilesDirectory == null || !generatedFilesDirectory.isDirectory() ) { - throw new BuildException( "dest directory " + generatedFilesDirectory.getPath() + - " is not valid" ); + throw new TaskException( "dest directory " + generatedFilesDirectory.getPath() + + " is not valid" ); } String args = descriptorDirectory + " " + generatedFilesDirectory; @@ -113,12 +114,12 @@ public class DDCreator extends MatchingTask for( int i = 0; i < files.length; ++i ) { - args += " " + files[i]; + args += " " + files[ i ]; } String systemClassPath = System.getProperty( "java.class.path" ); String execClassPath = project.translatePath( systemClassPath + ":" + classpath ); - Java ddCreatorTask = ( Java )project.createTask( "java" ); + Java ddCreatorTask = (Java)project.createTask( "java" ); ddCreatorTask.setTaskName( getTaskName() ); ddCreatorTask.setFork( true ); ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" ); @@ -127,7 +128,7 @@ public class DDCreator extends MatchingTask ddCreatorTask.setClasspath( new Path( project, execClassPath ) ); if( ddCreatorTask.executeJava() != 0 ) { - throw new BuildException( "Execution of ddcreator helper failed" ); + throw new TaskException( "Execution of ddcreator helper failed" ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreatorHelper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreatorHelper.java index f59a3288c..904bc278c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreatorHelper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DDCreatorHelper.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.FileInputStream; import java.io.ObjectInputStream; @@ -48,13 +49,13 @@ public class DDCreatorHelper private DDCreatorHelper( String[] args ) { int index = 0; - descriptorDirectory = new File( args[index++] ); - generatedFilesDirectory = new File( args[index++] ); + descriptorDirectory = new File( args[ index++ ] ); + generatedFilesDirectory = new File( args[ index++ ] ); - descriptors = new String[args.length - index]; + descriptors = new String[ args.length - index ]; for( int i = 0; index < args.length; ++i ) { - descriptors[i] = args[index++]; + descriptors[ i ] = args[ index++ ]; } } @@ -85,7 +86,7 @@ public class DDCreatorHelper { for( int i = 0; i < descriptors.length; ++i ) { - String descriptorName = descriptors[i]; + String descriptorName = descriptors[ i ]; File descriptorFile = new File( descriptorDirectory, descriptorName ); int extIndex = descriptorName.lastIndexOf( "." ); @@ -102,13 +103,13 @@ public class DDCreatorHelper // do we need to regenerate the file if( !serFile.exists() || serFile.lastModified() < descriptorFile.lastModified() - || regenerateSerializedFile( serFile ) ) + || regenerateSerializedFile( serFile ) ) { String[] args = {"-noexit", - "-d", serFile.getParent(), - "-outputfile", serFile.getName(), - descriptorFile.getPath()}; + "-d", serFile.getParent(), + "-outputfile", serFile.getName(), + descriptorFile.getPath()}; try { weblogic.ejb.utils.DDCreator.main( args ); @@ -117,8 +118,8 @@ public class DDCreatorHelper { // there was an exception - run with no exit to get proper error String[] newArgs = {"-d", generatedFilesDirectory.getPath(), - "-outputfile", serFile.getName(), - descriptorFile.getPath()}; + "-outputfile", serFile.getName(), + descriptorFile.getPath()}; weblogic.ejb.utils.DDCreator.main( newArgs ); } } @@ -141,7 +142,7 @@ public class DDCreatorHelper FileInputStream fis = new FileInputStream( serFile ); ObjectInputStream ois = new ObjectInputStream( fis ); - DeploymentDescriptor dd = ( DeploymentDescriptor )ois.readObject(); + DeploymentDescriptor dd = (DeploymentDescriptor)ois.readObject(); fis.close(); // Since the descriptor read properly, everything should be o.k. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java index 4f0a226cc..594939eca 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -164,7 +165,6 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase currentText += new String( ch, start, length ); } - /** * SAX parser call-back method that is invoked when an element is exited. * Used to blank out (set to the empty string, not nullify) the name of the @@ -255,7 +255,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { this.publicId = publicId; - File dtdFile = ( File )fileDTDs.get( publicId ); + File dtdFile = (File)fileDTDs.get( publicId ); if( dtdFile != null ) { try @@ -269,7 +269,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } } - String dtdResourceName = ( String )resourceDTDs.get( publicId ); + String dtdResourceName = (String)resourceDTDs.get( publicId ); if( dtdResourceName != null ) { InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); @@ -280,7 +280,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } } - URL dtdUrl = ( URL )urlDTDs.get( publicId ); + URL dtdUrl = (URL)urlDTDs.get( publicId ); if( dtdUrl != null ) { try @@ -296,7 +296,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } owningTask.log( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity", - Project.MSG_INFO ); + Project.MSG_INFO ); return null; } @@ -315,7 +315,6 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase inEJBRef = false; } - /** * SAX parser call-back method that is invoked when a new element is entered * into. Used to store the context (attribute name) in the currentAttribute @@ -356,7 +355,6 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } } - protected void processElement() { if( inEJBRef || diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java index 147faed55..72328b94b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java @@ -6,11 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import javax.xml.parsers.SAXParser; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; - public interface EJBDeploymentTool { /** @@ -20,18 +20,18 @@ public interface EJBDeploymentTool * @param descriptorFilename the name of the deployment descriptor * @param saxParser a SAX parser which can be used to parse the deployment * descriptor. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void processDescriptor( String descriptorFilename, SAXParser saxParser ) - throws BuildException; + throws TaskException; /** * Called to validate that the tool parameters have been configured. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void validateConfigured() - throws BuildException; + throws TaskException; /** * Set the task which owns this tool diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java index df7aa90bb..be80ac4e5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb;// Standard java imports + import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import javax.xml.parsers.ParserConfigurationException;// XML imports +import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory;// Apache/Ant imports -import org.apache.tools.ant.BuildException; +import javax.xml.parsers.SAXParserFactory; +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; @@ -94,8 +95,8 @@ public class EjbJar extends MatchingTask } else if( !config.namingScheme.getValue().equals( NamingScheme.BASEJARNAME ) ) { - throw new BuildException( "The basejarname attribute is not compatible with the " + - config.namingScheme.getValue() + " naming scheme" ); + throw new TaskException( "The basejarname attribute is not compatible with the " + + config.namingScheme.getValue() + " naming scheme" ); } } @@ -137,7 +138,6 @@ public class EjbJar extends MatchingTask config.descriptorDir = inDir; } - /** * Set the destination directory. The EJB jar files will be written into * this directory. The jar files that exist in this directory are also used @@ -183,7 +183,6 @@ public class EjbJar extends MatchingTask this.genericJarSuffix = inString; } - /** * Set the Manifest file to use when jarring. As of EJB 1.1, manifest files * are no longer used to configure the EJB. However, they still have a vital @@ -212,8 +211,8 @@ public class EjbJar extends MatchingTask if( !config.namingScheme.getValue().equals( NamingScheme.BASEJARNAME ) && config.baseJarName != null ) { - throw new BuildException( "The basejarname attribute is not compatible with the " + - config.namingScheme.getValue() + " naming scheme" ); + throw new TaskException( "The basejarname attribute is not compatible with the " + + config.namingScheme.getValue() + " naming scheme" ); } } @@ -368,12 +367,12 @@ public class EjbJar extends MatchingTask * configured and then each descriptor found is passed to all the deployment * tool elements for processing. * - * @exception BuildException thrown whenever a problem is encountered that + * @exception TaskException thrown whenever a problem is encountered that * cannot be recovered from, to signal to ant that a major problem * occurred within this task. */ public void execute() - throws BuildException + throws TaskException { validateConfig(); @@ -386,9 +385,9 @@ public class EjbJar extends MatchingTask deploymentTools.add( genericTool ); } - for( Iterator i = deploymentTools.iterator(); i.hasNext(); ) + for( Iterator i = deploymentTools.iterator(); i.hasNext(); ) { - EJBDeploymentTool tool = ( EJBDeploymentTool )i.next(); + EJBDeploymentTool tool = (EJBDeploymentTool)i.next(); tool.configure( config ); tool.validateConfigured(); } @@ -405,32 +404,32 @@ public class EjbJar extends MatchingTask String[] files = ds.getIncludedFiles(); log( files.length + " deployment descriptors located.", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); // Loop through the files. Each file represents one deployment // descriptor, and hence one bean in our model. for( int index = 0; index < files.length; ++index ) { // process the deployment descriptor in each tool - for( Iterator i = deploymentTools.iterator(); i.hasNext(); ) + for( Iterator i = deploymentTools.iterator(); i.hasNext(); ) { - EJBDeploymentTool tool = ( EJBDeploymentTool )i.next(); - tool.processDescriptor( files[index], saxParser ); + EJBDeploymentTool tool = (EJBDeploymentTool)i.next(); + tool.processDescriptor( files[ index ], saxParser ); } } } catch( SAXException se ) { String msg = "SAXException while creating parser." - + " Details: " - + se.getMessage(); - throw new BuildException( msg, se ); + + " Details: " + + se.getMessage(); + throw new TaskException( msg, se ); } catch( ParserConfigurationException pce ) { String msg = "ParserConfigurationException while creating parser. " - + "Details: " + pce.getMessage(); - throw new BuildException( msg, pce ); + + "Details: " + pce.getMessage(); + throw new TaskException( msg, pce ); } } @@ -438,7 +437,7 @@ public class EjbJar extends MatchingTask { if( config.srcDir == null ) { - throw new BuildException( "The srcDir attribute must be specified" ); + throw new TaskException( "The srcDir attribute must be specified" ); } if( config.descriptorDir == null ) @@ -454,8 +453,8 @@ public class EjbJar extends MatchingTask else if( config.namingScheme.getValue().equals( NamingScheme.BASEJARNAME ) && config.baseJarName == null ) { - throw new BuildException( "The basejarname attribute must be specified " + - "with the basejarname naming scheme" ); + throw new TaskException( "The basejarname attribute must be specified " + + "with the basejarname naming scheme" ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java index 0041c3756..43f44ff22 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; @@ -132,40 +133,40 @@ public class Ejbc extends MatchingTask * avoids having to start ant with the class path of the project it is * building. * - * @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( descriptorDirectory == null || !descriptorDirectory.isDirectory() ) { - throw new BuildException( "descriptors directory " + descriptorDirectory.getPath() + - " is not valid" ); + throw new TaskException( "descriptors directory " + descriptorDirectory.getPath() + + " is not valid" ); } if( generatedFilesDirectory == null || !generatedFilesDirectory.isDirectory() ) { - throw new BuildException( "dest directory " + generatedFilesDirectory.getPath() + - " is not valid" ); + throw new TaskException( "dest directory " + generatedFilesDirectory.getPath() + + " is not valid" ); } if( sourceDirectory == null || !sourceDirectory.isDirectory() ) { - throw new BuildException( "src directory " + sourceDirectory.getPath() + - " is not valid" ); + throw new TaskException( "src directory " + sourceDirectory.getPath() + + " is not valid" ); } String systemClassPath = System.getProperty( "java.class.path" ); String execClassPath = project.translatePath( systemClassPath + ":" + classpath + - ":" + generatedFilesDirectory ); + ":" + generatedFilesDirectory ); // get all the files in the descriptor directory DirectoryScanner ds = super.getDirectoryScanner( descriptorDirectory ); String[] files = ds.getIncludedFiles(); - Java helperTask = ( Java )project.createTask( "java" ); + Java helperTask = (Java)project.createTask( "java" ); helperTask.setTaskName( getTaskName() ); helperTask.setFork( true ); helperTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.EjbcHelper" ); @@ -178,7 +179,7 @@ public class Ejbc extends MatchingTask for( int i = 0; i < files.length; ++i ) { - args += " " + files[i]; + args += " " + files[ i ]; } Commandline.Argument arguments = helperTask.createArg(); @@ -186,7 +187,7 @@ public class Ejbc extends MatchingTask helperTask.setClasspath( new Path( project, execClassPath ) ); if( helperTask.executeJava() != 0 ) { - throw new BuildException( "Execution of ejbc helper failed" ); + throw new TaskException( "Execution of ejbc helper failed" ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java index 73b2ed414..fc4cf1b01 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; @@ -16,7 +17,6 @@ import java.util.Vector; import javax.ejb.deployment.DeploymentDescriptor; import javax.ejb.deployment.EntityDescriptor; - /** * A helper class which performs the actual work of the ejbc task. This class is * run with a classpath which includes the weblogic tools and the home and @@ -72,16 +72,16 @@ public class EjbcHelper private EjbcHelper( String[] args ) { int index = 0; - descriptorDirectory = new File( args[index++] ); - generatedFilesDirectory = new File( args[index++] ); - sourceDirectory = new File( args[index++] ); - manifestFile = new File( args[index++] ); - keepGenerated = Boolean.valueOf( args[index++] ).booleanValue(); + descriptorDirectory = new File( args[ index++ ] ); + generatedFilesDirectory = new File( args[ index++ ] ); + sourceDirectory = new File( args[ index++ ] ); + manifestFile = new File( args[ index++ ] ); + keepGenerated = Boolean.valueOf( args[ index++ ] ).booleanValue(); - descriptors = new String[args.length - index]; + descriptors = new String[ args.length - index ]; for( int i = 0; index < args.length; ++i ) { - descriptors[i] = args[index++]; + descriptors[ i ] = args[ index++ ]; } } @@ -113,7 +113,7 @@ public class EjbcHelper v.addElement( generatedFilesDirectory.getPath() ); v.addElement( descriptorFile.getPath() ); - String[] args = new String[v.size()]; + String[] args = new String[ v.size() ]; v.copyInto( args ); return args; } @@ -142,7 +142,7 @@ public class EjbcHelper { fis = new FileInputStream( descriptorFile ); ObjectInputStream ois = new ObjectInputStream( fis ); - DeploymentDescriptor dd = ( DeploymentDescriptor )ois.readObject(); + DeploymentDescriptor dd = (DeploymentDescriptor)ois.readObject(); fis.close(); String homeInterfacePath = dd.getHomeInterfaceClassName().replace( '.', '/' ) + ".java"; @@ -150,7 +150,7 @@ public class EjbcHelper String primaryKeyClassPath = null; if( dd instanceof EntityDescriptor ) { - primaryKeyClassPath = ( ( EntityDescriptor )dd ).getPrimaryKeyClassName().replace( '.', '/' ) + ".java"; + primaryKeyClassPath = ( (EntityDescriptor)dd ).getPrimaryKeyClassName().replace( '.', '/' ) + ".java"; ; } @@ -167,11 +167,11 @@ public class EjbcHelper // of the above or the .ser file itself. String beanClassBase = dd.getEnterpriseBeanClassName().replace( '.', '/' ); File ejbImplentationClass - = new File( generatedFilesDirectory, beanClassBase + "EOImpl.class" ); + = new File( generatedFilesDirectory, beanClassBase + "EOImpl.class" ); File homeImplementationClass - = new File( generatedFilesDirectory, beanClassBase + "HomeImpl.class" ); + = new File( generatedFilesDirectory, beanClassBase + "HomeImpl.class" ); File beanStubClass - = new File( generatedFilesDirectory, beanClassBase + "EOImpl_WLStub.class" ); + = new File( generatedFilesDirectory, beanClassBase + "EOImpl_WLStub.class" ); // if the implementation classes don;t exist regenerate if( !ejbImplentationClass.exists() || !homeImplementationClass.exists() || @@ -234,7 +234,7 @@ public class EjbcHelper String manifest = "Manifest-Version: 1.0\n\n"; for( int i = 0; i < descriptors.length; ++i ) { - String descriptorName = descriptors[i]; + String descriptorName = descriptors[ i ]; File descriptorFile = new File( descriptorDirectory, descriptorName ); if( isRegenRequired( descriptorFile ) ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java index e152ef97e..91961f7dd 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java @@ -27,7 +27,6 @@ import org.apache.bcel.*; import org.apache.bcel.classfile.*; 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.Location; import org.apache.tools.ant.Project; @@ -279,7 +278,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool + "'. This probably indicates badly-formed XML." + " Details: " + se.getMessage(); - throw new BuildException( msg, se ); + throw new TaskException( msg, se ); } catch( IOException ioe ) { @@ -288,23 +287,23 @@ public class GenericDeploymentTool implements EJBDeploymentTool + "'. This probably indicates that the descriptor" + " doesn't exist. Details: " + ioe.getMessage(); - throw new BuildException( msg, ioe ); + throw new TaskException( msg, ioe ); } } /** * Called to validate that the tool parameters have been configured. * - * @throws BuildException If the Deployment Tool's configuration isn't valid + * @throws TaskException If the Deployment Tool's configuration isn't valid */ public void validateConfigured() - throws BuildException + throws TaskException { if( ( destDir == null ) || ( !destDir.isDirectory() ) ) { String msg = "A valid destination directory must be specified " + "using the \"destdir\" attribute."; - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -499,12 +498,12 @@ public class GenericDeploymentTool implements EJBDeploymentTool * @param logicalFilename A String representing the name, including all * relevant path information, that should be stored for the entry being * added. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void addFileToJar( JarOutputStream jStream, File inputFile, String logicalFilename ) - throws BuildException + throws TaskException { FileInputStream iStream = null; try @@ -593,10 +592,10 @@ public class GenericDeploymentTool implements EJBDeploymentTool * * @param checkEntries files, that are extracted from the deployment * descriptor - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkAndAddDependants( Hashtable checkEntries ) - throws BuildException + throws TaskException { Dependencies visitor = new Dependencies(); Set set = new TreeSet(); @@ -659,22 +658,22 @@ public class GenericDeploymentTool implements EJBDeploymentTool * This method is called as the first step in the processDescriptor method * to allow vendor-specific subclasses to validate the task configuration * prior to processing the descriptor. If the configuration is invalid, a - * BuildException should be thrown. + * TaskException should be thrown. * * @param descriptorFileName String representing the file name of an EJB * descriptor to be processed * @param saxParser SAXParser which may be used to parse the XML descriptor - * @exception BuildException Description of Exception - * @thows BuildException Thrown if the configuration is invalid + * @exception TaskException Description of Exception + * @thows TaskException Thrown if the configuration is invalid */ protected void checkConfiguration( String descriptorFileName, SAXParser saxParser ) - throws BuildException + throws TaskException { /* * For the GenericDeploymentTool, do nothing. Vendor specific - * subclasses should throw a BuildException if the configuration is + * subclasses should throw a TaskException if the configuration is * invalid for their server. */ } @@ -816,11 +815,11 @@ public class GenericDeploymentTool implements EJBDeploymentTool * @param jarfile Description of Parameter * @param files Description of Parameter * @param publicId Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void writeJar( String baseName, File jarfile, Hashtable files, String publicId ) - throws BuildException + throws TaskException { JarOutputStream jarStream = null; @@ -856,7 +855,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool in = new FileInputStream( config.manifest ); if( in == null ) { - throw new BuildException( "Could not find manifest file: " + config.manifest ); + throw new TaskException( "Could not find manifest file: " + config.manifest ); } } else @@ -865,7 +864,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool in = this.getClass().getResourceAsStream( defaultManifest ); if( in == null ) { - throw new BuildException( "Could not find default manifest: " + defaultManifest ); + throw new TaskException( "Could not find default manifest: " + defaultManifest ); } } @@ -873,7 +872,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool } catch( IOException e ) { - throw new BuildException( "Unable to read manifest", e ); + throw new TaskException( "Unable to read manifest", e ); } finally { @@ -933,7 +932,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool + jarfile.toString() + "'. Details: " + ioe.getMessage(); - throw new BuildException( msg, ioe ); + throw new TaskException( msg, ioe ); } finally { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java index 8c647dc47..5ac9306c1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.IOException; import java.util.Hashtable; import javax.xml.parsers.SAXParser; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.xml.sax.SAXException; @@ -122,7 +123,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool log( "Since a generic JAR file is not created during processing, the " + "iPlanet Deployment Tool does not support the " + "\"genericjarsuffix\" attribute. It will be ignored.", - Project.MSG_WARN ); + Project.MSG_WARN ); } /** @@ -194,7 +195,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool protected void addVendorFiles( Hashtable ejbFiles, String ddPrefix ) { ejbFiles.put( META_DIR + IAS_DD, new File( getConfig().descriptorDir, - getIasDescriptorName() ) ); + getIasDescriptorName() ) ); } /** @@ -203,11 +204,11 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool * @param descriptorFileName String representing the file name of an EJB * descriptor to be processed * @param saxParser SAXParser which may be used to parse the XML descriptor - * @throws BuildException If the user selections are invalid. + * @throws TaskException If the user selections are invalid. */ protected void checkConfiguration( String descriptorFileName, SAXParser saxParser ) - throws BuildException + throws TaskException { int startOfName = descriptorFileName.lastIndexOf( File.separatorChar ) + 1; @@ -215,26 +216,26 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool if( stdXml.equals( EJB_DD ) && ( getConfig().baseJarName == null ) ) { String msg = "No name specified for the completed JAR file. The EJB" - + " descriptor should be prepended with the JAR " - + "name or it should be specified using the " - + "attribute \"basejarname\" in the \"ejbjar\" task."; - throw new BuildException( msg ); + + " descriptor should be prepended with the JAR " + + "name or it should be specified using the " + + "attribute \"basejarname\" in the \"ejbjar\" task."; + throw new TaskException( msg ); } File iasDescriptor = new File( getConfig().descriptorDir, - getIasDescriptorName() ); + getIasDescriptorName() ); if( ( !iasDescriptor.exists() ) || ( !iasDescriptor.isFile() ) ) { String msg = "The iAS-specific EJB descriptor (" - + iasDescriptor + ") was not found."; - throw new BuildException( msg ); + + iasDescriptor + ") was not found."; + throw new TaskException( msg ); } if( ( iashome != null ) && ( !iashome.isDirectory() ) ) { String msg = "If \"iashome\" is specified, it must be a valid " - + "directory (it was set to " + iashome + ")."; - throw new BuildException( msg ); + + "directory (it was set to " + iashome + ")."; + throw new TaskException( msg ); } } @@ -264,9 +265,9 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool */ IPlanetEjbc ejbc = new IPlanetEjbc( new File( getConfig().descriptorDir, - descriptorFileName ), + descriptorFileName ), new File( getConfig().descriptorDir, - getIasDescriptorName() ), + getIasDescriptorName() ), getConfig().srcDir, getCombinedClasspath().toString(), saxParser ); @@ -286,8 +287,8 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool } catch( IPlanetEjbc.EjbcException e ) { - throw new BuildException( "An error has occurred while trying to " - + "execute the iAS ejbc utility", e ); + throw new TaskException( "An error has occurred while trying to " + + "execute the iAS ejbc utility", e ); } displayName = ejbc.getDisplayName(); @@ -306,16 +307,16 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool for( int i = 0; i < cmpDescriptors.length; i++ ) { - int endOfCmp = cmpDescriptors[i].lastIndexOf( '/' ); - String cmpDescriptor = cmpDescriptors[i].substring( endOfCmp + 1 ); + int endOfCmp = cmpDescriptors[ i ].lastIndexOf( '/' ); + String cmpDescriptor = cmpDescriptors[ i ].substring( endOfCmp + 1 ); File cmpFile = new File( baseDir, relativePath + cmpDescriptor ); if( !cmpFile.exists() ) { - throw new BuildException( "The CMP descriptor file (" - + cmpFile + ") could not be found." ); + throw new TaskException( "The CMP descriptor file (" + + cmpFile + ") could not be found." ); } - files.put( cmpDescriptors[i], cmpFile ); + files.put( cmpDescriptors[ i ], cmpFile ); } } @@ -398,7 +399,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool } basename = descriptorName.substring( startOfFileName + 1, - endOfBaseName + 1 ); + endOfBaseName + 1 ); remainder = descriptorName.substring( endOfBaseName + 1 ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java index 8c3b18d60..ec84225a6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -145,13 +146,13 @@ public class IPlanetEjbc if( classpath != null ) { StringTokenizer st = new StringTokenizer( classpath, - File.pathSeparator ); + File.pathSeparator ); while( st.hasMoreTokens() ) { elements.add( st.nextToken() ); } classpathElements - = ( String[] )elements.toArray( new String[elements.size()] ); + = (String[])elements.toArray( new String[ elements.size() ] ); } } @@ -179,24 +180,24 @@ public class IPlanetEjbc return; } - stdDescriptor = new File( args[args.length - 2] ); - iasDescriptor = new File( args[args.length - 1] ); + stdDescriptor = new File( args[ args.length - 2 ] ); + iasDescriptor = new File( args[ args.length - 1 ] ); for( int i = 0; i < args.length - 2; i++ ) { - if( args[i].equals( "-classpath" ) ) + if( args[ i ].equals( "-classpath" ) ) { - classpath = args[++i]; + classpath = args[ ++i ]; } - else if( args[i].equals( "-d" ) ) + else if( args[ i ].equals( "-d" ) ) { - destDirectory = new File( args[++i] ); + destDirectory = new File( args[ ++i ] ); } - else if( args[i].equals( "-debug" ) ) + else if( args[ i ].equals( "-debug" ) ) { debug = true; } - else if( args[i].equals( "-keepsource" ) ) + else if( args[ i ].equals( "-keepsource" ) ) { retainSource = true; } @@ -248,7 +249,7 @@ public class IPlanetEjbc * Build and populate an instance of the ejbc utility */ ejbc = new IPlanetEjbc( stdDescriptor, iasDescriptor, destDirectory, - classpath, parser ); + classpath, parser ); ejbc.setDebugOutput( debug ); ejbc.setRetainSource( retainSource ); @@ -262,19 +263,19 @@ public class IPlanetEjbc catch( IOException e ) { System.out.println( "An IOException has occurred while reading the " - + "XML descriptors (" + e.getMessage() + ")." ); + + "XML descriptors (" + e.getMessage() + ")." ); return; } catch( SAXException e ) { System.out.println( "A SAXException has occurred while reading the " - + "XML descriptors (" + e.getMessage() + ")." ); + + "XML descriptors (" + e.getMessage() + ")." ); return; } catch( IPlanetEjbc.EjbcException e ) { System.out.println( "An error has occurred while executing the ejbc " - + "utility (" + e.getMessage() + ")." ); + + "utility (" + e.getMessage() + ")." ); return; } } @@ -353,11 +354,11 @@ public class IPlanetEjbc for( int i = 0; i < ejbs.length; i++ ) { - List descriptors = ( List )ejbs[i].getCmpDescriptors(); + List descriptors = (List)ejbs[ i ].getCmpDescriptors(); returnList.addAll( descriptors ); } - return ( String[] )returnList.toArray( new String[returnList.size()] ); + return (String[])returnList.toArray( new String[ returnList.size() ] ); } /** @@ -407,12 +408,12 @@ public class IPlanetEjbc for( int i = 0; i < ejbs.length; i++ ) { log( "EJBInfo..." ); - log( ejbs[i].toString() ); + log( ejbs[ i ].toString() ); } for( int i = 0; i < ejbs.length; i++ ) { - EjbInfo ejb = ejbs[i]; + EjbInfo ejb = ejbs[ i ]; ejb.checkConfiguration( destDirectory );// Throws EjbcException @@ -588,7 +589,7 @@ public class IPlanetEjbc /* * Convert the List into an Array and return it */ - return ( String[] )arguments.toArray( new String[arguments.size()] ); + return (String[])arguments.toArray( new String[ arguments.size() ] ); } /** @@ -605,7 +606,7 @@ public class IPlanetEjbc StringBuffer args = new StringBuffer(); for( int i = 0; i < arguments.length; i++ ) { - args.append( arguments[i] ).append( " " ); + args.append( arguments[ i ] ).append( " " ); } /* @@ -619,7 +620,7 @@ public class IPlanetEjbc else { command = iasHomeDir.toString() + File.separator + "bin" - + File.separator; + + File.separator; } command += "ejbc "; @@ -745,7 +746,7 @@ public class IPlanetEjbc public File getClassFile( File directory ) { String pathToFile = qualifiedName.replace( '.', File.separatorChar ) - + ".class"; + + ".class"; return new File( directory, pathToFile ); } @@ -805,7 +806,6 @@ public class IPlanetEjbc } }// End of EjbcHandler inner class - /** * This inner class represents an EJB that will be compiled using ejbc. * @@ -1005,13 +1005,13 @@ public class IPlanetEjbc public String toString() { String s = "EJB name: " + name - + "\n\r home: " + home - + "\n\r remote: " + remote - + "\n\r impl: " + implementation - + "\n\r beantype: " + beantype - + "\n\r cmp: " + cmp - + "\n\r iiop: " + iiop - + "\n\r hasession: " + hasession; + + "\n\r home: " + home + + "\n\r remote: " + remote + + "\n\r impl: " + implementation + + "\n\r beantype: " + beantype + + "\n\r cmp: " + cmp + + "\n\r iiop: " + iiop + + "\n\r hasession: " + hasession; Iterator i = cmpDescriptors.iterator(); while( i.hasNext() ) @@ -1040,40 +1040,40 @@ public class IPlanetEjbc if( home == null ) { throw new EjbcException( "A home interface was not found " - + "for the " + name + " EJB." ); + + "for the " + name + " EJB." ); } if( remote == null ) { throw new EjbcException( "A remote interface was not found " - + "for the " + name + " EJB." ); + + "for the " + name + " EJB." ); } if( implementation == null ) { throw new EjbcException( "An EJB implementation class was not " - + "found for the " + name + " EJB." ); + + "found for the " + name + " EJB." ); } if( ( !beantype.equals( ENTITY_BEAN ) ) - && ( !beantype.equals( STATELESS_SESSION ) ) - && ( !beantype.equals( STATEFUL_SESSION ) ) ) + && ( !beantype.equals( STATELESS_SESSION ) ) + && ( !beantype.equals( STATEFUL_SESSION ) ) ) { throw new EjbcException( "The beantype found (" + beantype + ") " - + "isn't valid in the " + name + " EJB." ); + + "isn't valid in the " + name + " EJB." ); } if( cmp && ( !beantype.equals( ENTITY_BEAN ) ) ) { System.out.println( "CMP stubs and skeletons may not be generated" - + " for a Session Bean -- the \"cmp\" attribute will be" - + " ignoredfor the " + name + " EJB." ); + + " for a Session Bean -- the \"cmp\" attribute will be" + + " ignoredfor the " + name + " EJB." ); } if( hasession && ( !beantype.equals( STATEFUL_SESSION ) ) ) { System.out.println( "Highly available stubs and skeletons may " - + "only be generated for a Stateful Session Bean -- the " - + "\"hasession\" attribute will be ignored for the " - + name + " EJB." ); + + "only be generated for a Stateful Session Bean -- the " + + "\"hasession\" attribute will be ignored for the " + + name + " EJB." ); } /* @@ -1082,20 +1082,20 @@ public class IPlanetEjbc if( !remote.getClassFile( buildDir ).exists() ) { throw new EjbcException( "The remote interface " - + remote.getQualifiedClassName() + " could not be " - + "found." ); + + remote.getQualifiedClassName() + " could not be " + + "found." ); } if( !home.getClassFile( buildDir ).exists() ) { throw new EjbcException( "The home interface " - + home.getQualifiedClassName() + " could not be " - + "found." ); + + home.getQualifiedClassName() + " could not be " + + "found." ); } if( !implementation.getClassFile( buildDir ).exists() ) { throw new EjbcException( "The EJB implementation class " - + implementation.getQualifiedClassName() + " could " - + "not be found." ); + + implementation.getQualifiedClassName() + " could " + + "not be found." ); } } @@ -1111,7 +1111,7 @@ public class IPlanetEjbc */ private String[] classesToGenerate() { - String[] classnames = ( iiop ) ? new String[15] : new String[9]; + String[] classnames = ( iiop ) ? new String[ 15 ] : new String[ 9 ]; final String remotePkg = remote.getPackageName() + "."; final String remoteClass = remote.getClassName(); @@ -1123,30 +1123,30 @@ public class IPlanetEjbc String fullPath; - classnames[index++] = implPkg + "ejb_fac_" + implFullClass; - classnames[index++] = implPkg + "ejb_home_" + implFullClass; - classnames[index++] = implPkg + "ejb_skel_" + implFullClass; - classnames[index++] = remotePkg + "ejb_kcp_skel_" + remoteClass; - classnames[index++] = homePkg + "ejb_kcp_skel_" + homeClass; - classnames[index++] = remotePkg + "ejb_kcp_stub_" + remoteClass; - classnames[index++] = homePkg + "ejb_kcp_stub_" + homeClass; - classnames[index++] = remotePkg + "ejb_stub_" + remoteClass; - classnames[index++] = homePkg + "ejb_stub_" + homeClass; + classnames[ index++ ] = implPkg + "ejb_fac_" + implFullClass; + classnames[ index++ ] = implPkg + "ejb_home_" + implFullClass; + classnames[ index++ ] = implPkg + "ejb_skel_" + implFullClass; + classnames[ index++ ] = remotePkg + "ejb_kcp_skel_" + remoteClass; + classnames[ index++ ] = homePkg + "ejb_kcp_skel_" + homeClass; + classnames[ index++ ] = remotePkg + "ejb_kcp_stub_" + remoteClass; + classnames[ index++ ] = homePkg + "ejb_kcp_stub_" + homeClass; + classnames[ index++ ] = remotePkg + "ejb_stub_" + remoteClass; + classnames[ index++ ] = homePkg + "ejb_stub_" + homeClass; if( !iiop ) { return classnames; } - classnames[index++] = remotePkg + "_" + remoteClass + "_Stub"; - classnames[index++] = homePkg + "_" + homeClass + "_Stub"; - classnames[index++] = remotePkg + "_ejb_RmiCorbaBridge_" - + remoteClass + "_Tie"; - classnames[index++] = homePkg + "_ejb_RmiCorbaBridge_" + homeClass - + "_Tie"; - classnames[index++] = remotePkg + "ejb_RmiCorbaBridge_" - + remoteClass; - classnames[index++] = homePkg + "ejb_RmiCorbaBridge_" + homeClass; + classnames[ index++ ] = remotePkg + "_" + remoteClass + "_Stub"; + classnames[ index++ ] = homePkg + "_" + homeClass + "_Stub"; + classnames[ index++ ] = remotePkg + "_ejb_RmiCorbaBridge_" + + remoteClass + "_Tie"; + classnames[ index++ ] = homePkg + "_ejb_RmiCorbaBridge_" + homeClass + + "_Tie"; + classnames[ index++ ] = remotePkg + "ejb_RmiCorbaBridge_" + + remoteClass; + classnames[ index++ ] = homePkg + "ejb_RmiCorbaBridge_" + homeClass; return classnames; } @@ -1161,7 +1161,7 @@ public class IPlanetEjbc * @return The modification timestamp for the "oldest" EJB stub or * skeleton. If one of the classes cannot be found, -1 * is returned. - * @throws BuildException If the canonical path of the destination + * @throws TaskException If the canonical path of the destination * directory cannot be found. */ private long destClassesModified( File destDir ) @@ -1178,7 +1178,7 @@ public class IPlanetEjbc { String pathToClass = - classnames[i].replace( '.', File.separatorChar ) + ".class"; + classnames[ i ].replace( '.', File.separatorChar ) + ".class"; File classFile = new File( destDir, pathToClass ); /* @@ -1210,7 +1210,7 @@ public class IPlanetEjbc * * @param buildDir Description of Parameter * @return The modification timestamp for the "oldest" EJB source class. - * @throws BuildException If one of the EJB source classes cannot be + * @throws TaskException If one of the EJB source classes cannot be * found on the classpath. */ private long sourceClassesModified( File buildDir ) @@ -1229,8 +1229,8 @@ public class IPlanetEjbc if( modified == -1 ) { System.out.println( "The class " - + remote.getQualifiedClassName() + " couldn't " - + "be found on the classpath" ); + + remote.getQualifiedClassName() + " couldn't " + + "be found on the classpath" ); return -1; } latestModified = modified; @@ -1243,8 +1243,8 @@ public class IPlanetEjbc if( modified == -1 ) { System.out.println( "The class " - + home.getQualifiedClassName() + " couldn't be " - + "found on the classpath" ); + + home.getQualifiedClassName() + " couldn't be " + + "found on the classpath" ); return -1; } latestModified = Math.max( latestModified, modified ); @@ -1264,8 +1264,8 @@ public class IPlanetEjbc if( modified == -1 ) { System.out.println( "The class " - + implementation.getQualifiedClassName() - + " couldn't be found on the classpath" ); + + implementation.getQualifiedClassName() + + " couldn't be found on the classpath" ); return -1; } @@ -1286,7 +1286,6 @@ public class IPlanetEjbc }// End of EjbcException inner class - /** * This inner class is an XML document handler that can be used to parse EJB * descriptors (both the standard EJB descriptor as well as the iAS-specific @@ -1358,7 +1357,7 @@ public class IPlanetEjbc */ public EjbInfo[] getEjbs() { - return ( EjbInfo[] )ejbs.values().toArray( new EjbInfo[ejbs.size()] ); + return (EjbInfo[])ejbs.values().toArray( new EjbInfo[ ejbs.size() ] ); } /** @@ -1471,15 +1470,15 @@ public class IPlanetEjbc /* * Search the resource Map and (if not found) file Map */ - String location = ( String )resourceDtds.get( publicId ); + String location = (String)resourceDtds.get( publicId ); if( location != null ) { inputStream - = ClassLoader.getSystemResource( location ).openStream(); + = ClassLoader.getSystemResource( location ).openStream(); } else { - location = ( String )fileDtds.get( publicId ); + location = (String)fileDtds.get( publicId ); if( location != null ) { inputStream = new FileInputStream( location ); @@ -1555,7 +1554,7 @@ public class IPlanetEjbc if( currentLoc.equals( base + "\\ejb-name" ) ) { - currentEjb = ( EjbInfo )ejbs.get( value ); + currentEjb = (EjbInfo)ejbs.get( value ); if( currentEjb == null ) { currentEjb = new EjbInfo( value ); @@ -1571,7 +1570,7 @@ public class IPlanetEjbc currentEjb.setHasession( value ); } else if( currentLoc.equals( base + "\\persistence-manager" - + "\\properties-file-location" ) ) + + "\\properties-file-location" ) ) { currentEjb.addCmpDescriptor( value ); } @@ -1598,7 +1597,7 @@ public class IPlanetEjbc if( currentLoc.equals( base + "\\ejb-name" ) ) { - currentEjb = ( EjbInfo )ejbs.get( value ); + currentEjb = (EjbInfo)ejbs.get( value ); if( currentEjb == null ) { currentEjb = new EjbInfo( value ); @@ -1628,7 +1627,6 @@ public class IPlanetEjbc } }// End of Classname inner class - /** * Thread class used to redirect output from an InputStream to * the JRE standard output. This class may be used to redirect output from diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java index bc6ba5c99..57397d596 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Path; import org.xml.sax.SAXException; @@ -183,10 +184,10 @@ public class IPlanetEjbcTask extends Task /** * Does the work. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { checkConfiguration(); @@ -213,10 +214,10 @@ public class IPlanetEjbcTask extends Task * Returns a SAXParser that may be used to process the XML descriptors. * * @return Parser which may be used to process the EJB descriptors. - * @throws BuildException If the parser cannot be created or configured. + * @throws TaskException If the parser cannot be created or configured. */ private SAXParser getParser() - throws BuildException + throws TaskException { SAXParser saxParser = null; @@ -229,12 +230,12 @@ public class IPlanetEjbcTask extends Task catch( SAXException e ) { String msg = "Unable to create a SAXParser: " + e.getMessage(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } catch( ParserConfigurationException e ) { String msg = "Unable to create a SAXParser: " + e.getMessage(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } return saxParser; @@ -243,56 +244,56 @@ public class IPlanetEjbcTask extends Task /** * Verifies that the user selections are valid. * - * @throws BuildException If the user selections are invalid. + * @throws TaskException If the user selections are invalid. */ private void checkConfiguration() - throws BuildException + throws TaskException { if( ejbdescriptor == null ) { String msg = "The standard EJB descriptor must be specified using " - + "the \"ejbdescriptor\" attribute."; - throw new BuildException( msg ); + + "the \"ejbdescriptor\" attribute."; + throw new TaskException( msg ); } if( ( !ejbdescriptor.exists() ) || ( !ejbdescriptor.isFile() ) ) { String msg = "The standard EJB descriptor (" + ejbdescriptor - + ") was not found or isn't a file."; - throw new BuildException( msg ); + + ") was not found or isn't a file."; + throw new TaskException( msg ); } if( iasdescriptor == null ) { String msg = "The iAS-speific XML descriptor must be specified using" - + " the \"iasdescriptor\" attribute."; - throw new BuildException( msg ); + + " the \"iasdescriptor\" attribute."; + throw new TaskException( msg ); } if( ( !iasdescriptor.exists() ) || ( !iasdescriptor.isFile() ) ) { String msg = "The iAS-specific XML descriptor (" + iasdescriptor - + ") was not found or isn't a file."; - throw new BuildException( msg ); + + ") was not found or isn't a file."; + throw new TaskException( msg ); } if( dest == null ) { String msg = "The destination directory must be specified using " - + "the \"dest\" attribute."; - throw new BuildException( msg ); + + "the \"dest\" attribute."; + throw new TaskException( msg ); } if( ( !dest.exists() ) || ( !dest.isDirectory() ) ) { String msg = "The destination directory (" + dest + ") was not " - + "found or isn't a directory."; - throw new BuildException( msg ); + + "found or isn't a directory."; + throw new TaskException( msg ); } if( ( iashome != null ) && ( !iashome.isDirectory() ) ) { String msg = "If \"iashome\" is specified, it must be a valid " - + "directory (it was set to " + iashome + ")."; - throw new BuildException( msg ); + + "directory (it was set to " + iashome + ")."; + throw new TaskException( msg ); } } @@ -301,17 +302,17 @@ public class IPlanetEjbcTask extends Task * * @param saxParser SAXParser that may be used to process the EJB * descriptors - * @throws BuildException If there is an error reading or parsing the XML + * @throws TaskException If there is an error reading or parsing the XML * descriptors */ private void executeEjbc( SAXParser saxParser ) - throws BuildException + throws TaskException { IPlanetEjbc ejbc = new IPlanetEjbc( ejbdescriptor, - iasdescriptor, - dest, - getClasspath().toString(), - saxParser ); + iasdescriptor, + dest, + getClasspath().toString(), + saxParser ); ejbc.setRetainSource( keepgenerated ); ejbc.setDebugOutput( debug ); if( iashome != null ) @@ -326,20 +327,20 @@ public class IPlanetEjbcTask extends Task catch( IOException e ) { String msg = "An IOException occurred while trying to read the XML " - + "descriptor file: " + e.getMessage(); - throw new BuildException( msg, e ); + + "descriptor file: " + e.getMessage(); + throw new TaskException( msg, e ); } catch( SAXException e ) { String msg = "A SAXException occurred while trying to read the XML " - + "descriptor file: " + e.getMessage(); - throw new BuildException( msg, e ); + + "descriptor file: " + e.getMessage(); + throw new TaskException( msg, e ); } catch( IPlanetEjbc.EjbcException e ) { String msg = "An exception occurred while trying to run the ejbc " - + "utility: " + e.getMessage(); - throw new BuildException( msg, e ); + + "utility: " + e.getMessage(); + throw new TaskException( msg, e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java index a5a7d70f0..23442f760 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.FilenameFilter; @@ -26,7 +27,7 @@ public class InnerClassFilenameFilter implements FilenameFilter public boolean accept( File Dir, String filename ) { if( ( filename.lastIndexOf( "." ) != filename.lastIndexOf( ".class" ) ) - || ( filename.indexOf( baseClassName + "$" ) != 0 ) ) + || ( filename.indexOf( baseClassName + "$" ) != 0 ) ) { return false; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java index 06fd4ad05..6170185d0 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.util.Hashtable; import org.apache.tools.ant.Project; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java index 227763d2d..7a239fd92 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; @@ -109,7 +110,6 @@ public class WLRun extends Task this.beaHome = beaHome; } - /** * Set the classpath to be used for this execution. * @@ -171,7 +171,6 @@ public class WLRun extends Task this.pkPassword = pkpassword; } - /** * Set the management password of the server * @@ -213,7 +212,6 @@ public class WLRun extends Task this.managementUsername = username; } - public void setWeblogicMainClass( String c ) { weblogicMainClass = c; @@ -266,19 +264,19 @@ public class WLRun extends Task * avoids having to start ant with the class path of the project it is * building. * - * @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( weblogicSystemHome == null ) { - throw new BuildException( "weblogic home must be set" ); + throw new TaskException( "weblogic home must be set" ); } if( !weblogicSystemHome.isDirectory() ) { - throw new BuildException( "weblogic home directory " + weblogicSystemHome.getPath() + - " is not valid" ); + throw new TaskException( "weblogic home directory " + weblogicSystemHome.getPath() + + " is not valid" ); } if( beaHome != null ) @@ -292,6 +290,7 @@ public class WLRun extends Task } private void executeWLS() + throws TaskException { File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL51_POLICY_FILE ); File propertiesFile = null; @@ -307,13 +306,13 @@ public class WLRun extends Task propertiesFile = resolveFile( weblogicPropertiesFile ); if( !propertiesFile.exists() ) { - throw new BuildException( "Properties file " + weblogicPropertiesFile + - " not found in weblogic home " + weblogicSystemHome + - " or as absolute file" ); + throw new TaskException( "Properties file " + weblogicPropertiesFile + + " not found in weblogic home " + weblogicSystemHome + + " or as absolute file" ); } } - Java weblogicServer = ( Java )project.createTask( "java" ); + Java weblogicServer = (Java)project.createTask( "java" ); weblogicServer.setTaskName( getTaskName() ); weblogicServer.setFork( true ); weblogicServer.setClassname( weblogicMainClass ); @@ -339,7 +338,7 @@ public class WLRun extends Task } if( weblogicServer.executeJava() != 0 ) { - throw new BuildException( "Execution of weblogic server failed" ); + throw new TaskException( "Execution of weblogic server failed" ); } } @@ -348,22 +347,22 @@ public class WLRun extends Task File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL60_POLICY_FILE ); if( !beaHome.isDirectory() ) { - throw new BuildException( "BEA home " + beaHome.getPath() + - " is not valid" ); + throw new TaskException( "BEA home " + beaHome.getPath() + + " is not valid" ); } File configFile = new File( weblogicSystemHome, "config/" + weblogicDomainName + "/config.xml" ); if( !configFile.exists() ) { - throw new BuildException( "Server config file " + configFile + " not found." ); + throw new TaskException( "Server config file " + configFile + " not found." ); } if( managementPassword == null ) { - throw new BuildException( "You must supply a management password to start the server" ); + throw new TaskException( "You must supply a management password to start the server" ); } - Java weblogicServer = ( Java )project.createTask( "java" ); + Java weblogicServer = (Java)project.createTask( "java" ); weblogicServer.setTaskName( getTaskName() ); weblogicServer.setFork( true ); weblogicServer.setDir( weblogicSystemHome ); @@ -395,7 +394,7 @@ public class WLRun extends Task if( weblogicServer.executeJava() != 0 ) { - throw new BuildException( "Execution of weblogic server failed" ); + throw new TaskException( "Execution of weblogic server failed" ); } } @@ -416,8 +415,8 @@ public class WLRun extends Task // If we still can't find it, complain if( !securityPolicyFile.exists() ) { - throw new BuildException( "Security policy " + securityPolicy + - " was not found." ); + throw new TaskException( "Security policy " + securityPolicy + + " was not found." ); } return securityPolicyFile; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java index 076e057ed..f8c8d1b9b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; @@ -70,7 +71,6 @@ public class WLStop extends Task this.classpath = path; } - /** * Set the delay (in seconds) before shutting down the server. * @@ -130,22 +130,22 @@ public class WLStop extends Task * the weblogic admin task This approach allows the classpath of the helper * task to be set. * - * @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( username == null || password == null ) { - throw new BuildException( "weblogic username and password must both be set" ); + throw new TaskException( "weblogic username and password must both be set" ); } if( serverURL == null ) { - throw new BuildException( "The url of the weblogic server must be provided." ); + throw new TaskException( "The url of the weblogic server must be provided." ); } - Java weblogicAdmin = ( Java )project.createTask( "java" ); + Java weblogicAdmin = (Java)project.createTask( "java" ); weblogicAdmin.setFork( true ); weblogicAdmin.setClassname( "weblogic.Admin" ); String args; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java index 2a6ab0e07..5cd1f56b0 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java @@ -23,9 +23,9 @@ import javax.xml.parsers.SAXParserFactory; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.Project; -import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.util.FileUtils; import org.xml.sax.InputSource; public class WeblogicDeploymentTool extends GenericDeploymentTool diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java index 3fab8bd54..9918e3058 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.util.Hashtable; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool @@ -46,15 +47,15 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool /** * Called to validate that the tool parameters have been configured. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void validateConfigured() - throws BuildException + throws TaskException { super.validateConfigured(); if( toplinkDescriptor == null ) { - throw new BuildException( "The toplinkdescriptor attribute must be specified" ); + throw new TaskException( "The toplinkdescriptor attribute must be specified" ); } } @@ -64,12 +65,12 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool if( toplinkDTD != null ) { handler.registerDTD( "-//The Object People, Inc.//DTD TOPLink for WebLogic CMP 2.5.1//EN", - toplinkDTD ); + toplinkDTD ); } else { handler.registerDTD( "-//The Object People, Inc.//DTD TOPLink for WebLogic CMP 2.5.1//EN", - TL_DTD_LOC ); + TL_DTD_LOC ); } return handler; } @@ -93,12 +94,12 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool if( toplinkDD.exists() ) { ejbFiles.put( META_DIR + toplinkDescriptor, - toplinkDD ); + toplinkDD ); } else { log( "Unable to locate toplink deployment descriptor. It was expected to be in " + - toplinkDD.getPath(), Project.MSG_WARN ); + toplinkDD.getPath(), Project.MSG_WARN ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java index a84e8a330..82f7c7377 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java @@ -18,7 +18,7 @@ import java.io.OutputStreamWriter; import java.util.Hashtable; 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.taskdefs.MatchingTask; @@ -234,35 +234,35 @@ public class Translate extends MatchingTask /** * Check attributes values, load resource map and translate * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { if( bundle == null ) { - throw new BuildException( "The bundle attribute must be set." ); + throw new TaskException( "The bundle attribute must be set." ); } if( startToken == null ) { - throw new BuildException( "The starttoken attribute must be set." ); + throw new TaskException( "The starttoken attribute must be set." ); } if( startToken.length() != 1 ) { - throw new BuildException( + throw new TaskException( "The starttoken attribute must be a single character." ); } if( endToken == null ) { - throw new BuildException( "The endtoken attribute must be set." ); + throw new TaskException( "The endtoken attribute must be set." ); } if( endToken.length() != 1 ) { - throw new BuildException( + throw new TaskException( "The endtoken attribute must be a single character." ); } @@ -287,7 +287,7 @@ public class Translate extends MatchingTask if( toDir == null ) { - throw new BuildException( "The todir attribute must be set." ); + throw new TaskException( "The todir attribute must be set." ); } if( !toDir.exists() ) @@ -298,7 +298,7 @@ public class Translate extends MatchingTask { if( toDir.isFile() ) { - throw new BuildException( toDir + " is not a directory" ); + throw new TaskException( toDir + " is not a directory" ); } } @@ -327,10 +327,10 @@ public class Translate extends MatchingTask * overwritten. Bundle's encoding scheme is used. * * @param ins Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void loadResourceMap( FileInputStream ins ) - throws BuildException + throws TaskException { try { @@ -397,7 +397,7 @@ public class Translate extends MatchingTask } catch( IOException ioe ) { - throw new BuildException( ioe.getMessage() ); + throw new TaskException( ioe.getMessage() ); } } @@ -415,10 +415,10 @@ public class Translate extends MatchingTask * located, it is treated just like a properties file but with bundle * encoding also considered while loading. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void loadResourceMaps() - throws BuildException + throws TaskException { Locale locale = new Locale( bundleLanguage, bundleCountry, @@ -475,11 +475,11 @@ public class Translate extends MatchingTask * @param bundleFile Description of Parameter * @param i Description of Parameter * @param checkLoaded Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void processBundle( String bundleFile, int i, boolean checkLoaded ) - throws BuildException + throws TaskException { bundleFile += ".properties"; FileInputStream ins = null; @@ -499,7 +499,7 @@ public class Translate extends MatchingTask //find a single resrouce file, throw exception if( !loaded && checkLoaded ) { - throw new BuildException( ioe.getMessage() ); + throw new TaskException( ioe.getMessage() ); } } } @@ -514,10 +514,10 @@ public class Translate extends MatchingTask * if the source file or any associated bundle resource file is newer than * the destination file. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void translate() - throws BuildException + throws TaskException { for( int i = 0; i < filesets.size(); i++ ) { @@ -643,7 +643,7 @@ public class Translate extends MatchingTask } catch( IOException ioe ) { - throw new BuildException( ioe.getMessage() ); + throw new TaskException( ioe.getMessage() ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntTool.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntTool.java index 1526cd393..1e29f0c42 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntTool.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntTool.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import com.ibm.ivj.util.base.Project; import com.ibm.ivj.util.base.ToolData; -import org.apache.tools.ant.BuildException; - +import org.apache.myrmidon.api.TaskException; /** * This class is the equivalent to org.apache.tools.ant.Main for the VAJ tool @@ -24,7 +24,6 @@ public class VAJAntTool { private final static String TOOL_DATA_KEY = "AntTool"; - /** * Loads the BuildInfo for the specified VAJ project from the tool data for * this project. If there is no build info stored for that project, a new @@ -43,7 +42,7 @@ public class VAJAntTool if( project.testToolRepositoryData( TOOL_DATA_KEY ) ) { ToolData td = project.getToolRepositoryData( TOOL_DATA_KEY ); - String data = ( String )td.getData(); + String data = (String)td.getData(); result = VAJBuildInfo.parse( data ); } else @@ -54,13 +53,12 @@ public class VAJAntTool } catch( Throwable t ) { - throw new BuildException( "BuildInfo for Project " - + projectName + " could not be loaded" + t ); + throw new TaskException( "BuildInfo for Project " + + projectName + " could not be loaded" + t ); } return result; } - /** * Starts the application. * @@ -73,9 +71,9 @@ public class VAJAntTool try { VAJBuildInfo info; - if( args.length >= 2 && args[1] instanceof String ) + if( args.length >= 2 && args[ 1 ] instanceof String ) { - String projectName = ( String )args[1]; + String projectName = (String)args[ 1 ]; info = loadBuildData( projectName ); } else @@ -94,7 +92,6 @@ public class VAJAntTool } } - /** * Saves the BuildInfo for a project in the VAJ repository. * @@ -111,8 +108,8 @@ public class VAJAntTool } catch( Throwable t ) { - throw new BuildException( "BuildInfo for Project " - + info.getVAJProjectName() + " could not be saved", t ); + throw new TaskException( "BuildInfo for Project " + + info.getVAJProjectName() + " could not be saved", t ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java index 7aa8916e0..89a890346 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.awt.BorderLayout; import java.awt.Button; import java.awt.Choice; @@ -36,11 +37,9 @@ import java.awt.event.TextListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.beans.PropertyChangeListener; -import java.io.PrintWriter; -import java.io.StringWriter; import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.Project; import org.apache.tools.ant.util.StringUtils; @@ -182,14 +181,14 @@ public class VAJAntToolGUI extends Frame 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" ); } } @@ -1617,9 +1616,13 @@ public class VAJAntToolGUI extends Frame connectTextFieldToBuildFileName(); } - public void windowActivated( WindowEvent e ) { } + public void windowActivated( WindowEvent e ) + { + } - public void windowClosed( WindowEvent e ) { } + public void windowClosed( WindowEvent e ) + { + } /** * WindowListener methods @@ -1646,13 +1649,21 @@ public class VAJAntToolGUI extends Frame } } - public void windowDeactivated( WindowEvent e ) { } + public void windowDeactivated( WindowEvent e ) + { + } - public void windowDeiconified( WindowEvent e ) { } + public void windowDeiconified( WindowEvent e ) + { + } - public void windowIconified( WindowEvent e ) { } + public void windowIconified( WindowEvent e ) + { + } - public void windowOpened( WindowEvent e ) { } + public void windowOpened( WindowEvent e ) + { + } } /** @@ -1716,7 +1727,6 @@ public class VAJAntToolGUI extends Frame getMessageTextArea().append( lineSeparator ); } - /** * Outputs an exception. * @@ -1726,11 +1736,11 @@ public class VAJAntToolGUI extends Frame { getMessageTextArea().append( lineSeparator + "BUILD FAILED" + lineSeparator ); - if( error instanceof BuildException ) + if( error instanceof TaskException ) { getMessageTextArea().append( error.toString() ); - Throwable nested = ( ( BuildException )error ).getCause(); + Throwable nested = ( (TaskException)error ).getCause(); if( nested != null ) { nested.printStackTrace( System.err ); @@ -1767,7 +1777,9 @@ public class VAJAntToolGUI extends Frame * @param event Description of Parameter * @see BuildEvent#getException() */ - public void targetFinished( BuildEvent event ) { } + public void targetFinished( BuildEvent event ) + { + } /** * Fired when a target is started. @@ -1790,7 +1802,9 @@ public class VAJAntToolGUI extends Frame * @param event Description of Parameter * @see BuildEvent#getException() */ - public void taskFinished( BuildEvent event ) { } + public void taskFinished( BuildEvent event ) + { + } /** * Fired when a task is started. @@ -1798,6 +1812,8 @@ public class VAJAntToolGUI extends Frame * @param event Description of Parameter * @see BuildEvent#getTask() */ - public void taskStarted( BuildEvent event ) { } + public void taskStarted( BuildEvent event ) + { + } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJBuildInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJBuildInfo.java index a504426bb..4a26a2b1a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJBuildInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJBuildInfo.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.File; import java.util.Enumeration; import java.util.StringTokenizer; import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectHelper; @@ -106,7 +107,7 @@ class VAJBuildInfo implements Runnable int res = names.size(); for( int i = 0; i < names.size() && res == names.size(); i++ ) { - if( name.compareTo( ( String )names.elementAt( i ) ) < 0 ) + if( name.compareTo( (String)names.elementAt( i ) ) < 0 ) { res = i; } @@ -137,7 +138,7 @@ class VAJBuildInfo implements Runnable int oldValue = outputMessageLevel; outputMessageLevel = newOutputMessageLevel; firePropertyChange( "outputMessageLevel", - new Integer( oldValue ), new Integer( outputMessageLevel ) ); + new Integer( oldValue ), new Integer( outputMessageLevel ) ); } /** @@ -225,7 +226,6 @@ class VAJBuildInfo implements Runnable return projectInitialized; } - /** * The addPropertyChangeListener method was generated to support the * propertyChange field. @@ -247,9 +247,9 @@ class VAJBuildInfo implements Runnable public String asDataString() { String result = getOutputMessageLevel() + "|" + getBuildFileName() - + "|" + getTarget(); + + "|" + getTarget(); for( Enumeration e = getProjectTargets().elements(); - e.hasMoreElements(); ) + e.hasMoreElements(); ) { result = result + "|" + e.nextElement(); } @@ -257,7 +257,6 @@ class VAJBuildInfo implements Runnable return result; } - /** * cancels a build. */ @@ -368,7 +367,7 @@ class VAJBuildInfo implements Runnable Enumeration ptargets = project.getTargets().elements(); while( ptargets.hasMoreElements() ) { - Target currentTarget = ( Target )ptargets.nextElement(); + Target currentTarget = (Target)ptargets.nextElement(); if( currentTarget.getDescription() != null ) { String targetName = currentTarget.getName(); @@ -460,7 +459,7 @@ class VAJBuildInfo implements Runnable * * @author RT */ - public static class BuildInterruptedException extends BuildException + public static class BuildInterruptedException extends TaskException { public String toString() { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java index 4d49c923d..4b9f40cf7 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.PatternSet; /** @@ -160,24 +161,24 @@ public class VAJExport extends VAJTask /** * do the export * - * @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 destdir if( destDir == null ) { - throw new BuildException( "destdir attribute must be set!" ); + throw new TaskException( "destdir attribute must be set!" ); } // delegate the export to the VAJUtil object. getUtil().exportPackages( destDir, - patternSet.getIncludePatterns( getProject() ), - patternSet.getExcludePatterns( getProject() ), - exportClasses, exportDebugInfo, - exportResources, exportSources, - useDefaultExcludes, overwrite ); + patternSet.getIncludePatterns( getProject() ), + patternSet.getExcludePatterns( getProject() ), + exportClasses, exportDebugInfo, + exportResources, exportSources, + useDefaultExcludes, overwrite ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExportServlet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExportServlet.java index a78a51efc..310e78d6d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExportServlet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExportServlet.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.File; /** @@ -251,6 +252,6 @@ public class VAJExportServlet extends VAJToolsServlet getBooleanParam( SOURCES_PARAM, true ), getBooleanParam( DEFAULT_EXCLUDES_PARAM, true ), getBooleanParam( OVERWRITE_PARAM, true ) - ); + ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java index 36d63bbf8..a31924865 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.lang.reflect.Field; 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.types.FileSet; @@ -172,7 +173,6 @@ public class VAJImport extends VAJTask this.importSources = importSources; } - /** * The VisualAge for Java Project name to import into. * @@ -196,24 +196,24 @@ public class VAJImport extends VAJTask /** * Do the import. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { if( filesets.size() == 0 ) { - throw new BuildException( "At least one fileset is required!" ); + throw new TaskException( "At least one fileset is required!" ); } if( importProject == null || "".equals( importProject ) ) { - throw new BuildException( "The VisualAge for Java Project name is required!" ); + throw new TaskException( "The VisualAge for Java Project name is required!" ); } - for( Enumeration e = filesets.elements(); e.hasMoreElements(); ) + for( Enumeration e = filesets.elements(); e.hasMoreElements(); ) { - importFileset( ( FileSet )e.nextElement() ); + importFileset( (FileSet)e.nextElement() ); } } @@ -243,26 +243,26 @@ public class VAJImport extends VAJTask Field includesField = directoryScanner.getDeclaredField( "includes" ); includesField.setAccessible( true ); - includes = ( String[] )includesField.get( ds ); + includes = (String[])includesField.get( ds ); Field excludesField = directoryScanner.getDeclaredField( "excludes" ); excludesField.setAccessible( true ); - excludes = ( String[] )excludesField.get( ds ); + excludes = (String[])excludesField.get( ds ); } catch( NoSuchFieldException nsfe ) { - throw new BuildException( + throw new TaskException( "DirectoryScanner.includes or .excludes missing" + nsfe.getMessage() ); } catch( IllegalAccessException iae ) { - throw new BuildException( + throw new TaskException( "Access to DirectoryScanner.includes or .excludes not allowed" ); } getUtil().importFiles( importProject, ds.getBasedir(), - includes, excludes, - importClasses, importResources, importSources, - useDefaultExcludes ); + includes, excludes, + importClasses, importResources, importSources, + useDefaultExcludes ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImportServlet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImportServlet.java index 9ea01067e..d7c290b9f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImportServlet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJImportServlet.java @@ -6,8 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; -import java.io.File; +import java.io.File; /** * A Remote Access to Tools Servlet to import a Project from files into the @@ -71,8 +71,8 @@ public class VAJImportServlet extends VAJToolsServlet getBooleanParam( RESOURCES_PARAM, true ), getBooleanParam( SOURCES_PARAM, true ), false// no default excludes, because they - // are already added on client side - // getBooleanParam(DEFAULT_EXCLUDES_PARAM, true) - ); + // are already added on client side + // getBooleanParam(DEFAULT_EXCLUDES_PARAM, true) + ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java index d42912f1f..26e36d1f3 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.util.Vector; /** diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java index 86c9f8a79..d51ae1918 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java @@ -7,11 +7,6 @@ */ package org.apache.tools.ant.taskdefs.optional.ide; - - - - - /** * This is only there for backward compatibility with the default task list and * will be removed soon diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadServlet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadServlet.java index 1fca4d63d..ea8f861c4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadServlet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadServlet.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.util.Vector; /** @@ -73,8 +74,8 @@ public class VAJLoadServlet extends VAJToolsServlet for( int i = 0; i < projectNames.length && i < versionNames.length; i++ ) { VAJProjectDescription desc = new VAJProjectDescription(); - desc.setName( projectNames[i] ); - desc.setVersion( versionNames[i] ); + desc.setName( projectNames[ i ] ); + desc.setVersion( versionNames[ i ] ); projectDescriptions.addElement( desc ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java index 729090720..d5d0d29ee 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import com.ibm.ivj.util.base.ExportCodeSpec; import com.ibm.ivj.util.base.ImportCodeSpec; import com.ibm.ivj.util.base.IvjException; @@ -18,13 +19,12 @@ import com.ibm.ivj.util.base.Workspace; 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; - /** * Helper class for VAJ tasks. Holds Workspace singleton and wraps IvjExceptions - * into BuildExceptions + * into TaskExceptions * * @author Wolf Siberski, TUI Infotec GmbH */ @@ -46,7 +46,7 @@ abstract class VAJLocalUtil implements VAJUtil for( int i = 0; i < currentProjects.length; i++ ) { - Project p = currentProjects[i]; + Project p = currentProjects[ i ]; if( p.getName().equals( importProject ) ) { found = p; @@ -62,8 +62,8 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException e ) { - throw createBuildException( "Error while creating Project " - + importProject + ": ", e ); + throw createTaskException( "Error while creating Project " + + importProject + ": ", e ); } } @@ -82,9 +82,9 @@ abstract class VAJLocalUtil implements VAJUtil workspace = ToolEnv.connectToWorkspace(); if( workspace == null ) { - throw new BuildException( + throw new TaskException( "Unable to connect to Workspace! " - + "Make sure you are running in VisualAge for Java." ); + + "Make sure you are running in VisualAge for Java." ); } } @@ -92,14 +92,14 @@ abstract class VAJLocalUtil implements VAJUtil } /** - * Wraps IvjException into a BuildException + * Wraps IvjException into a TaskException * * @param errMsg Additional error message * @param e IvjException which is wrapped - * @return org.apache.tools.ant.BuildException + * @return org.apache.tools.ant.TaskException */ - static BuildException createBuildException( - String errMsg, IvjException e ) + static TaskException createTaskException( + String errMsg, IvjException e ) { errMsg = errMsg + "\n" + e.getMessage(); String[] errors = e.getErrors(); @@ -107,10 +107,10 @@ abstract class VAJLocalUtil implements VAJUtil { for( int i = 0; i < errors.length; i++ ) { - errMsg = errMsg + "\n" + errors[i]; + errMsg = errMsg + "\n" + errors[ i ]; } } - return new BuildException( errMsg, e ); + return new TaskException( errMsg, e ); } @@ -132,11 +132,11 @@ abstract class VAJLocalUtil implements VAJUtil * @param overwrite Description of Parameter */ public void exportPackages( - File dest, - String[] includePatterns, String[] excludePatterns, - boolean exportClasses, boolean exportDebugInfo, - boolean exportResources, boolean exportSources, - boolean useDefaultExcludes, boolean overwrite ) + File dest, + String[] includePatterns, String[] excludePatterns, + boolean exportClasses, boolean exportDebugInfo, + boolean exportResources, boolean exportSources, + boolean useDefaultExcludes, boolean overwrite ) { if( includePatterns == null || includePatterns.length == 0 ) { @@ -162,7 +162,7 @@ abstract class VAJLocalUtil implements VAJUtil + dest, MSG_INFO ); for( int i = 0; i < packages.length; i++ ) { - log( " " + packages[i].getName(), MSG_VERBOSE ); + log( " " + packages[ i ].getName(), MSG_VERBOSE ); } ExportCodeSpec exportSpec = new ExportCodeSpec(); @@ -179,7 +179,7 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException ex ) { - throw createBuildException( "Exporting failed!", ex ); + throw createTaskException( "Exporting failed!", ex ); } } } @@ -201,20 +201,20 @@ abstract class VAJLocalUtil implements VAJUtil * @param importResources Description of Parameter * @param importSources Description of Parameter * @param useDefaultExcludes Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void importFiles( - String importProject, File srcDir, - String[] includePatterns, String[] excludePatterns, - boolean importClasses, boolean importResources, - boolean importSources, boolean useDefaultExcludes ) - throws BuildException + String importProject, File srcDir, + String[] includePatterns, String[] excludePatterns, + boolean importClasses, boolean importResources, + boolean importSources, boolean useDefaultExcludes ) + throws TaskException { if( importProject == null || "".equals( importProject ) ) { - throw new BuildException( "The VisualAge for Java project " - + "name is required!" ); + throw new TaskException( "The VisualAge for Java project " + + "name is required!" ); } ImportCodeSpec importSpec = new ImportCodeSpec(); @@ -253,24 +253,24 @@ abstract class VAJLocalUtil implements VAJUtil Type[] importedTypes = getWorkspace().importData( importSpec ); if( importedTypes == null ) { - throw new BuildException( "Unable to import into Workspace!" ); + throw new TaskException( "Unable to import into Workspace!" ); } else { log( importedTypes.length + " types imported", MSG_DEBUG ); for( int i = 0; i < importedTypes.length; i++ ) { - log( importedTypes[i].getPackage().getName() - + "." + importedTypes[i].getName() - + " into " + importedTypes[i].getProject().getName(), - MSG_DEBUG ); + log( importedTypes[ i ].getPackage().getName() + + "." + importedTypes[ i ].getName() + + " into " + importedTypes[ i ].getProject().getName(), + MSG_DEBUG ); } } } catch( IvjException ivje ) { - throw createBuildException( "Error while importing into workspace: ", - ivje ); + throw createTaskException( "Error while importing into workspace: ", + ivje ); } } @@ -289,9 +289,9 @@ abstract class VAJLocalUtil implements VAJUtil Vector expandedDescs = getExpandedDescriptions( projectDescriptions ); // output warnings for projects not found - for( Enumeration e = projectDescriptions.elements(); e.hasMoreElements(); ) + for( Enumeration e = projectDescriptions.elements(); e.hasMoreElements(); ) { - VAJProjectDescription d = ( VAJProjectDescription )e.nextElement(); + VAJProjectDescription d = (VAJProjectDescription)e.nextElement(); if( !d.projectFound() ) { log( "No Projects match the name " + d.getName(), MSG_WARN ); @@ -302,9 +302,9 @@ abstract class VAJLocalUtil implements VAJUtil + " project(s) into workspace", MSG_INFO ); for( Enumeration e = expandedDescs.elements(); - e.hasMoreElements(); ) + e.hasMoreElements(); ) { - VAJProjectDescription d = ( VAJProjectDescription )e.nextElement(); + VAJProjectDescription d = (VAJProjectDescription)e.nextElement(); ProjectEdition pe = findProjectEdition( d.getName(), d.getVersion() ); try @@ -315,13 +315,12 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException ex ) { - throw createBuildException( "Project '" + d.getName() - + "' could not be loaded.", ex ); + throw createTaskException( "Project '" + d.getName() + + "' could not be loaded.", ex ); } } } - /** * return project descriptions containing full project names instead of * patterns with wildcards. @@ -339,15 +338,15 @@ abstract class VAJLocalUtil implements VAJUtil for( int i = 0; i < projectNames.length; i++ ) { for( Enumeration e = projectDescs.elements(); - e.hasMoreElements(); ) + e.hasMoreElements(); ) { - VAJProjectDescription d = ( VAJProjectDescription )e.nextElement(); + VAJProjectDescription d = (VAJProjectDescription)e.nextElement(); String pattern = d.getName(); - if( VAJWorkspaceScanner.match( pattern, projectNames[i] ) ) + if( VAJWorkspaceScanner.match( pattern, projectNames[ i ] ) ) { d.setProjectFound(); expandedDescs.addElement( new VAJProjectDescription( - projectNames[i], d.getVersion() ) ); + projectNames[ i ], d.getVersion() ) ); break; } } @@ -355,7 +354,7 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException e ) { - throw createBuildException( "VA Exception occured: ", e ); + throw createTaskException( "VA Exception occured: ", e ); } return expandedDescs; @@ -371,14 +370,14 @@ abstract class VAJLocalUtil implements VAJUtil * @param summaryLog buffer for logging */ private void addFilesToImport( - ImportCodeSpec spec, boolean doImport, - Vector files, String fileType, - StringBuffer summaryLog ) + ImportCodeSpec spec, boolean doImport, + Vector files, String fileType, + StringBuffer summaryLog ) { if( doImport ) { - String[] fileArr = new String[files.size()]; + String[] fileArr = new String[ files.size() ]; files.copyInto( fileArr ); try { @@ -392,7 +391,7 @@ abstract class VAJLocalUtil implements VAJUtil } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } if( files.size() > 0 ) { @@ -419,15 +418,15 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException e ) { - throw createBuildException( "VA Exception occured: ", e ); + throw createTaskException( "VA Exception occured: ", e ); } Vector matchingProjects = new Vector(); for( int i = 0; i < projectNames.length; i++ ) { - if( VAJWorkspaceScanner.match( pattern, projectNames[i] ) ) + if( VAJWorkspaceScanner.match( pattern, projectNames[ i ] ) ) { - matchingProjects.addElement( projectNames[i] ); + matchingProjects.addElement( projectNames[ i ] ); } } @@ -442,7 +441,7 @@ abstract class VAJLocalUtil implements VAJUtil * @return com.ibm.ivj.util.base.ProjectEdition the specified edition */ private ProjectEdition findProjectEdition( - String name, String versionName ) + String name, String versionName ) { try { @@ -451,27 +450,27 @@ abstract class VAJLocalUtil implements VAJUtil if( editions == null ) { - throw new BuildException( "Project " + name + " doesn't exist" ); + throw new TaskException( "Project " + name + " doesn't exist" ); } ProjectEdition pe = null; for( int i = 0; i < editions.length && pe == null; i++ ) { - if( versionName.equals( editions[i].getVersionName() ) ) + if( versionName.equals( editions[ i ].getVersionName() ) ) { - pe = editions[i]; + pe = editions[ i ]; } } if( pe == null ) { - throw new BuildException( "Version " + versionName - + " of Project " + name + " doesn't exist" ); + throw new TaskException( "Version " + versionName + + " of Project " + name + " doesn't exist" ); } return pe; } catch( IvjException e ) { - throw createBuildException( "VA Exception occured: ", e ); + throw createTaskException( "VA Exception occured: ", e ); } } @@ -485,13 +484,12 @@ abstract class VAJLocalUtil implements VAJUtil private void logFiles( Vector fileNames, String fileType ) { log( fileType + " files found for import:", MSG_VERBOSE ); - for( Enumeration e = fileNames.elements(); e.hasMoreElements(); ) + for( Enumeration e = fileNames.elements(); e.hasMoreElements(); ) { log( " " + e.nextElement(), MSG_VERBOSE ); } } - /** * Sort the files into classes, sources, and resources. * @@ -502,28 +500,27 @@ abstract class VAJLocalUtil implements VAJUtil * @param resources Description of Parameter */ private void scanForImport( - File dir, - String[] files, - Vector classes, - Vector sources, - Vector resources ) + File dir, + String[] files, + Vector classes, + Vector sources, + Vector resources ) { for( int i = 0; i < files.length; i++ ) { - String file = ( new File( dir, files[i] ) ).getAbsolutePath(); + String file = ( new File( dir, files[ i ] ) ).getAbsolutePath(); if( file.endsWith( ".java" ) || file.endsWith( ".JAVA" ) ) { sources.addElement( file ); } - else - if( file.endsWith( ".class" ) || file.endsWith( ".CLASS" ) ) + else if( file.endsWith( ".class" ) || file.endsWith( ".CLASS" ) ) { classes.addElement( file ); } else { // for resources VA expects the path relative to the resource path - resources.addElement( files[i] ); + resources.addElement( files[ i ] ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJProjectDescription.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJProjectDescription.java index 9e2105863..42da4632b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJProjectDescription.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJProjectDescription.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Type class. Holds information about a project edition. @@ -20,7 +21,9 @@ public class VAJProjectDescription private boolean projectFound; private String version; - public VAJProjectDescription() { } + public VAJProjectDescription() + { + } public VAJProjectDescription( String n, String v ) { @@ -32,7 +35,7 @@ public class VAJProjectDescription { if( newName == null || newName.equals( "" ) ) { - throw new BuildException( "name attribute must be set" ); + throw new TaskException( "name attribute must be set" ); } name = newName; } @@ -46,7 +49,7 @@ public class VAJProjectDescription { if( newVersion == null || newVersion.equals( "" ) ) { - throw new BuildException( "version attribute must be set" ); + throw new TaskException( "version attribute must be set" ); } version = newVersion; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java index 119ce308f..4288d36c9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -15,12 +16,12 @@ import java.net.HttpURLConnection; import java.net.URL; 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; /** * Helper class for VAJ tasks. Holds Workspace singleton and wraps IvjExceptions - * into BuildExceptions + * into TaskExceptions * * @author Wolf Siberski, TUI Infotec GmbH */ @@ -59,17 +60,17 @@ class VAJRemoteUtil implements VAJUtil try { String request = "http://" + remoteServer + "/servlet/vajexport?" - + VAJExportServlet.WITH_DEBUG_INFO + "=" + exportDebugInfo + "&" - + VAJExportServlet.OVERWRITE_PARAM + "=" + overwrite + "&" - + assembleImportExportParams( destDir, - includePatterns, excludePatterns, - exportClasses, exportResources, - exportSources, useDefaultExcludes ); + + VAJExportServlet.WITH_DEBUG_INFO + "=" + exportDebugInfo + "&" + + VAJExportServlet.OVERWRITE_PARAM + "=" + overwrite + "&" + + assembleImportExportParams( destDir, + includePatterns, excludePatterns, + exportClasses, exportResources, + exportSources, useDefaultExcludes ); sendRequest( request ); } catch( Exception ex ) { - throw new BuildException( "Error", ex ); + throw new TaskException( "Error", ex ); } } @@ -86,25 +87,25 @@ class VAJRemoteUtil implements VAJUtil * @param useDefaultExcludes Description of Parameter */ public void importFiles( - String importProject, File srcDir, - String[] includePatterns, String[] excludePatterns, - boolean importClasses, boolean importResources, - boolean importSources, boolean useDefaultExcludes ) + String importProject, File srcDir, + String[] includePatterns, String[] excludePatterns, + boolean importClasses, boolean importResources, + boolean importSources, boolean useDefaultExcludes ) { try { String request = "http://" + remoteServer + "/servlet/vajimport?" - + VAJImportServlet.PROJECT_NAME_PARAM + "=" - + importProject + "&" - + assembleImportExportParams( srcDir, - includePatterns, excludePatterns, - importClasses, importResources, - importSources, useDefaultExcludes ); + + VAJImportServlet.PROJECT_NAME_PARAM + "=" + + importProject + "&" + + assembleImportExportParams( srcDir, + includePatterns, excludePatterns, + importClasses, importResources, + importSources, useDefaultExcludes ); sendRequest( request ); } catch( Exception ex ) { - throw new BuildException( "Error", ex ); + throw new TaskException( "Error", ex ); } } @@ -120,14 +121,14 @@ class VAJRemoteUtil implements VAJUtil { String request = "http://" + remoteServer + "/servlet/vajload?"; String delimiter = ""; - for( Enumeration e = projectDescriptions.elements(); e.hasMoreElements(); ) + for( Enumeration e = projectDescriptions.elements(); e.hasMoreElements(); ) { - VAJProjectDescription pd = ( VAJProjectDescription )e.nextElement(); + VAJProjectDescription pd = (VAJProjectDescription)e.nextElement(); request = request - + delimiter + VAJLoadServlet.PROJECT_NAME_PARAM - + "=" + pd.getName().replace( ' ', '+' ) - + "&" + VAJLoadServlet.VERSION_PARAM - + "=" + pd.getVersion().replace( ' ', '+' ); + + delimiter + VAJLoadServlet.PROJECT_NAME_PARAM + + "=" + pd.getName().replace( ' ', '+' ) + + "&" + VAJLoadServlet.VERSION_PARAM + + "=" + pd.getVersion().replace( ' ', '+' ); //the first param needs no delimiter, but all other delimiter = "&"; } @@ -135,7 +136,7 @@ class VAJRemoteUtil implements VAJUtil } catch( Exception ex ) { - throw new BuildException( "Error", ex ); + throw new TaskException( "Error", ex ); } } @@ -164,25 +165,25 @@ class VAJRemoteUtil implements VAJUtil * @return Description of the Returned Value */ private String assembleImportExportParams( - File dir, - String[] includePatterns, String[] excludePatterns, - boolean includeClasses, boolean includeResources, - boolean includeSources, boolean useDefaultExcludes ) + File dir, + String[] includePatterns, String[] excludePatterns, + boolean includeClasses, boolean includeResources, + boolean includeSources, boolean useDefaultExcludes ) { String result = VAJToolsServlet.DIR_PARAM + "=" - + dir.getAbsolutePath().replace( '\\', '/' ) + "&" - + VAJToolsServlet.CLASSES_PARAM + "=" + includeClasses + "&" - + VAJToolsServlet.RESOURCES_PARAM + "=" + includeResources + "&" - + VAJToolsServlet.SOURCES_PARAM + "=" + includeSources + "&" - + VAJToolsServlet.DEFAULT_EXCLUDES_PARAM + "=" + useDefaultExcludes; + + dir.getAbsolutePath().replace( '\\', '/' ) + "&" + + VAJToolsServlet.CLASSES_PARAM + "=" + includeClasses + "&" + + VAJToolsServlet.RESOURCES_PARAM + "=" + includeResources + "&" + + VAJToolsServlet.SOURCES_PARAM + "=" + includeSources + "&" + + VAJToolsServlet.DEFAULT_EXCLUDES_PARAM + "=" + useDefaultExcludes; if( includePatterns != null ) { for( int i = 0; i < includePatterns.length; i++ ) { result = result + "&" + VAJExportServlet.INCLUDE_PARAM + "=" - + includePatterns[i].replace( ' ', '+' ).replace( '\\', '/' ); + + includePatterns[ i ].replace( ' ', '+' ).replace( '\\', '/' ); } } if( excludePatterns != null ) @@ -190,7 +191,7 @@ class VAJRemoteUtil implements VAJUtil for( int i = 0; i < excludePatterns.length; i++ ) { result = result + "&" + VAJExportServlet.EXCLUDE_PARAM + "=" - + excludePatterns[i].replace( ' ', '+' ).replace( '\\', '/' ); + + excludePatterns[ i ].replace( ' ', '+' ).replace( '\\', '/' ); } } @@ -212,7 +213,7 @@ class VAJRemoteUtil implements VAJUtil //must be HTTP connection URL requestUrl = new URL( request ); HttpURLConnection connection = - ( HttpURLConnection )requestUrl.openConnection(); + (HttpURLConnection)requestUrl.openConnection(); InputStream is = null; // retry three times @@ -230,7 +231,7 @@ class VAJRemoteUtil implements VAJUtil if( is == null ) { log( "Can't get " + request, MSG_ERR ); - throw new BuildException( "Couldn't execute " + request ); + throw new TaskException( "Couldn't execute " + request ); } // log the response @@ -260,11 +261,11 @@ class VAJRemoteUtil implements VAJUtil catch( IOException ex ) { log( "Error sending tool request to VAJ" + ex, MSG_ERR ); - throw new BuildException( "Couldn't execute " + request ); + throw new TaskException( "Couldn't execute " + request ); } if( requestFailed ) { - throw new BuildException( "VAJ tool request failed" ); + throw new TaskException( "VAJ tool request failed" ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java index 3c19052ec..24269204b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + /** * Super class for all VAJ tasks. Contains common attributes (remoteServer) and * util methods * * @author: Wolf Siberski */ -import org.apache.tools.ant.Task; +import org.apache.tools.ant.Task; public class VAJTask extends Task { @@ -34,7 +35,6 @@ public class VAJTask extends Task this.remoteServer = remoteServer; } - /** * returns the VAJUtil implementation * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java index c27e163b9..e5045fca8 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java @@ -6,14 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.util.StringUtils; /** @@ -63,7 +62,7 @@ public abstract class VAJToolsServlet extends HttpServlet initRequest(); executeRequest(); } - catch( BuildException e ) + catch( TaskException e ) { util.log( "Error occured: " + e.getMessage(), VAJUtil.MSG_ERR ); } @@ -71,11 +70,11 @@ public abstract class VAJToolsServlet extends HttpServlet { try { - if( !( e instanceof BuildException ) ) + if( !( e instanceof TaskException ) ) { String trace = StringUtils.getStackTrace( e ); util.log( "Program error in " + this.getClass().getName() - + ":\n" + trace, VAJUtil.MSG_ERR ); + + ":\n" + trace, VAJUtil.MSG_ERR ); } } catch( Throwable t ) @@ -84,7 +83,7 @@ public abstract class VAJToolsServlet extends HttpServlet } finally { - if( !( e instanceof BuildException ) ) + if( !( e instanceof TaskException ) ) { throw new ServletException( e.getMessage() ); } @@ -137,7 +136,7 @@ public abstract class VAJToolsServlet extends HttpServlet { return null; } - return paramValuesArray[0]; + return paramValuesArray[ 0 ]; } /** @@ -151,7 +150,6 @@ public abstract class VAJToolsServlet extends HttpServlet return request.getParameterValues( param ); } - /** * Execute the request by calling the appropriate VAJ tool API methods. This * method must be implemented by the concrete servlets @@ -219,15 +217,15 @@ public abstract class VAJToolsServlet extends HttpServlet nlPos = msg.length(); } response.getWriter().println( Integer.toString( level ) - + " " + msg.substring( i, nlPos ) ); + + " " + msg.substring( i, nlPos ) ); i = nlPos + 1; } } } catch( IOException e ) { - throw new BuildException( "logging failed. msg was: " - + e.getMessage() ); + throw new TaskException( "logging failed. msg was: " + + e.getMessage() ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java index 203b97252..5fe92868b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.File; import java.util.Vector; @@ -38,11 +39,11 @@ interface VAJUtil * @param overwrite Description of Parameter */ void exportPackages( - File dest, - String[] includePatterns, String[] excludePatterns, - boolean exportClasses, boolean exportDebugInfo, - boolean exportResources, boolean exportSources, - boolean useDefaultExcludes, boolean overwrite ); + File dest, + String[] includePatterns, String[] excludePatterns, + boolean exportClasses, boolean exportDebugInfo, + boolean exportResources, boolean exportSources, + boolean useDefaultExcludes, boolean overwrite ); /** * Do the import. @@ -57,10 +58,10 @@ interface VAJUtil * @param useDefaultExcludes Description of Parameter */ void importFiles( - String importProject, File srcDir, - String[] includePatterns, String[] excludePatterns, - boolean importClasses, boolean importResources, - boolean importSources, boolean useDefaultExcludes ); + String importProject, File srcDir, + String[] includePatterns, String[] excludePatterns, + boolean importClasses, boolean importResources, + boolean importSources, boolean useDefaultExcludes ); /** * Load specified projects. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java index 9624722af..65ca0fefc 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import com.ibm.ivj.util.base.IvjException; import com.ibm.ivj.util.base.Package; import com.ibm.ivj.util.base.Project; @@ -45,11 +46,11 @@ class VAJWorkspaceScanner extends DirectoryScanner // Patterns that should be excluded by default. private final static String[] DEFAULTEXCLUDES = { - "IBM*/**", - "Java class libraries/**", - "Sun class libraries*/**", - "JSP Page Compile Generated Code/**", - "VisualAge*/**", + "IBM*/**", + "Java class libraries/**", + "Sun class libraries*/**", + "JSP Page Compile Generated Code/**", + "VisualAge*/**", }; // The packages that where found and matched at least @@ -80,10 +81,10 @@ class VAJWorkspaceScanner extends DirectoryScanner public Package[] getIncludedPackages() { int count = packagesIncluded.size(); - Package[] packages = new Package[count]; + Package[] packages = new Package[ count ]; for( int i = 0; i < count; i++ ) { - packages[i] = ( Package )packagesIncluded.elementAt( i ); + packages[ i ] = (Package)packagesIncluded.elementAt( i ); } return packages; } @@ -95,14 +96,14 @@ class VAJWorkspaceScanner extends DirectoryScanner { int excludesLength = excludes == null ? 0 : excludes.length; String[] newExcludes; - newExcludes = new String[excludesLength + DEFAULTEXCLUDES.length]; + newExcludes = new String[ excludesLength + DEFAULTEXCLUDES.length ]; if( excludesLength > 0 ) { System.arraycopy( excludes, 0, newExcludes, 0, excludesLength ); } for( int i = 0; i < DEFAULTEXCLUDES.length; i++ ) { - newExcludes[i + excludesLength] = DEFAULTEXCLUDES[i]. + newExcludes[ i + excludesLength ] = DEFAULTEXCLUDES[ i ]. replace( '/', File.separatorChar ). replace( '\\', File.separatorChar ); } @@ -123,11 +124,11 @@ class VAJWorkspaceScanner extends DirectoryScanner boolean allProjectsMatch = false; for( int i = 0; i < projects.length; i++ ) { - Project project = projects[i]; + Project project = projects[ i ]; for( int j = 0; j < includes.length && !allProjectsMatch; j++ ) { StringTokenizer tok = - new StringTokenizer( includes[j], File.separator ); + new StringTokenizer( includes[ j ], File.separator ); String projectNamePattern = tok.nextToken(); if( projectNamePattern.equals( "**" ) ) { @@ -135,8 +136,7 @@ class VAJWorkspaceScanner extends DirectoryScanner // all projects match allProjectsMatch = true; } - else - if( match( projectNamePattern, project.getName() ) ) + else if( match( projectNamePattern, project.getName() ) ) { matchingProjects.addElement( project ); break; @@ -149,7 +149,7 @@ class VAJWorkspaceScanner extends DirectoryScanner matchingProjects = new Vector(); for( int i = 0; i < projects.length; i++ ) { - matchingProjects.addElement( projects[i] ); + matchingProjects.addElement( projects[ i ] ); } } @@ -165,19 +165,19 @@ class VAJWorkspaceScanner extends DirectoryScanner if( includes == null ) { // No includes supplied, so set it to 'matches all' - includes = new String[1]; - includes[0] = "**"; + includes = new String[ 1 ]; + includes[ 0 ] = "**"; } if( excludes == null ) { - excludes = new String[0]; + excludes = new String[ 0 ]; } // only scan projects which are included in at least one include pattern Vector matchingProjects = findMatchingProjects(); - for( Enumeration e = matchingProjects.elements(); e.hasMoreElements(); ) + for( Enumeration e = matchingProjects.elements(); e.hasMoreElements(); ) { - Project project = ( Project )e.nextElement(); + Project project = (Project)e.nextElement(); scanProject( project ); } } @@ -197,14 +197,14 @@ class VAJWorkspaceScanner extends DirectoryScanner { for( int i = 0; i < packages.length; i++ ) { - Package item = packages[i]; + Package item = packages[ i ]; // replace '.' by file seperator because the patterns are // using file seperator syntax (and we can use the match // methods this way). String name = project.getName() - + File.separator - + item.getName().replace( '.', File.separatorChar ); + + File.separator + + item.getName().replace( '.', File.separatorChar ); if( isIncluded( name ) && !isExcluded( name ) ) { packagesIncluded.addElement( item ); @@ -214,7 +214,7 @@ class VAJWorkspaceScanner extends DirectoryScanner } catch( IvjException e ) { - throw VAJLocalUtil.createBuildException( "VA Exception occured: ", e ); + throw VAJLocalUtil.createTaskException( "VA Exception occured: ", e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java index 912a18bb9..3f5e1d93f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.javacc; + import java.io.File; import java.io.IOException; import java.util.Enumeration; 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.taskdefs.Execute; @@ -58,7 +59,6 @@ public class JJTree extends Task cmdl.setClassname( "COM.sun.labs.jjtree.Main" ); } - public void setBuildnodefiles( boolean buildNodeFiles ) { optionalAttrs.put( BUILD_NODE_FILES, new Boolean( buildNodeFiles ) ); @@ -130,21 +130,21 @@ public class JJTree extends Task } public void execute() - throws BuildException + throws TaskException { // load command line with optional attributes Enumeration iter = optionalAttrs.keys(); while( iter.hasMoreElements() ) { - String name = ( String )iter.nextElement(); + String name = (String)iter.nextElement(); Object value = optionalAttrs.get( name ); cmdl.createArgument().setValue( "-" + name + ":" + value.toString() ); } if( target == null || !target.isFile() ) { - throw new BuildException( "Invalid target: " + target ); + throw new TaskException( "Invalid target: " + target ); } // use the directory containing the target as the output directory @@ -154,7 +154,7 @@ public class JJTree extends Task } if( !outputDirectory.isDirectory() ) { - throw new BuildException( "'outputdirectory' " + outputDirectory + " is not a directory." ); + throw new TaskException( "'outputdirectory' " + outputDirectory + " is not a directory." ); } // convert backslashes to slashes, otherwise jjtree will put this as // comments and this seems to confuse javacc @@ -163,7 +163,7 @@ public class JJTree extends Task String targetName = target.getName(); final File javaFile = new File( outputDirectory, - targetName.substring( 0, targetName.indexOf( ".jjt" ) ) + ".jj" ); + targetName.substring( 0, targetName.indexOf( ".jjt" ) ) + ".jj" ); if( javaFile.exists() && target.lastModified() < javaFile.lastModified() ) { project.log( "Target is already built - skipping (" + target + ")" ); @@ -173,11 +173,11 @@ public class JJTree extends Task if( javaccHome == null || !javaccHome.isDirectory() ) { - throw new BuildException( "Javacchome not set." ); + throw new TaskException( "Javacchome not set." ); } final Path classpath = cmdl.createClasspath( project ); classpath.createPathElement().setPath( javaccHome.getAbsolutePath() + - "/JavaCC.zip" ); + "/JavaCC.zip" ); classpath.addJavaRuntime(); final Commandline.Argument arg = cmdl.createVmArgument(); @@ -186,9 +186,9 @@ public class JJTree extends Task final Execute process = new Execute( new LogStreamHandler( this, - Project.MSG_INFO, - Project.MSG_INFO ), - null ); + Project.MSG_INFO, + Project.MSG_INFO ), + null ); log( cmdl.toString(), Project.MSG_VERBOSE ); process.setCommandline( cmdl.getCommandline() ); @@ -196,12 +196,12 @@ public class JJTree extends Task { if( process.execute() != 0 ) { - throw new BuildException( "JJTree failed." ); + throw new TaskException( "JJTree failed." ); } } catch( IOException e ) { - throw new BuildException( "Failed to launch JJTree: " + e ); + throw new TaskException( "Failed to launch JJTree: " + e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java index f85e9089c..8d3a2af7e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.javacc; + import java.io.File; import java.util.Enumeration; 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.taskdefs.Execute; @@ -130,7 +131,6 @@ public class JavaCC extends Task optionalAttrs.put( JAVA_UNICODE_ESCAPE, new Boolean( javaUnicodeEscape ) ); } - public void setLookahead( int lookahead ) { optionalAttrs.put( LOOKAHEAD, new Integer( lookahead ) ); @@ -182,14 +182,14 @@ public class JavaCC extends Task } public void execute() - throws BuildException + throws TaskException { // load command line with optional attributes Enumeration iter = optionalAttrs.keys(); while( iter.hasMoreElements() ) { - String name = ( String )iter.nextElement(); + String name = (String)iter.nextElement(); Object value = optionalAttrs.get( name ); cmdl.createArgument().setValue( "-" + name + ":" + value.toString() ); } @@ -197,7 +197,7 @@ public class JavaCC extends Task // check the target is a file if( target == null || !target.isFile() ) { - throw new BuildException( "Invalid target: " + target ); + throw new TaskException( "Invalid target: " + target ); } // use the directory containing the target as the output directory @@ -207,7 +207,7 @@ public class JavaCC extends Task } else if( !outputDirectory.isDirectory() ) { - throw new BuildException( "Outputdir not a directory." ); + throw new TaskException( "Outputdir not a directory." ); } cmdl.createArgument().setValue( "-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath() ); @@ -223,11 +223,11 @@ public class JavaCC extends Task if( javaccHome == null || !javaccHome.isDirectory() ) { - throw new BuildException( "Javacchome not set." ); + throw new TaskException( "Javacchome not set." ); } final Path classpath = cmdl.createClasspath( project ); classpath.createPathElement().setPath( javaccHome.getAbsolutePath() + - "/JavaCC.zip" ); + "/JavaCC.zip" ); classpath.addJavaRuntime(); final Commandline.Argument arg = cmdl.createVmArgument(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java index 2efdae7e3..a53c643ea 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jdepend; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.PathTokenizer; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; @@ -62,7 +63,9 @@ public class JDependTask extends Task // required attributes private Path _sourcesPath; - public JDependTask() { } + public JDependTask() + { + } /** * Set the classpath to be used for this compilation. @@ -113,7 +116,6 @@ public class JDependTask extends Task _fork = value; } - public void setFormat( FormatAttribute ea ) { format = ea.getValue(); @@ -237,22 +239,21 @@ public class JDependTask extends Task } public void execute() - throws BuildException + throws TaskException { CommandlineJava commandline = new CommandlineJava(); if( "text".equals( format ) ) commandline.setClassname( "jdepend.textui.JDepend" ); - else - if( "xml".equals( format ) ) + else if( "xml".equals( format ) ) commandline.setClassname( "jdepend.xmlui.JDepend" ); if( _jvm != null ) commandline.setVm( _jvm ); if( getSourcespath() == null ) - throw new BuildException( "Missing Sourcepath required argument" ); + throw new TaskException( "Missing Sourcepath required argument" ); // execute the test and get the return code int exitValue = JDependTask.ERRORS; @@ -280,7 +281,7 @@ public class JDependTask extends Task if( errorOccurred ) { if( getHaltonerror() ) - throw new BuildException( "JDepend failed" ); + throw new TaskException( "JDepend failed" ); else log( "JDepend FAILED", Project.MSG_ERR ); } @@ -297,11 +298,11 @@ public class JDependTask extends Task * case the test could probably hang forever. * @param commandline Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ // JL: comment extracted from JUnitTask (and slightly modified) public int executeAsForked( CommandlineJava commandline, ExecuteWatchdog watchdog ) - throws BuildException + throws TaskException { // if not set, auto-create the ClassPath from the project createClasspath(); @@ -330,7 +331,7 @@ public class JDependTask extends Task // not necessary as JDepend would fail, but why loose some time? if( !f.exists() || !f.isDirectory() ) - throw new BuildException( "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail." ); + throw new TaskException( "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail." ); commandline.createArgument().setValue( f.getPath() ); } @@ -351,7 +352,7 @@ public class JDependTask extends Task } catch( IOException e ) { - throw new BuildException( "Process fork failed.", e ); + throw new TaskException( "Process fork failed.", e ); } } @@ -366,10 +367,10 @@ public class JDependTask extends Task * * @param commandline Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public int executeInVM( CommandlineJava commandline ) - throws BuildException + throws TaskException { jdepend.textui.JDepend jdepend; @@ -389,7 +390,7 @@ public class JDependTask extends Task { String msg = "JDepend Failed when creating the output file: " + e.getMessage(); log( msg ); - throw new BuildException( msg ); + throw new TaskException( msg ); } jdepend.setWriter( new PrintWriter( fw ) ); log( "Output to be stored in " + getOutputFile().getPath() ); @@ -405,7 +406,7 @@ public class JDependTask extends Task { String msg = "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail."; log( msg ); - throw new BuildException( msg ); + throw new TaskException( msg ); } try { @@ -415,7 +416,7 @@ public class JDependTask extends Task { String msg = "JDepend Failed when adding a source directory: " + e.getMessage(); log( msg ); - throw new BuildException( msg ); + throw new TaskException( msg ); } } jdepend.analyze(); @@ -425,10 +426,10 @@ public class JDependTask extends Task /** * @return null if there is a timeout value, otherwise the watchdog * instance. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected ExecuteWatchdog createWatchdog() - throws BuildException + throws TaskException { return null; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java index b1a089810..59c9cfa84 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jlink; + import java.io.DataInput; import java.io.DataInputStream; import java.io.IOException; @@ -37,8 +38,8 @@ public class ClassNameReader extends Object // read access flags and class index. int accessFlags = data.readUnsignedShort(); int classIndex = data.readUnsignedShort(); - Integer stringIndex = ( Integer )values[classIndex]; - String className = ( String )values[stringIndex.intValue()]; + Integer stringIndex = (Integer)values[ classIndex ]; + String className = (String)values[ stringIndex.intValue() ]; return className; } @@ -55,10 +56,9 @@ public class ClassNameReader extends Object class ConstantPool extends Object { - final static byte UTF8 = 1, UNUSED = 2, INTEGER = 3, FLOAT = 4, LONG = 5, DOUBLE = 6, - CLASS = 7, STRING = 8, FIELDREF = 9, METHODREF = 10, - INTERFACEMETHODREF = 11, NAMEANDTYPE = 12; + CLASS = 7, STRING = 8, FIELDREF = 9, METHODREF = 10, + INTERFACEMETHODREF = 11, NAMEANDTYPE = 12; byte[] types; @@ -70,44 +70,44 @@ class ConstantPool extends Object super(); int count = data.readUnsignedShort(); - types = new byte[count]; - values = new Object[count]; + types = new byte[ count ]; + values = new Object[ count ]; // read in all constant pool entries. for( int i = 1; i < count; i++ ) { byte type = data.readByte(); - types[i] = type; - switch ( type ) + types[ i ] = type; + switch( type ) { - case UTF8: - values[i] = data.readUTF(); - break; - case UNUSED: - break; - case INTEGER: - values[i] = new Integer( data.readInt() ); - break; - case FLOAT: - values[i] = new Float( data.readFloat() ); - break; - case LONG: - values[i] = new Long( data.readLong() ); - ++i; - break; - case DOUBLE: - values[i] = new Double( data.readDouble() ); - ++i; - break; - case CLASS: - case STRING: - values[i] = new Integer( data.readUnsignedShort() ); - break; - case FIELDREF: - case METHODREF: - case INTERFACEMETHODREF: - case NAMEANDTYPE: - values[i] = new Integer( data.readInt() ); - break; + case UTF8: + values[ i ] = data.readUTF(); + break; + case UNUSED: + break; + case INTEGER: + values[ i ] = new Integer( data.readInt() ); + break; + case FLOAT: + values[ i ] = new Float( data.readFloat() ); + break; + case LONG: + values[ i ] = new Long( data.readLong() ); + ++i; + break; + case DOUBLE: + values[ i ] = new Double( data.readDouble() ); + ++i; + break; + case CLASS: + case STRING: + values[ i ] = new Integer( data.readUnsignedShort() ); + break; + case FIELDREF: + case METHODREF: + case INTERFACEMETHODREF: + case NAMEANDTYPE: + values[ i ] = new Integer( data.readInt() ); + break; } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java index a053c2111..4261a067f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jlink; + 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.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; @@ -138,19 +139,19 @@ public class JlinkTask extends MatchingTask /** * Does the adding and merging. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { //Be sure everything has been set. if( outfile == null ) { - throw new BuildException( "outfile attribute is required! Please set." ); + throw new TaskException( "outfile attribute is required! Please set." ); } if( !haveAddFiles() && !haveMergeFiles() ) { - throw new BuildException( "addfiles or mergefiles required! Please set." ); + throw new TaskException( "addfiles or mergefiles required! Please set." ); } log( "linking: " + outfile.getPath() ); log( "compression: " + compress, Project.MSG_VERBOSE ); @@ -173,7 +174,7 @@ public class JlinkTask extends MatchingTask } catch( Exception ex ) { - throw new BuildException( "Error", ex); + throw new TaskException( "Error", ex ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java index cb9a3fbe8..1c8c015af 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jlink; + import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -32,7 +33,7 @@ public class jlink extends Object private boolean compression = false; - byte[] buffer = new byte[8192]; + byte[] buffer = new byte[ 8192 ]; public static void main( String[] args ) { @@ -43,11 +44,11 @@ public class jlink extends Object System.exit( 1 ); } jlink linker = new jlink(); - linker.setOutfile( args[0] ); + linker.setOutfile( args[ 0 ] ); //To maintain compatibility with the command-line version, we will only add files to be merged. for( int i = 1; i < args.length; i++ ) { - linker.addMergeFile( args[i] ); + linker.addMergeFile( args[ i ] ); } try { @@ -110,7 +111,7 @@ public class jlink extends Object } for( int i = 0; i < addfiles.length; i++ ) { - addAddFile( addfiles[i] ); + addAddFile( addfiles[ i ] ); } } @@ -141,7 +142,7 @@ public class jlink extends Object } for( int i = 0; i < mergefiles.length; i++ ) { - addMergeFile( mergefiles[i] ); + addMergeFile( mergefiles[ i ] ); } } @@ -174,7 +175,7 @@ public class jlink extends Object Enumeration merges = mergefiles.elements(); while( merges.hasMoreElements() ) { - String path = ( String )merges.nextElement(); + String path = (String)merges.nextElement(); File f = new File( path ); if( f.getName().endsWith( ".jar" ) || f.getName().endsWith( ".zip" ) ) { @@ -191,7 +192,7 @@ public class jlink extends Object Enumeration adds = addfiles.elements(); while( adds.hasMoreElements() ) { - String name = ( String )adds.nextElement(); + String name = (String)adds.nextElement(); File f = new File( name ); if( f.isDirectory() ) { @@ -210,7 +211,8 @@ public class jlink extends Object output.close(); } catch( IOException ioe ) - {} + { + } } } @@ -236,7 +238,8 @@ public class jlink extends Object } } catch( IOException ioe ) - {} + { + } } System.out.println( "From " + file.getPath() + " and prefix " + prefix + ", creating entry " + prefix + name ); return ( prefix + name ); @@ -251,7 +254,7 @@ public class jlink extends Object String[] contents = dir.list(); for( int i = 0; i < contents.length; ++i ) { - String name = contents[i]; + String name = contents[ i ]; File file = new File( dir, name ); if( file.isDirectory() ) { @@ -359,7 +362,7 @@ public class jlink extends Object Enumeration entries = zipf.entries(); while( entries.hasMoreElements() ) { - ZipEntry inputEntry = ( ZipEntry )entries.nextElement(); + ZipEntry inputEntry = (ZipEntry)entries.nextElement(); //Ignore manifest entries. They're bound to cause conflicts between //files that are being merged. User should supply their own //manifest file when doing the merge. @@ -439,7 +442,8 @@ public class jlink extends Object } } catch( IOException ioe ) - {} + { + } } ZipEntry outputEntry = new ZipEntry( name ); outputEntry.setTime( inputEntry.getTime() ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index ae6938f5a..3ed023fae 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp; + import java.io.File; import java.util.Date; 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; @@ -63,7 +64,7 @@ public class JspC extends MatchingTask { private final static String FAIL_MSG - = "Compile failed, messages should have been provided."; + = "Compile failed, messages should have been provided."; private int verbose = 0; protected Vector compileList = new Vector(); protected boolean failOnError = true; @@ -135,7 +136,7 @@ public class JspC extends MatchingTask * ------------------------------------------------------------ */ /** - * Throw a BuildException if compilation fails + * Throw a TaskException if compilation fails * * @param fail The new Failonerror value */ @@ -318,24 +319,24 @@ public class JspC extends MatchingTask * ------------------------------------------------------------ */ 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" ); + TaskException( "destination directory \"" + destDir + + "\" does not exist or is not a directory" ); } // calculate where the files will end up: @@ -355,11 +356,11 @@ public class JspC extends MatchingTask int filecount = 0; for( int i = 0; i < list.length; i++ ) { - File srcDir = ( File )resolveFile( list[i] ); + 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 ); @@ -384,7 +385,7 @@ public class JspC extends MatchingTask CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( compiler, this ); log( "Compiling " + compileList.size() + - " source file" + " source file" + ( compileList.size() == 1 ? "" : "s" ) + ( destDir != null ? " to " + destDir : "" ) ); @@ -396,7 +397,7 @@ public class JspC extends MatchingTask { if( failOnError ) { - throw new BuildException( FAIL_MSG ); + throw new TaskException( FAIL_MSG ); } else { @@ -446,19 +447,19 @@ public class JspC extends MatchingTask for( int i = 0; i < files.length; i++ ) { - File srcFile = new File( srcDir, files[i] ); - if( files[i].endsWith( ".jsp" ) ) + File srcFile = new File( srcDir, files[ i ] ); + if( files[ i ].endsWith( ".jsp" ) ) { // drop leading path (if any) int fileStart = - files[i].lastIndexOf( File.separatorChar ) + 1; - File javaFile = new File( destDir, files[i].substring( fileStart, - files[i].indexOf( ".jsp" ) ) + ".java" ); + files[ i ].lastIndexOf( File.separatorChar ) + 1; + File javaFile = new File( destDir, files[ i ].substring( fileStart, + files[ i ].indexOf( ".jsp" ) ) + ".java" ); if( srcFile.lastModified() > now ) { log( "Warning: file modified in the future: " + - files[i], Project.MSG_WARN ); + files[ i ], Project.MSG_WARN ); } if( !javaFile.exists() || @@ -467,14 +468,14 @@ public class JspC extends MatchingTask if( !javaFile.exists() ) { log( "Compiling " + srcFile.getPath() + - " because java file " + " because java file " + javaFile.getPath() + " does not exist", - Project.MSG_DEBUG ); + Project.MSG_DEBUG ); } else { log( "Compiling " + srcFile.getPath() + - " because it is out of date with respect to " + " because it is out of date with respect to " + javaFile.getPath(), Project.MSG_DEBUG ); } compileList.addElement( srcFile.getAbsolutePath() ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java index 0c8e43a4b..0a9a1b07b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp;//java imports + import java.io.File; import java.util.Date; 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.DirectoryScanner; import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Java;//apache/ant imports +import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; @@ -67,7 +68,6 @@ public class WLJspc extends MatchingTask private String destinationPackage;//root of compiled files tree private File sourceDirectory; - /** * Set the classpath to be used for this compilation. * @@ -133,23 +133,23 @@ public class WLJspc extends MatchingTask } public void execute() - throws BuildException + throws TaskException { if( !destinationDirectory.isDirectory() ) { - throw new BuildException( "destination directory " + destinationDirectory.getPath() + - " is not valid" ); + throw new TaskException( "destination directory " + destinationDirectory.getPath() + + " is not valid" ); } if( !sourceDirectory.isDirectory() ) { - throw new BuildException( "src directory " + sourceDirectory.getPath() + - " is not valid" ); + throw new TaskException( "src directory " + sourceDirectory.getPath() + + " is not valid" ); } if( destinationPackage == null ) { - throw new BuildException( "package attribute must be present." ); + throw new TaskException( "package attribute must be present." ); } String systemClassPath = System.getProperty( "java.class.path" ); @@ -171,31 +171,31 @@ public class WLJspc extends MatchingTask // Therefore, takes loads of time // Can pass directories at a time (*.jsp) but easily runs out of memory on hefty dirs // (even on a Sun) - Java helperTask = ( Java )project.createTask( "java" ); + Java helperTask = (Java)project.createTask( "java" ); helperTask.setFork( true ); helperTask.setClassname( "weblogic.jspc" ); helperTask.setTaskName( getTaskName() ); - String[] args = new String[12]; + String[] args = new String[ 12 ]; File jspFile = null; String parents = ""; String arg = ""; int j = 0; //XXX this array stuff is a remnant of prev trials.. gotta remove. - args[j++] = "-d"; - args[j++] = destinationDirectory.getAbsolutePath().trim(); - args[j++] = "-docroot"; - args[j++] = sourceDirectory.getAbsolutePath().trim(); - args[j++] = "-keepgenerated";//TODO: Parameterise ?? + args[ j++ ] = "-d"; + args[ j++ ] = destinationDirectory.getAbsolutePath().trim(); + args[ j++ ] = "-docroot"; + args[ j++ ] = sourceDirectory.getAbsolutePath().trim(); + args[ j++ ] = "-keepgenerated";//TODO: Parameterise ?? //Call compiler as class... dont want to fork again //Use classic compiler -- can be parameterised? - args[j++] = "-compilerclass"; - args[j++] = "sun.tools.javac.Main"; + args[ j++ ] = "-compilerclass"; + args[ j++ ] = "sun.tools.javac.Main"; //Weblogic jspc does not seem to work unless u explicitly set this... // Does not take the classpath from the env.... // Am i missing something about the Java task?? - args[j++] = "-classpath"; - args[j++] = compileClasspath.toString(); + args[ j++ ] = "-classpath"; + args[ j++ ] = compileClasspath.toString(); this.scanDir( files ); log( "Compiling " + filesToDo.size() + " JSP files" ); @@ -206,25 +206,25 @@ public class WLJspc extends MatchingTask // All this to get package according to weblogic standards // Can be written better... this is too hacky! // Careful.. similar code in scanDir , but slightly different!! - jspFile = new File( ( String )filesToDo.elementAt( i ) ); - args[j] = "-package"; + jspFile = new File( (String)filesToDo.elementAt( i ) ); + args[ j ] = "-package"; parents = jspFile.getParent(); if( ( parents != null ) && ( !( "" ).equals( parents ) ) ) { parents = this.replaceString( parents, File.separator, "_." ); - args[j + 1] = destinationPackage + "." + "_" + parents; + args[ j + 1 ] = destinationPackage + "." + "_" + parents; } else { - args[j + 1] = destinationPackage; + args[ j + 1 ] = destinationPackage; } - args[j + 2] = sourceDirectory + File.separator + ( String )filesToDo.elementAt( i ); + args[ j + 2 ] = sourceDirectory + File.separator + (String)filesToDo.elementAt( i ); arg = ""; for( int x = 0; x < 12; x++ ) { - arg += " " + args[x]; + arg += " " + args[ x ]; } System.out.println( "arg = " + arg ); @@ -234,12 +234,11 @@ public class WLJspc extends MatchingTask helperTask.setClasspath( compileClasspath ); if( helperTask.executeJava() != 0 ) { - log( files[i] + " failed to compile", Project.MSG_WARN ); + log( files[ i ] + " failed to compile", Project.MSG_WARN ); } } } - protected String replaceString( String inpString, String escapeChars, String replaceChars ) { String localString = ""; @@ -255,7 +254,6 @@ public class WLJspc extends MatchingTask return localString; } - protected void scanDir( String files[] ) { @@ -265,11 +263,11 @@ public class WLJspc extends MatchingTask String pack = ""; for( int i = 0; i < files.length; i++ ) { - File srcFile = new File( this.sourceDirectory, files[i] ); + File srcFile = new File( this.sourceDirectory, files[ i ] ); //XXX // All this to convert source to destination directory according to weblogic standards // Can be written better... this is too hacky! - jspFile = new File( files[i] ); + jspFile = new File( files[ i ] ); parents = jspFile.getParent(); int loc = 0; @@ -285,27 +283,27 @@ public class WLJspc extends MatchingTask String filePath = pack + File.separator + "_"; int startingIndex - = files[i].lastIndexOf( File.separator ) != -1 ? files[i].lastIndexOf( File.separator ) + 1 : 0; - int endingIndex = files[i].indexOf( ".jsp" ); + = files[ i ].lastIndexOf( File.separator ) != -1 ? files[ i ].lastIndexOf( File.separator ) + 1 : 0; + int endingIndex = files[ i ].indexOf( ".jsp" ); if( endingIndex == -1 ) { break; } - filePath += files[i].substring( startingIndex, endingIndex ); + filePath += files[ i ].substring( startingIndex, endingIndex ); filePath += ".class"; File classFile = new File( this.destinationDirectory, filePath ); if( srcFile.lastModified() > now ) { log( "Warning: file modified in the future: " + - files[i], Project.MSG_WARN ); + files[ i ], Project.MSG_WARN ); } if( srcFile.lastModified() > classFile.lastModified() ) { //log("Files are" + srcFile.getAbsolutePath()+" " +classFile.getAbsolutePath()); - filesToDo.addElement( files[i] ); - log( "Recompiling File " + files[i], Project.MSG_VERBOSE ); + filesToDo.addElement( files[ i ] ); + log( "Recompiling File " + files[ i ], Project.MSG_VERBOSE ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java index 62465e8d8..4365df9d6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.taskdefs.optional.jsp.JspC; /** @@ -37,8 +38,8 @@ public interface CompilerAdapter * Executes the task. * * @return has the compilation been successful - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean execute() - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java index 2e648a5ac..c090879db 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java @@ -6,9 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; +import org.apache.myrmidon.api.TaskException; +import org.apache.tools.ant.Task; /** * Creates the necessary compiler adapter, given basic criteria. @@ -22,7 +22,9 @@ public class CompilerAdapterFactory /** * This is a singlton -- can't create instances!! */ - private CompilerAdapterFactory() { } + private CompilerAdapterFactory() + { + } /** * Based on the parameter passed in, this method creates the necessary @@ -39,11 +41,11 @@ public class CompilerAdapterFactory * classname of the compiler's adapter. * @param task a task to log through. * @return The Compiler value - * @throws BuildException if the compiler type could not be resolved into a + * @throws TaskException if the compiler type could not be resolved into a * compiler adapter. */ public static CompilerAdapter getCompiler( String compilerType, Task task ) - throws BuildException + throws TaskException { /* * If I've done things right, this should be the extent of the @@ -62,32 +64,32 @@ public class CompilerAdapterFactory * * @param className The fully qualified classname to be created. * @return Description of the Returned Value - * @throws BuildException This is the fit that is thrown if className isn't + * @throws TaskException This is the fit that is thrown if className isn't * an instance of CompilerAdapter. */ private static CompilerAdapter resolveClassName( String className ) - throws BuildException + throws TaskException { try { Class c = Class.forName( className ); Object o = c.newInstance(); - return ( CompilerAdapter )o; + return (CompilerAdapter)o; } catch( ClassNotFoundException cnfe ) { - throw new BuildException( className + " can\'t be found.", cnfe ); + throw new TaskException( className + " can\'t be found.", cnfe ); } catch( ClassCastException cce ) { - throw new BuildException( className + " isn\'t the classname of " - + "a compiler adapter.", cce ); + throw new TaskException( className + " isn\'t the classname of " + + "a compiler adapter.", cce ); } catch( Throwable t ) { // for all other possibilities - throw new BuildException( className + " caused an interesting " - + "exception.", t ); + throw new TaskException( className + " caused an interesting " + + "exception.", t ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java index 6c54419d4..704ee79af 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; + import java.util.Enumeration; import java.util.Vector; import org.apache.tools.ant.Project; @@ -19,7 +20,7 @@ import org.apache.tools.ant.types.Commandline; * @author Matthew Watson mattw@i3sp.com */ public abstract class DefaultCompilerAdapter - implements CompilerAdapter + implements CompilerAdapter { /* * ------------------------------------------------------------ @@ -69,7 +70,7 @@ public abstract class DefaultCompilerAdapter Enumeration enum = compileList.elements(); while( enum.hasMoreElements() ) { - String arg = ( String )enum.nextElement(); + String arg = (String)enum.nextElement(); cmd.createArgument().setValue( arg ); niceSourceList.append( " " + arg + lSep ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java index bd169b9f6..a711952f4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.optional.jsp.JspC; @@ -24,7 +25,7 @@ public class JasperC extends DefaultCompilerAdapter * ------------------------------------------------------------ */ public boolean execute() - throws BuildException + throws TaskException { getJspc().log( "Using jasper compiler", Project.MSG_VERBOSE ); Commandline cmd = setupJasperCommand(); @@ -33,27 +34,27 @@ public class JasperC extends DefaultCompilerAdapter { // Create an instance of the compiler, redirecting output to // the project log - Java java = ( Java )( getJspc().getProject() ).createTask( "java" ); + Java java = (Java)( getJspc().getProject() ).createTask( "java" ); if( getJspc().getClasspath() != null ) java.setClasspath( getJspc().getClasspath() ); java.setClassname( "org.apache.jasper.JspC" ); String args[] = cmd.getArguments(); for( int i = 0; i < args.length; i++ ) - java.createArg().setValue( args[i] ); + java.createArg().setValue( args[ i ] ); java.setFailonerror( true ); java.execute(); return true; } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error running jsp compiler: ", - ex ); + throw new TaskException( "Error running jsp compiler: ", + ex ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java index 123c51854..4951c172a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -14,17 +15,14 @@ import java.io.InputStream; import java.net.URL; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -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.util.FileUtils; import org.apache.tools.ant.types.EnumeratedAttribute; +import org.apache.tools.ant.util.FileUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; - - - /** * Transform a JUnit xml report. The default transformation generates an html * report in either framed or non-framed style. The non-framed style is @@ -121,7 +119,7 @@ public class AggregateTransformer } public void transform() - throws BuildException + throws TaskException { checkOptions(); final long t0 = System.currentTimeMillis(); @@ -133,7 +131,7 @@ public class AggregateTransformer } catch( Exception e ) { - throw new BuildException( "Errors while applying transformations", e ); + throw new TaskException( "Errors while applying transformations", e ); } final long dt = System.currentTimeMillis() - t0; task.log( "Transform time: " + dt + "ms" ); @@ -144,10 +142,10 @@ public class AggregateTransformer * file directly. Much more for testing purposes. * * @param xmlfile xml file to be processed - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void setXmlfile( File xmlfile ) - throws BuildException + throws TaskException { try { @@ -165,7 +163,7 @@ public class AggregateTransformer } catch( Exception e ) { - throw new BuildException( "Error while parsing document: " + xmlfile, e ); + throw new TaskException( "Error while parsing document: " + xmlfile, e ); } } @@ -209,10 +207,10 @@ public class AggregateTransformer /** * check for invalid options * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { // set the destination directory relative from the project if needed. if( toDir == null ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java index b2173d3e8..91ff9de58 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.util.Vector; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java index 115e2c1a3..28e5d24eb 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.util.Enumeration; import java.util.Vector; @@ -103,7 +104,7 @@ public final class BatchTest extends BaseTest v.ensureCapacity( v.size() + tests.length ); for( int i = 0; i < tests.length; i++ ) { - v.addElement( tests[i] ); + v.addElement( tests[ i ] ); } } @@ -125,13 +126,13 @@ public final class BatchTest extends BaseTest final int size = this.filesets.size(); for( int j = 0; j < size; j++ ) { - FileSet fs = ( FileSet )filesets.elementAt( j ); + FileSet fs = (FileSet)filesets.elementAt( j ); DirectoryScanner ds = fs.getDirectoryScanner( project ); ds.scan(); String[] f = ds.getIncludedFiles(); for( int k = 0; k < f.length; k++ ) { - String pathname = f[k]; + String pathname = f[ k ]; if( pathname.endsWith( ".java" ) ) { v.addElement( pathname.substring( 0, pathname.length() - ".java".length() ) ); @@ -143,7 +144,7 @@ public final class BatchTest extends BaseTest } } - String[] files = new String[v.size()]; + String[] files = new String[ v.size() ]; v.copyInto( files ); return files; } @@ -157,11 +158,11 @@ public final class BatchTest extends BaseTest private JUnitTest[] createAllJUnitTest() { String[] filenames = getFilenames(); - JUnitTest[] tests = new JUnitTest[filenames.length]; + JUnitTest[] tests = new JUnitTest[ filenames.length ]; for( int i = 0; i < tests.length; i++ ) { - String classname = javaToClass( filenames[i] ); - tests[i] = createJUnitTest( classname ); + String classname = javaToClass( filenames[ i ] ); + tests[ i ] = createJUnitTest( classname ); } return tests; } @@ -190,7 +191,7 @@ public final class BatchTest extends BaseTest Enumeration list = this.formatters.elements(); while( list.hasMoreElements() ) { - test.addFormatter( ( FormatterElement )list.nextElement() ); + test.addFormatter( (FormatterElement)list.nextElement() ); } return test; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java index 81ee9ac8f..f23e5bf99 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import junit.framework.AssertionFailedError; import junit.framework.Test; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Prints plain text output of the test to a specified Writer. Inspired by the @@ -117,7 +118,7 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } /** @@ -125,16 +126,18 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter * * @param test Description of Parameter */ - public void endTest( Test test ) { } + public void endTest( Test test ) + { + } /** * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void endTestSuite( JUnitTest suite ) - throws BuildException + throws TaskException { String newLine = System.getProperty( "line.separator" ); StringBuffer sb = new StringBuffer( "Testsuite: " ); @@ -182,15 +185,16 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter } finally { - if( m_out != ( Object )System.out && - m_out != ( Object )System.err ) + if( m_out != (Object)System.out && + m_out != (Object)System.err ) { try { m_out.close(); } catch( java.io.IOException e ) - {} + { + } } } } @@ -201,16 +205,20 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter * * @param test Description of Parameter */ - public void startTest( Test test ) { } + public void startTest( Test test ) + { + } /** * The whole testsuite started. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void startTestSuite( JUnitTest suite ) - throws BuildException { } + throws TaskException + { + } /** * Format an error and print it. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java index 3fab8d7be..49ff9e78f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.util.Vector; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; @@ -30,8 +31,9 @@ public final class DOMUtil /** * unused constructor */ - private DOMUtil() { } - + private DOMUtil() + { + } /** * Iterate over the children of a given node and return the first node that @@ -58,7 +60,7 @@ public final class DOMUtil if( child != null && child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals( tagname ) ) { - return ( Element )child; + return (Element)child; } } return null; @@ -77,7 +79,7 @@ public final class DOMUtil { if( node instanceof Element ) { - Element element = ( Element )node; + Element element = (Element)node; return element.getAttribute( name ); } return null; @@ -101,44 +103,44 @@ public final class DOMUtil Node copy = null; final Document doc = parent.getOwnerDocument(); - switch ( child.getNodeType() ) + switch( child.getNodeType() ) { - case Node.CDATA_SECTION_NODE: - copy = doc.createCDATASection( ( ( CDATASection )child ).getData() ); - break; - case Node.COMMENT_NODE: - copy = doc.createComment( ( ( Comment )child ).getData() ); - break; - case Node.DOCUMENT_FRAGMENT_NODE: - copy = doc.createDocumentFragment(); - break; - case Node.ELEMENT_NODE: - final Element elem = doc.createElement( ( ( Element )child ).getTagName() ); - copy = elem; - final NamedNodeMap attributes = child.getAttributes(); - if( attributes != null ) - { - final int size = attributes.getLength(); - for( int i = 0; i < size; i++ ) + case Node.CDATA_SECTION_NODE: + copy = doc.createCDATASection( ( (CDATASection)child ).getData() ); + break; + case Node.COMMENT_NODE: + copy = doc.createComment( ( (Comment)child ).getData() ); + break; + case Node.DOCUMENT_FRAGMENT_NODE: + copy = doc.createDocumentFragment(); + break; + case Node.ELEMENT_NODE: + final Element elem = doc.createElement( ( (Element)child ).getTagName() ); + copy = elem; + final NamedNodeMap attributes = child.getAttributes(); + if( attributes != null ) { - final Attr attr = ( Attr )attributes.item( i ); - elem.setAttribute( attr.getName(), attr.getValue() ); + final int size = attributes.getLength(); + for( int i = 0; i < size; i++ ) + { + final Attr attr = (Attr)attributes.item( i ); + elem.setAttribute( attr.getName(), attr.getValue() ); + } } - } - break; - case Node.ENTITY_REFERENCE_NODE: - copy = doc.createEntityReference( child.getNodeName() ); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - final ProcessingInstruction pi = ( ProcessingInstruction )child; - copy = doc.createProcessingInstruction( pi.getTarget(), pi.getData() ); - break; - case Node.TEXT_NODE: - copy = doc.createTextNode( ( ( Text )child ).getData() ); - break; - default: - // this should never happen - throw new IllegalStateException( "Invalid node type: " + child.getNodeType() ); + break; + case Node.ENTITY_REFERENCE_NODE: + copy = doc.createEntityReference( child.getNodeName() ); + break; + case Node.PROCESSING_INSTRUCTION_NODE: + final ProcessingInstruction pi = (ProcessingInstruction)child; + copy = doc.createProcessingInstruction( pi.getTarget(), pi.getData() ); + break; + case Node.TEXT_NODE: + copy = doc.createTextNode( ( (Text)child ).getData() ); + break; + default: + // this should never happen + throw new IllegalStateException( "Invalid node type: " + child.getNodeType() ); } // okay we have a copy of the child, now the child becomes the parent @@ -238,7 +240,7 @@ public final class DOMUtil { try { - return ( Node )elementAt( i ); + return (Node)elementAt( i ); } catch( ArrayIndexOutOfBoundsException e ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java index bc75a4e5a..b06f5afe2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.util.Enumeration; import java.util.NoSuchElementException; @@ -18,7 +19,9 @@ import java.util.NoSuchElementException; public final class Enumerations { - private Enumerations() { } + private Enumerations() + { + } /** * creates an enumeration from an array of objects. @@ -46,7 +49,6 @@ public final class Enumerations } - /** * Convenient enumeration over an array of objects. * @@ -99,7 +101,7 @@ class ArrayEnumeration implements Enumeration { if( hasMoreElements() ) { - Object o = array[pos]; + Object o = array[ pos ]; pos++; return o; } @@ -162,7 +164,7 @@ class CompoundEnumeration implements Enumeration { while( index < enumArray.length ) { - if( enumArray[index] != null && enumArray[index].hasMoreElements() ) + if( enumArray[ index ] != null && enumArray[ index ].hasMoreElements() ) { return true; } @@ -183,7 +185,7 @@ class CompoundEnumeration implements Enumeration { if( hasMoreElements() ) { - return enumArray[index].nextElement(); + return enumArray[ index ].nextElement(); } throw new NoSuchElementException(); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java index 5bc2dc3a9..52e680fe6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.EnumeratedAttribute; /** @@ -171,11 +172,11 @@ public class FormatterElement } JUnitResultFormatter createFormatter() - throws BuildException + throws TaskException { if( classname == null ) { - throw new BuildException( "you must specify type or classname" ); + throw new TaskException( "you must specify type or classname" ); } Class f = null; @@ -185,7 +186,7 @@ public class FormatterElement } catch( ClassNotFoundException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } Object o = null; @@ -195,19 +196,19 @@ public class FormatterElement } catch( InstantiationException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } catch( IllegalAccessException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } if( !( o instanceof JUnitResultFormatter ) ) { - throw new BuildException( classname + " is not a JUnitResultFormatter" ); + throw new TaskException( classname + " is not a JUnitResultFormatter" ); } - JUnitResultFormatter r = ( JUnitResultFormatter )o; + JUnitResultFormatter r = (JUnitResultFormatter)o; if( useFile && outFile != null ) { @@ -217,7 +218,7 @@ public class FormatterElement } catch( java.io.IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } r.setOutput( out ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java index 7f5f3a4ed..b783bc910 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.OutputStream; import junit.framework.TestListener; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * This Interface describes classes that format the results of a JUnit testrun. @@ -21,19 +22,19 @@ public interface JUnitResultFormatter extends TestListener * The whole testsuite started. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void startTestSuite( JUnitTest suite ) - throws BuildException; + throws TaskException; /** * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void endTestSuite( JUnitTest suite ) - throws BuildException; + throws TaskException; /** * Sets the stream the formatter is supposed to write its results to. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index 42e0488e5..c8c2cf09d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -16,8 +17,8 @@ import java.util.Hashtable; import java.util.Properties; import java.util.Random; 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.Task; import org.apache.tools.ant.taskdefs.Execute; @@ -149,7 +150,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setErrorProperty( propertyName ); } } @@ -167,7 +168,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setFailureProperty( propertyName ); } } @@ -186,7 +187,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setFiltertrace( value ); } } @@ -206,7 +207,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setFork( value ); } } @@ -223,7 +224,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setHaltonerror( value ); } } @@ -240,7 +241,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setHaltonfailure( value ); } } @@ -373,15 +374,15 @@ public class JUnitTask extends Task /** * Runs the testcase. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Enumeration list = getIndividualTests(); while( list.hasMoreElements() ) { - JUnitTest test = ( JUnitTest )list.nextElement(); + JUnitTest test = (JUnitTest)list.nextElement(); if( test.shouldRun( project ) ) { execute( test ); @@ -419,13 +420,13 @@ public class JUnitTask extends Task */ protected Enumeration getIndividualTests() { - Enumeration[] enums = new Enumeration[batchTests.size() + 1]; + Enumeration[] enums = new Enumeration[ batchTests.size() + 1 ]; for( int i = 0; i < batchTests.size(); i++ ) { - BatchTest batchtest = ( BatchTest )batchTests.elementAt( i ); - enums[i] = batchtest.elements(); + BatchTest batchtest = (BatchTest)batchTests.elementAt( i ); + enums[ i ] = batchtest.elements(); } - enums[enums.length - 1] = tests.elements(); + enums[ enums.length - 1 ] = tests.elements(); return Enumerations.fromCompound( enums ); } @@ -437,6 +438,7 @@ public class JUnitTask extends Task * @return The Output value */ protected File getOutput( FormatterElement fe, JUnitTest test ) + throws TaskException { if( fe.getUseFile() ) { @@ -468,7 +470,7 @@ public class JUnitTask extends Task int pling = u.indexOf( "!" ); String jarName = u.substring( 9, pling ); log( "Implicitly adding " + jarName + " to classpath", - Project.MSG_DEBUG ); + Project.MSG_DEBUG ); createClasspath().setLocation( new File( ( new File( jarName ) ).getAbsolutePath() ) ); } else if( u.startsWith( "file:" ) ) @@ -476,13 +478,13 @@ public class JUnitTask extends Task int tail = u.indexOf( resource ); String dirName = u.substring( 5, tail ); log( "Implicitly adding " + dirName + " to classpath", - Project.MSG_DEBUG ); + Project.MSG_DEBUG ); createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); } else { log( "Don\'t know how to handle resource URL " + u, - Project.MSG_DEBUG ); + Project.MSG_DEBUG ); } } else @@ -500,10 +502,10 @@ public class JUnitTask extends Task /** * @return null if there is a timeout value, otherwise the watchdog * instance. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected ExecuteWatchdog createWatchdog() - throws BuildException + throws TaskException { if( timeout == null ) { @@ -516,10 +518,10 @@ public class JUnitTask extends Task * Run the tests. * * @param test Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void execute( JUnitTest test ) - throws BuildException + throws TaskException { // set the default values if not specified //@todo should be moved to the test class instead. @@ -558,10 +560,10 @@ public class JUnitTask extends Task if( errorOccurredHere || failureOccurredHere ) { if( errorOccurredHere && test.getHaltonerror() - || failureOccurredHere && test.getHaltonfailure() ) + || failureOccurredHere && test.getHaltonfailure() ) { - throw new BuildException( "Test " + test.getName() + " failed" - + ( wasKilled ? " (timeout)" : "" ) ); + throw new TaskException( "Test " + test.getName() + " failed" + + ( wasKilled ? " (timeout)" : "" ) ); } else { @@ -618,12 +620,12 @@ public class JUnitTask extends Task * exceeds a certain amount of time. Can be null , in this * case the test could probably hang forever. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private int executeAsForked( JUnitTest test, ExecuteWatchdog watchdog ) - throws BuildException + throws TaskException { - CommandlineJava cmd = ( CommandlineJava )commandline.clone(); + CommandlineJava cmd = (CommandlineJava)commandline.clone(); cmd.setClassname( "org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" ); cmd.createArgument().setValue( test.getName() ); @@ -640,7 +642,7 @@ public class JUnitTask extends Task final FormatterElement[] feArray = mergeFormatters( test ); for( int i = 0; i < feArray.length; i++ ) { - FormatterElement fe = feArray[i]; + FormatterElement fe = feArray[ i ]; formatterArg.append( "formatter=" ); formatterArg.append( fe.getClassname() ); File outFile = getOutput( fe, test ); @@ -658,7 +660,7 @@ public class JUnitTask extends Task cmd.createArgument().setValue( "propsfile=" + propsFile.getAbsolutePath() ); Hashtable p = project.getProperties(); Properties props = new Properties(); - for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) + for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) { Object key = enum.nextElement(); props.put( key, p.get( key ) ); @@ -671,7 +673,7 @@ public class JUnitTask extends Task } catch( java.io.IOException e ) { - throw new BuildException( "Error creating temporary properties file.", e ); + throw new TaskException( "Error creating temporary properties file.", e ); } Execute execute = new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ), watchdog ); @@ -690,12 +692,12 @@ public class JUnitTask extends Task } catch( IOException e ) { - throw new BuildException( "Process fork failed.", e ); + throw new TaskException( "Process fork failed.", e ); } finally { if( !propsFile.delete() ) - throw new BuildException( "Could not delete temporary properties file." ); + throw new TaskException( "Could not delete temporary properties file." ); } return retVal; @@ -706,10 +708,10 @@ public class JUnitTask extends Task * * @param test Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private int executeInVM( JUnitTest test ) - throws BuildException + throws TaskException { test.setProperties( project.getProperties() ); if( dir != null ) @@ -752,7 +754,7 @@ public class JUnitTask extends Task final FormatterElement[] feArray = mergeFormatters( test ); for( int i = 0; i < feArray.length; i++ ) { - FormatterElement fe = feArray[i]; + FormatterElement fe = feArray[ i ]; File outFile = getOutput( fe, test ); if( outFile != null ) { @@ -779,9 +781,9 @@ public class JUnitTask extends Task private FormatterElement[] mergeFormatters( JUnitTest test ) { - Vector feVector = ( Vector )formatters.clone(); + Vector feVector = (Vector)formatters.clone(); test.addFormattersTo( feVector ); - FormatterElement[] feArray = new FormatterElement[feVector.size()]; + FormatterElement[] feArray = new FormatterElement[ feVector.size() ]; feVector.copyInto( feArray ); return feArray; } @@ -796,15 +798,15 @@ public class JUnitTask extends Task public String[] getValues() { return new String[]{"true", "yes", "false", "no", - "on", "off", "withOutAndErr"}; + "on", "off", "withOutAndErr"}; } public boolean asBoolean() { return "true".equals( value ) - || "on".equals( value ) - || "yes".equals( value ) - || "withOutAndErr".equals( value ); + || "on".equals( value ) + || "yes".equals( value ) + || "withOutAndErr".equals( value ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java index 93c2b2d01..2c76294e9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; @@ -48,7 +49,9 @@ public class JUnitTest extends BaseTest // and deal with it. (SB) private long runs, failures, errors; - public JUnitTest() { } + public JUnitTest() + { + } public JUnitTest( String name ) { @@ -93,7 +96,7 @@ public class JUnitTest extends BaseTest public void setProperties( Hashtable p ) { props = new Properties(); - for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) + for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) { Object key = enum.nextElement(); props.put( key, p.get( key ) ); @@ -107,7 +110,7 @@ public class JUnitTest extends BaseTest public FormatterElement[] getFormatters() { - FormatterElement[] fes = new FormatterElement[formatters.size()]; + FormatterElement[] fes = new FormatterElement[ formatters.size() ]; formatters.copyInto( fes ); return fes; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java index 29170e402..7139d8b00 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; @@ -25,8 +26,8 @@ import junit.framework.Test; import junit.framework.TestListener; import junit.framework.TestResult; import junit.framework.TestSuite; +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.util.StringUtils; @@ -76,12 +77,12 @@ public class JUnitTestRunner implements TestListener "junit.framework.TestResult", "junit.framework.TestSuite", "junit.framework.Assert.", // don't filter AssertionFailure - "junit.swingui.TestRunner", + "junit.swingui.TestRunner", "junit.awtui.TestRunner", "junit.textui.TestRunner", "java.lang.reflect.Method.invoke(", "org.apache.tools.ant." - }; + }; private static Vector fromCmdLine = new Vector(); @@ -184,7 +185,7 @@ public class JUnitTestRunner implements TestListener try { // check if there is a suite method - suiteMethod = testClass.getMethod( "suite", new Class[0] ); + suiteMethod = testClass.getMethod( "suite", new Class[ 0 ] ); } catch( Exception e ) { @@ -198,7 +199,7 @@ public class JUnitTestRunner implements TestListener // if there is a suite method available, then try // to extract the suite from it. If there is an error // here it will be caught below and reported. - suite = ( Test )suiteMethod.invoke( null, new Class[0] ); + suite = (Test)suiteMethod.invoke( null, new Class[ 0 ] ); } else { @@ -357,43 +358,43 @@ public class JUnitTestRunner implements TestListener for( int i = 1; i < args.length; i++ ) { - if( args[i].startsWith( "haltOnError=" ) ) + if( args[ i ].startsWith( "haltOnError=" ) ) { - haltError = Project.toBoolean( args[i].substring( 12 ) ); + haltError = Project.toBoolean( args[ i ].substring( 12 ) ); } - else if( args[i].startsWith( "haltOnFailure=" ) ) + else if( args[ i ].startsWith( "haltOnFailure=" ) ) { - haltFail = Project.toBoolean( args[i].substring( 14 ) ); + haltFail = Project.toBoolean( args[ i ].substring( 14 ) ); } - else if( args[i].startsWith( "filtertrace=" ) ) + else if( args[ i ].startsWith( "filtertrace=" ) ) { - stackfilter = Project.toBoolean( args[i].substring( 12 ) ); + stackfilter = Project.toBoolean( args[ i ].substring( 12 ) ); } - else if( args[i].startsWith( "formatter=" ) ) + else if( args[ i ].startsWith( "formatter=" ) ) { try { - createAndStoreFormatter( args[i].substring( 10 ) ); + createAndStoreFormatter( args[ i ].substring( 10 ) ); } - catch( BuildException be ) + catch( TaskException be ) { System.err.println( be.getMessage() ); System.exit( ERRORS ); } } - else if( args[i].startsWith( "propsfile=" ) ) + else if( args[ i ].startsWith( "propsfile=" ) ) { - FileInputStream in = new FileInputStream( args[i].substring( 10 ) ); + FileInputStream in = new FileInputStream( args[ i ].substring( 10 ) ); props.load( in ); in.close(); } } - JUnitTest t = new JUnitTest( args[0] ); + JUnitTest t = new JUnitTest( args[ 0 ] ); // Add/overlay system properties on the properties from the Ant project Hashtable p = System.getProperties(); - for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) + for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) { Object key = enum.nextElement(); props.put( key, p.get( key ) ); @@ -412,10 +413,10 @@ public class JUnitTestRunner implements TestListener * )? * * @param line Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private static void createAndStoreFormatter( String line ) - throws BuildException + throws TaskException { FormatterElement fe = new FormatterElement(); int pos = line.indexOf( ',' ); @@ -435,7 +436,7 @@ public class JUnitTestRunner implements TestListener { for( int i = 0; i < DEFAULT_TRACE_FILTERS.length; i++ ) { - if( line.indexOf( DEFAULT_TRACE_FILTERS[i] ) > 0 ) + if( line.indexOf( DEFAULT_TRACE_FILTERS[ i ] ) > 0 ) { return true; } @@ -447,7 +448,7 @@ public class JUnitTestRunner implements TestListener { for( int i = 0; i < fromCmdLine.size(); i++ ) { - runner.addFormatter( ( JUnitResultFormatter )fromCmdLine.elementAt( i ) ); + runner.addFormatter( (JUnitResultFormatter)fromCmdLine.elementAt( i ) ); } } @@ -503,7 +504,7 @@ public class JUnitTestRunner implements TestListener */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } public void addFormatter( JUnitResultFormatter f ) @@ -518,7 +519,9 @@ public class JUnitTestRunner implements TestListener * * @param test Description of Parameter */ - public void endTest( Test test ) { } + public void endTest( Test test ) + { + } public void run() { @@ -526,7 +529,7 @@ public class JUnitTestRunner implements TestListener res.addListener( this ); for( int i = 0; i < formatters.size(); i++ ) { - res.addListener( ( TestListener )formatters.elementAt( i ) ); + res.addListener( (TestListener)formatters.elementAt( i ) ); } long start = System.currentTimeMillis(); @@ -536,8 +539,8 @@ public class JUnitTestRunner implements TestListener {// had an exception in the constructor for( int i = 0; i < formatters.size(); i++ ) { - ( ( TestListener )formatters.elementAt( i ) ).addError( null, - exception ); + ( (TestListener)formatters.elementAt( i ) ).addError( null, + exception ); } junitTest.setCounts( 1, 0, 1 ); junitTest.setRunTime( 0 ); @@ -562,10 +565,10 @@ public class JUnitTestRunner implements TestListener systemOut.close(); systemOut = null; sendOutAndErr( new String( outStrm.toByteArray() ), - new String( errStrm.toByteArray() ) ); + new String( errStrm.toByteArray() ) ); junitTest.setCounts( res.runCount(), res.failureCount(), - res.errorCount() ); + res.errorCount() ); junitTest.setRunTime( System.currentTimeMillis() - start ); } } @@ -588,7 +591,9 @@ public class JUnitTestRunner implements TestListener * * @param t Description of Parameter */ - public void startTest( Test t ) { } + public void startTest( Test t ) + { + } protected void handleErrorOutput( String line ) { @@ -610,7 +615,7 @@ public class JUnitTestRunner implements TestListener { for( int i = 0; i < formatters.size(); i++ ) { - ( ( JUnitResultFormatter )formatters.elementAt( i ) ).endTestSuite( junitTest ); + ( (JUnitResultFormatter)formatters.elementAt( i ) ).endTestSuite( junitTest ); } } @@ -618,7 +623,7 @@ public class JUnitTestRunner implements TestListener { for( int i = 0; i < formatters.size(); i++ ) { - ( ( JUnitResultFormatter )formatters.elementAt( i ) ).startTestSuite( junitTest ); + ( (JUnitResultFormatter)formatters.elementAt( i ) ).startTestSuite( junitTest ); } } @@ -627,7 +632,7 @@ public class JUnitTestRunner implements TestListener for( int i = 0; i < formatters.size(); i++ ) { JUnitResultFormatter formatter = - ( ( JUnitResultFormatter )formatters.elementAt( i ) ); + ( (JUnitResultFormatter)formatters.elementAt( i ) ); formatter.setSystemOutput( out ); formatter.setSystemError( err ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java index 082af4960..02fde0ad6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.lang.reflect.Method; import junit.framework.Test; import junit.framework.TestCase; @@ -21,21 +22,23 @@ public class JUnitVersionHelper { private static Method testCaseName = null; + static { try { - testCaseName = TestCase.class.getMethod( "getName", new Class[0] ); + testCaseName = TestCase.class.getMethod( "getName", new Class[ 0 ] ); } catch( NoSuchMethodException e ) { // pre JUnit 3.7 try { - testCaseName = TestCase.class.getMethod( "name", new Class[0] ); + testCaseName = TestCase.class.getMethod( "name", new Class[ 0 ] ); } catch( NoSuchMethodException e2 ) - {} + { + } } } @@ -54,10 +57,11 @@ public class JUnitVersionHelper { try { - return ( String )testCaseName.invoke( t, new Object[0] ); + return (String)testCaseName.invoke( t, new Object[ 0 ] ); } catch( Throwable e ) - {} + { + } } return "unknown"; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java index 239da0895..e6a119b58 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; @@ -15,7 +16,7 @@ import java.util.Hashtable; import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Prints plain text output of the test to a specified Writer. @@ -111,7 +112,7 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } /** @@ -126,16 +127,16 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter synchronized( wri ) { wri.print( "Testcase: " - + JUnitVersionHelper.getTestCaseName( test ) ); + + JUnitVersionHelper.getTestCaseName( test ) ); if( Boolean.TRUE.equals( failed.get( test ) ) ) { return; } - Long l = ( Long )testStarts.get( test ); + Long l = (Long)testStarts.get( test ); wri.println( " took " - + nf.format( ( System.currentTimeMillis() - l.longValue() ) - / 1000.0 ) - + " sec" ); + + nf.format( ( System.currentTimeMillis() - l.longValue() ) + / 1000.0 ) + + " sec" ); } } @@ -143,10 +144,10 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void endTestSuite( JUnitTest suite ) - throws BuildException + throws TaskException { String newLine = System.getProperty( "line.separator" ); StringBuffer sb = new StringBuffer( "Testsuite: " ); @@ -195,7 +196,7 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter } catch( IOException ioex ) { - throw new BuildException( "Unable to write output", ioex ); + throw new TaskException( "Unable to write output", ioex ); } finally { @@ -206,7 +207,8 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter out.close(); } catch( IOException e ) - {} + { + } } } } @@ -230,7 +232,9 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter * * @param suite Description of Parameter */ - public void startTestSuite( JUnitTest suite ) { } + public void startTestSuite( JUnitTest suite ) + { + } private void formatError( String type, Test test, Throwable t ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java index 2932da2d0..04efe04dd 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.IOException; import java.io.OutputStream; import java.text.NumberFormat; import junit.framework.AssertionFailedError; import junit.framework.Test; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Prints short summary output of the test to Ant's logging system. @@ -38,7 +39,9 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter /** * Empty */ - public SummaryJUnitResultFormatter() { } + public SummaryJUnitResultFormatter() + { + } public void setOutput( OutputStream out ) { @@ -71,7 +74,9 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter * @param test The feature to be added to the Error attribute * @param t The feature to be added to the Error attribute */ - public void addError( Test test, Throwable t ) { } + public void addError( Test test, Throwable t ) + { + } /** * Empty @@ -79,7 +84,9 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter * @param test The feature to be added to the Failure attribute * @param t The feature to be added to the Failure attribute */ - public void addFailure( Test test, Throwable t ) { } + public void addFailure( Test test, Throwable t ) + { + } /** * Interface TestListener for JUnit > 3.4.

@@ -91,7 +98,7 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } /** @@ -99,16 +106,18 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter * * @param test Description of Parameter */ - public void endTest( Test test ) { } + public void endTest( Test test ) + { + } /** * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void endTestSuite( JUnitTest suite ) - throws BuildException + throws TaskException { String newLine = System.getProperty( "line.separator" ); StringBuffer sb = new StringBuffer( "Tests run: " ); @@ -144,7 +153,7 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter } catch( IOException ioex ) { - throw new BuildException( "Unable to write summary output", ioex ); + throw new TaskException( "Unable to write summary output", ioex ); } finally { @@ -155,7 +164,8 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter out.close(); } catch( IOException e ) - {} + { + } } } } @@ -165,12 +175,16 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter * * @param t Description of Parameter */ - public void startTest( Test t ) { } + public void startTest( Test t ) + { + } /** * Empty * * @param suite Description of Parameter */ - public void startTestSuite( JUnitTest suite ) { } + public void startTestSuite( JUnitTest suite ) + { + } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java index 97501dc2c..bdaf7e14b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java @@ -6,11 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.StringWriter; import java.io.Writer; import java.util.Enumeration; import java.util.Hashtable; @@ -20,7 +19,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.util.DOMElementWriter; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -58,7 +57,9 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan */ private Element rootElement; - public XMLJUnitResultFormatter() { } + public XMLJUnitResultFormatter() + { + } private static DocumentBuilder getDocumentBuilder() { @@ -123,7 +124,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } /** @@ -135,21 +136,21 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan */ public void endTest( Test test ) { - Element currentTest = ( Element )testElements.get( test ); - Long l = ( Long )testStarts.get( test ); + Element currentTest = (Element)testElements.get( test ); + Long l = (Long)testStarts.get( test ); currentTest.setAttribute( ATTR_TIME, - "" + ( ( System.currentTimeMillis() - l.longValue() ) - / 1000.0 ) ); + "" + ( ( System.currentTimeMillis() - l.longValue() ) + / 1000.0 ) ); } /** * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void endTestSuite( JUnitTest suite ) - throws BuildException + throws TaskException { rootElement.setAttribute( ATTR_TESTS, "" + suite.runCount() ); rootElement.setAttribute( ATTR_FAILURES, "" + suite.failureCount() ); @@ -167,7 +168,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan } catch( IOException exc ) { - throw new BuildException( "Unable to write log file", exc ); + throw new TaskException( "Unable to write log file", exc ); } finally { @@ -180,7 +181,8 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan wri.close(); } catch( IOException e ) - {} + { + } } } } @@ -200,7 +202,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan Element currentTest = doc.createElement( TESTCASE ); currentTest.setAttribute( ATTR_NAME, - JUnitVersionHelper.getTestCaseName( t ) ); + JUnitVersionHelper.getTestCaseName( t ) ); rootElement.appendChild( currentTest ); testElements.put( t, currentTest ); } @@ -225,7 +227,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan Enumeration e = props.propertyNames(); while( e.hasMoreElements() ) { - String name = ( String )e.nextElement(); + String name = (String)e.nextElement(); Element propElement = doc.createElement( PROPERTY ); propElement.setAttribute( ATTR_NAME, name ); propElement.setAttribute( ATTR_VALUE, props.getProperty( name ) ); @@ -245,7 +247,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan Element currentTest = null; if( test != null ) { - currentTest = ( Element )testElements.get( test ); + currentTest = (Element)testElements.get( test ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java index bdbf5233f..ef3d88354 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java @@ -6,30 +6,29 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.io.StringWriter; import java.util.Enumeration; import java.util.Vector; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -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; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.util.DOMElementWriter; -import org.apache.tools.ant.util.StringUtils; import org.apache.tools.ant.util.FileUtils; +import org.apache.tools.ant.util.StringUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; - /** *

* @@ -132,7 +131,6 @@ public class XMLResultAggregator extends Task implements XMLConstants filesets.addElement( fs ); } - public AggregateTransformer createReport() { AggregateTransformer transformer = new AggregateTransformer( this ); @@ -144,11 +142,11 @@ public class XMLResultAggregator extends Task implements XMLConstants * Aggregate all testsuites into a single document and write it to the * specified directory and file. * - * @throws BuildException thrown if there is a serious error while writing + * @throws TaskException thrown if there is a serious error while writing * the document. */ public void execute() - throws BuildException + throws TaskException { Element rootElement = createDocument(); File destFile = getDestinationFile(); @@ -159,14 +157,14 @@ public class XMLResultAggregator extends Task implements XMLConstants } catch( IOException e ) { - throw new BuildException( "Unable to write test aggregate to '" + destFile + "'", e ); + throw new TaskException( "Unable to write test aggregate to '" + destFile + "'", e ); } // apply transformation Enumeration enum = transformers.elements(); while( enum.hasMoreElements() ) { AggregateTransformer transformer = - ( AggregateTransformer )enum.nextElement(); + (AggregateTransformer)enum.nextElement(); transformer.setXmlDocument( rootElement.getOwnerDocument() ); transformer.transform(); } @@ -202,13 +200,13 @@ public class XMLResultAggregator extends Task implements XMLConstants final int size = filesets.size(); for( int i = 0; i < size; i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); DirectoryScanner ds = fs.getDirectoryScanner( project ); ds.scan(); String[] f = ds.getIncludedFiles(); for( int j = 0; j < f.length; j++ ) { - String pathname = f[j]; + String pathname = f[ j ]; if( pathname.endsWith( ".xml" ) ) { File file = new File( ds.getBasedir(), pathname ); @@ -219,7 +217,7 @@ public class XMLResultAggregator extends Task implements XMLConstants } } - File[] files = new File[v.size()]; + File[] files = new File[ v.size() ]; v.copyInto( files ); return files; } @@ -247,7 +245,7 @@ public class XMLResultAggregator extends Task implements XMLConstants // a missing . might imply no package at all. Don't get fooled. String pkgName = ( pos == -1 ) ? "" : fullclassname.substring( 0, pos ); String classname = ( pos == -1 ) ? fullclassname : fullclassname.substring( pos + 1 ); - Element copy = ( Element )DOMUtil.importNode( root, testsuite ); + Element copy = (Element)DOMUtil.importNode( root, testsuite ); // modify the name attribute and set the package copy.setAttribute( ATTR_NAME, classname ); @@ -276,11 +274,11 @@ public class XMLResultAggregator extends Task implements XMLConstants { try { - log( "Parsing file: '" + files[i] + "'", Project.MSG_VERBOSE ); + log( "Parsing file: '" + files[ i ] + "'", Project.MSG_VERBOSE ); //XXX there seems to be a bug in xerces 1.3.0 that doesn't like file object // will investigate later. It does not use the given directory but // the vm dir instead ? Works fine with crimson. - Document testsuiteDoc = builder.parse( "file:///" + files[i].getAbsolutePath() ); + Document testsuiteDoc = builder.parse( "file:///" + files[ i ].getAbsolutePath() ); Element elem = testsuiteDoc.getDocumentElement(); // make sure that this is REALLY a testsuite. if( TESTSUITE.equals( elem.getNodeName() ) ) @@ -290,19 +288,19 @@ public class XMLResultAggregator extends Task implements XMLConstants else { // issue a warning. - log( "the file " + files[i] + " is not a valid testsuite XML document", Project.MSG_WARN ); + log( "the file " + files[ i ] + " is not a valid testsuite XML document", Project.MSG_WARN ); } } catch( SAXException e ) { // a testcase might have failed and write a zero-length document, // It has already failed, but hey.... mm. just put a warning - log( "The file " + files[i] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN ); + log( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN ); log( StringUtils.getStackTrace( e ), Project.MSG_DEBUG ); } catch( IOException e ) { - log( "Error while accessing file " + files[i] + ": " + e.getMessage(), Project.MSG_ERR ); + log( "Error while accessing file " + files[ i ] + ": " + e.getMessage(), Project.MSG_ERR ); } } return rootElement; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java index 5f426d55e..0b1c42fdf 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.OutputStream; import org.apache.xalan.xslt.XSLTInputSource; import org.apache.xalan.xslt.XSLTProcessor; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java index 617424290..cfdec9467 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.OutputStream; import javax.xml.transform.Result; import javax.xml.transform.Source; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java index 0b95c3426..7169bd98f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Field; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Command class that encapsulate specific behavior for each Xalan version. The @@ -34,11 +35,11 @@ abstract class XalanExecutor * * @param caller object containing the transformation information. * @return Description of the Returned Value - * @throws BuildException thrown if it could not find a valid xalan + * @throws TaskException thrown if it could not find a valid xalan * executor. */ static XalanExecutor newInstance( AggregateTransformer caller ) - throws BuildException + throws TaskException { Class procVersion = null; XalanExecutor executor = null; @@ -52,12 +53,12 @@ abstract class XalanExecutor try { procVersion = Class.forName( "org.apache.xalan.xslt.XSLProcessorVersion" ); - executor = ( XalanExecutor )Class.forName( + executor = (XalanExecutor)Class.forName( "org.apache.tools.ant.taskdefs.optional.junit.Xalan1Executor" ).newInstance(); } catch( Exception xalan1missing ) { - throw new BuildException( "Could not find xalan2 nor xalan1 in the classpath. Check http://xml.apache.org/xalan-j" ); + throw new TaskException( "Could not find xalan2 nor xalan1 in the classpath. Check http://xml.apache.org/xalan-j" ); } } String version = getXalanVersion( procVersion ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java index 31b5ff0c9..86983a729 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -14,7 +15,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Random; 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; @@ -75,7 +76,9 @@ public abstract class AbstractMetamataTask extends Task // be set when calling scanFileSets(); protected Hashtable includedFiles = null; - public AbstractMetamataTask() { } + public AbstractMetamataTask() + { + } /** * initialize the task with the classname of the task to run @@ -137,7 +140,6 @@ public abstract class AbstractMetamataTask extends Task this.metamataHome = metamataHome; } - /** * The java files or directory to be audited * @@ -189,10 +191,10 @@ public abstract class AbstractMetamataTask extends Task /** * execute the command line * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { try { @@ -211,10 +213,10 @@ public abstract class AbstractMetamataTask extends Task /** * check the options and build the command line * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void setUp() - throws BuildException + throws TaskException { checkOptions(); @@ -250,7 +252,6 @@ public abstract class AbstractMetamataTask extends Task return new File( new File( home.getAbsolutePath() ), "lib/metamata.jar" ); } - protected Hashtable getFileMapping() { return includedFiles; @@ -266,21 +267,21 @@ public abstract class AbstractMetamataTask extends Task /** * validate options set * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { // do some validation first if( metamataHome == null || !metamataHome.exists() ) { - throw new BuildException( "'metamatahome' must point to Metamata home directory." ); + throw new TaskException( "'metamatahome' must point to Metamata home directory." ); } metamataHome = resolveFile( metamataHome.getPath() ); File jar = getMetamataJar( metamataHome ); if( !jar.exists() ) { - throw new BuildException( jar + " does not exist. Check your metamata installation." ); + throw new TaskException( jar + " does not exist. Check your metamata installation." ); } } @@ -304,15 +305,14 @@ public abstract class AbstractMetamataTask extends Task */ protected abstract ExecuteStreamHandler createStreamHandler(); - /** * execute the process with a specific handler * * @param handler Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void execute0( ExecuteStreamHandler handler ) - throws BuildException + throws TaskException { final Execute process = new Execute( handler ); log( cmdl.toString(), Project.MSG_VERBOSE ); @@ -321,18 +321,17 @@ public abstract class AbstractMetamataTask extends Task { if( process.execute() != 0 ) { - throw new BuildException( "Metamata task failed." ); + throw new TaskException( "Metamata task failed." ); } } catch( IOException e ) { - throw new BuildException( "Failed to launch Metamata task: " + e ); + throw new TaskException( "Failed to launch Metamata task: " + e ); } } - protected void generateOptionsFile( File tofile, Vector options ) - throws BuildException + throws TaskException { FileWriter fw = null; try @@ -348,7 +347,7 @@ public abstract class AbstractMetamataTask extends Task } catch( IOException e ) { - throw new BuildException( "Error while writing options file " + tofile, e ); + throw new TaskException( "Error while writing options file " + tofile, e ); } finally { @@ -359,7 +358,8 @@ public abstract class AbstractMetamataTask extends Task fw.close(); } catch( IOException ignored ) - {} + { + } } } } @@ -373,18 +373,18 @@ public abstract class AbstractMetamataTask extends Task Hashtable files = new Hashtable(); 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 ); ds.scan(); String[] f = ds.getIncludedFiles(); log( i + ") Adding " + f.length + " files from directory " + ds.getBasedir(), Project.MSG_VERBOSE ); for( int j = 0; j < f.length; j++ ) { - String pathname = f[j]; + String pathname = f[ j ]; if( pathname.endsWith( ".java" ) ) { File file = new File( ds.getBasedir(), pathname ); -// file = project.resolveFile(file.getAbsolutePath()); + // file = project.resolveFile(file.getAbsolutePath()); String classname = pathname.substring( 0, pathname.length() - ".java".length() ); classname = classname.replace( File.separatorChar, '.' ); files.put( file.getAbsolutePath(), classname );// it's a java file, add it. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java index 900bdc243..62cbe5266 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; 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.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.LogStreamHandler; @@ -160,7 +161,7 @@ public class MAudit extends AbstractMetamataTask } // suppress copyright msg when running, we will let it so that this // will be the only output to the console if in xml mode -// options.addElement("-quiet"); + // options.addElement("-quiet"); if( fix ) { options.addElement( "-fix" ); @@ -190,12 +191,12 @@ public class MAudit extends AbstractMetamataTask } protected void checkOptions() - throws BuildException + throws TaskException { super.checkOptions(); if( unused && searchPath == null ) { - throw new BuildException( "'searchpath' element must be set when looking for 'unused' declarations." ); + throw new TaskException( "'searchpath' element must be set when looking for 'unused' declarations." ); } if( !unused && searchPath != null ) { @@ -204,7 +205,7 @@ public class MAudit extends AbstractMetamataTask } protected void cleanUp() - throws BuildException + throws TaskException { super.cleanUp(); // at this point if -list is used, we should move @@ -220,7 +221,7 @@ public class MAudit extends AbstractMetamataTask } protected ExecuteStreamHandler createStreamHandler() - throws BuildException + throws TaskException { ExecuteStreamHandler handler = null; // if we didn't specify a file, then use a screen report @@ -238,7 +239,7 @@ public class MAudit extends AbstractMetamataTask } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } return handler; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java index 1096d6700..83520b850 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -26,7 +27,6 @@ import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; - /** * This is a very bad stream handler for the MAudit task. All report to stdout * that does not match a specific report pattern is dumped to the Ant output as @@ -99,14 +99,18 @@ class MAuditStreamHandler implements ExecuteStreamHandler * * @param is The new ProcessErrorStream value */ - public void setProcessErrorStream( InputStream is ) { } + public void setProcessErrorStream( InputStream is ) + { + } /** * Ignore. * * @param os The new ProcessInputStream value */ - public void setProcessInputStream( OutputStream os ) { } + public void setProcessInputStream( OutputStream os ) + { + } /** * Set the inputstream @@ -148,9 +152,9 @@ class MAuditStreamHandler implements ExecuteStreamHandler int errors = 0; while( keys.hasMoreElements() ) { - String filepath = ( String )keys.nextElement(); - Vector v = ( Vector )auditedFiles.get( filepath ); - String fullclassname = ( String )filemapping.get( filepath ); + String filepath = (String)keys.nextElement(); + Vector v = (Vector)auditedFiles.get( filepath ); + String fullclassname = (String)filemapping.get( filepath ); if( fullclassname == null ) { task.getProject().log( "Could not find class mapping for " + filepath, Project.MSG_WARN ); @@ -166,7 +170,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler errors += v.size(); for( int i = 0; i < v.size(); i++ ) { - MAudit.Violation violation = ( MAudit.Violation )v.elementAt( i ); + MAudit.Violation violation = (MAudit.Violation)v.elementAt( i ); Element error = doc.createElement( "violation" ); error.setAttribute( "line", String.valueOf( violation.line ) ); error.setAttribute( "message", violation.error ); @@ -202,7 +206,8 @@ class MAuditStreamHandler implements ExecuteStreamHandler wri.close(); } catch( IOException e ) - {} + { + } } } } @@ -218,7 +223,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler */ protected void addViolationEntry( String file, MAudit.Violation entry ) { - Vector violations = ( Vector )auditedFiles.get( file ); + Vector violations = (Vector)auditedFiles.get( file ); // if there is no decl for this file yet, create it. if( violations == null ) { @@ -251,9 +256,9 @@ class MAuditStreamHandler implements ExecuteStreamHandler Vector matches = matcher.getGroups( line ); if( matches != null ) { - String file = ( String )matches.elementAt( 1 ); - int lineNum = Integer.parseInt( ( String )matches.elementAt( 2 ) ); - String msg = ( String )matches.elementAt( 3 ); + String file = (String)matches.elementAt( 1 ); + int lineNum = Integer.parseInt( (String)matches.elementAt( 2 ) ); + String msg = (String)matches.elementAt( 3 ); addViolationEntry( file, MAudit.createViolation( lineNum, msg ) ); } else diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java index 6a5ae42ee..be5009094 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; 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.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.LogStreamHandler; @@ -117,7 +118,6 @@ public class MMetrics extends AbstractMetamataTask return path; } - protected Vector getOptions() { Vector options = new Vector( 512 ); @@ -158,7 +158,7 @@ public class MMetrics extends AbstractMetamataTask String[] dirs = path.list(); for( int i = 0; i < dirs.length; i++ ) { - options.addElement( dirs[i] ); + options.addElement( dirs[ i ] ); } // files next. addAllVector( options, includedFiles.keys() ); @@ -170,38 +170,37 @@ public class MMetrics extends AbstractMetamataTask // check for existing options and outfile, all other are optional protected void checkOptions() - throws BuildException + throws TaskException { super.checkOptions(); if( !"files".equals( granularity ) && !"methods".equals( granularity ) - && !"types".equals( granularity ) ) + && !"types".equals( granularity ) ) { - throw new BuildException( "Metrics reporting granularity is invalid. Must be one of 'files', 'methods', 'types'" ); + throw new TaskException( "Metrics reporting granularity is invalid. Must be one of 'files', 'methods', 'types'" ); } if( outFile == null ) { - throw new BuildException( "Output XML file must be set via 'tofile' attribute." ); + throw new TaskException( "Output XML file must be set via 'tofile' attribute." ); } if( path == null && fileSets.size() == 0 ) { - throw new BuildException( "Must set either paths (path element) or files (fileset element)" ); + throw new TaskException( "Must set either paths (path element) or files (fileset element)" ); } // I don't accept dirs and files at the same time, I cannot recognize the semantic in the result if( path != null && fileSets.size() > 0 ) { - throw new BuildException( "Cannot set paths (path element) and files (fileset element) at the same time" ); + throw new TaskException( "Cannot set paths (path element) and files (fileset element) at the same time" ); } } - /** * cleanup the temporary txt report * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void cleanUp() - throws BuildException + throws TaskException { try { @@ -232,7 +231,7 @@ public class MMetrics extends AbstractMetamataTask } protected void execute0( ExecuteStreamHandler handler ) - throws BuildException + throws TaskException { super.execute0( handler ); transformFile(); @@ -243,11 +242,11 @@ public class MMetrics extends AbstractMetamataTask * called if the result is written to the output file via -output or we * could use the handler directly on stdout if not. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @see #createStreamHandler() */ protected void transformFile() - throws BuildException + throws TaskException { FileInputStream tmpStream = null; try @@ -256,7 +255,7 @@ public class MMetrics extends AbstractMetamataTask } catch( IOException e ) { - throw new BuildException( "Error reading temporary file: " + tmpFile, e ); + throw new TaskException( "Error reading temporary file: " + tmpFile, e ); } FileOutputStream xmlStream = null; try @@ -269,7 +268,7 @@ public class MMetrics extends AbstractMetamataTask } catch( IOException e ) { - throw new BuildException( "Error creating output file: " + outFile, e ); + throw new TaskException( "Error creating output file: " + outFile, e ); } finally { @@ -280,7 +279,8 @@ public class MMetrics extends AbstractMetamataTask xmlStream.close(); } catch( IOException ignored ) - {} + { + } } if( tmpStream != null ) { @@ -289,7 +289,8 @@ public class MMetrics extends AbstractMetamataTask tmpStream.close(); } catch( IOException ignored ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java index b09fd00fc..932f5f1ad 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -68,8 +69,8 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler protected final static String METHOD = "method"; protected final static String[] ATTRIBUTES = {"name", "vg", "loc", - "dit", "noa", "nrm", "nlm", "wmc", "rfc", "dac", "fanout", "cbo", "lcom", "nocl" - }; + "dit", "noa", "nrm", "nlm", "wmc", "rfc", "dac", "fanout", "cbo", "lcom", "nocl" + }; /** * the stack where are stored the metrics element so that they we can know @@ -117,7 +118,9 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler * @exception IOException Description of Exception */ public void setProcessErrorStream( InputStream p1 ) - throws IOException { } + throws IOException + { + } /** * Ignore. @@ -126,7 +129,9 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler * @exception IOException Description of Exception */ public void setProcessInputStream( OutputStream p1 ) - throws IOException { } + throws IOException + { + } /** * Set the inputstream @@ -152,7 +157,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler } try { - metricsHandler = ( ( SAXTransformerFactory )factory ).newTransformerHandler(); + metricsHandler = ( (SAXTransformerFactory)factory ).newTransformerHandler(); metricsHandler.setResult( new StreamResult( new OutputStreamWriter( xmlOutputStream, "UTF-8" ) ) ); Transformer transformer = metricsHandler.getTransformer(); transformer.setOutputProperty( OutputKeys.INDENT, "yes" ); @@ -185,7 +190,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler // closed yet. while( stack.size() > 0 ) { - ElementEntry elem = ( ElementEntry )stack.pop(); + ElementEntry elem = (ElementEntry)stack.pop(); metricsHandler.endElement( "", elem.getType(), elem.getType() ); } // close the root @@ -231,7 +236,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler // ok, this is now black magic time, we will guess the type based on // the previous type and its indent... - final ElementEntry previous = ( ElementEntry )stack.peek(); + final ElementEntry previous = (ElementEntry)stack.peek(); final String prevType = previous.getType(); final int prevIndent = previous.getIndent(); final int indent = elem.getIndent(); @@ -252,7 +257,6 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler return PACKAGE; } - /** * Create all attributes of a MetricsElement skipping those who have an * empty string @@ -264,15 +268,15 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler { AttributesImpl impl = new AttributesImpl(); int i = 0; - String name = ATTRIBUTES[i++]; + String name = ATTRIBUTES[ i++ ]; impl.addAttribute( "", name, name, "CDATA", elem.getName() ); Enumeration metrics = elem.getMetrics(); for( ; metrics.hasMoreElements(); i++ ) { - String value = ( String )metrics.nextElement(); + String value = (String)metrics.nextElement(); if( value.length() > 0 ) { - name = ATTRIBUTES[i]; + name = ATTRIBUTES[ i ]; impl.addAttribute( "", name, name, "CDATA", value ); } } @@ -339,7 +343,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler int indent = elem.getIndent(); if( stack.size() > 0 ) { - ElementEntry previous = ( ElementEntry )stack.peek(); + ElementEntry previous = (ElementEntry)stack.peek(); // close nodes until you got the parent. try { @@ -347,11 +351,12 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler { stack.pop(); metricsHandler.endElement( "", previous.getType(), previous.getType() ); - previous = ( ElementEntry )stack.peek(); + previous = (ElementEntry)stack.peek(); } } catch( EmptyStackException ignored ) - {} + { + } } // ok, now start the new construct @@ -404,6 +409,7 @@ class MetricsElement private int indent; private Vector metrics; + static { METAMATA_NF = NumberFormat.getInstance(); @@ -411,7 +417,7 @@ class MetricsElement NEUTRAL_NF = NumberFormat.getInstance(); if( NEUTRAL_NF instanceof DecimalFormat ) { - ( ( DecimalFormat )NEUTRAL_NF ).applyPattern( "###0.###;-###0.###" ); + ( (DecimalFormat)NEUTRAL_NF ).applyPattern( "###0.###;-###0.###" ); } NEUTRAL_NF.setMaximumFractionDigits( 1 ); } @@ -456,7 +462,7 @@ class MetricsElement // construct name, we'll need all this to figure out what type of // construct it is since we lost all semantics :( // (#indent[/]*)(#construct.*) - String name = ( String )metrics.elementAt( 0 ); + String name = (String)metrics.elementAt( 0 ); metrics.removeElementAt( 0 ); int indent = 0; pos = name.lastIndexOf( '/' ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java index 1e25b6b93..f856fd39b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Random; 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.taskdefs.Execute; @@ -178,14 +179,13 @@ public class MParse extends Task return sourcepath; } - /** * execute the command line * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { try { @@ -202,10 +202,10 @@ public class MParse extends Task /** * check the options and build the command line * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void setUp() - throws BuildException + throws TaskException { checkOptions(); @@ -214,7 +214,7 @@ public class MParse extends Task final Path classPath = cmdl.createClasspath( project ); for( int i = 0; i < jars.length; i++ ) { - classPath.createPathElement().setLocation( jars[i] ); + classPath.createPathElement().setLocation( jars[ i ] ); } // set the metamata.home property @@ -242,7 +242,7 @@ public class MParse extends Task files.addElement( new File( metahome, "lib/metamata.jar" ) ); files.addElement( new File( metahome, "bin/lib/JavaCC.zip" ) ); - File[] array = new File[files.size()]; + File[] array = new File[ files.size() ]; files.copyInto( array ); return array; } @@ -279,20 +279,19 @@ public class MParse extends Task } options.addElement( target.getAbsolutePath() ); - String[] array = new String[options.size()]; + String[] array = new String[ options.size() ]; options.copyInto( array ); return array; } - /** * execute the process with a specific handler * * @param handler Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void _execute( ExecuteStreamHandler handler ) - throws BuildException + throws TaskException { // target has been checked as a .jj, see if there is a matching // java file and if it is needed to run to process the grammar @@ -313,28 +312,27 @@ public class MParse extends Task { if( process.execute() != 0 ) { - throw new BuildException( "Metamata task failed." ); + throw new TaskException( "Metamata task failed." ); } } catch( IOException e ) { - throw new BuildException( "Failed to launch Metamata task: " + e ); + throw new TaskException( "Failed to launch Metamata task: " + e ); } } - /** * validate options set and resolve files and paths * - * @throws BuildException thrown if an option has an incorrect state. + * @throws TaskException thrown if an option has an incorrect state. */ protected void checkOptions() - throws BuildException + throws TaskException { // check that the home is ok. if( metahome == null || !metahome.exists() ) { - throw new BuildException( "'metamatahome' must point to Metamata home directory." ); + throw new TaskException( "'metamatahome' must point to Metamata home directory." ); } metahome = resolveFile( metahome.getPath() ); @@ -342,16 +340,16 @@ public class MParse extends Task File[] jars = getMetamataLibs(); for( int i = 0; i < jars.length; i++ ) { - if( !jars[i].exists() ) + if( !jars[ i ].exists() ) { - throw new BuildException( jars[i] + " does not exist. Check your metamata installation." ); + throw new TaskException( jars[ i ] + " does not exist. Check your metamata installation." ); } } // check that the target is ok and resolve it. if( target == null || !target.isFile() || !target.getName().endsWith( ".jj" ) ) { - throw new BuildException( "Invalid target: " + target ); + throw new TaskException( "Invalid target: " + target ); } target = resolveFile( target.getPath() ); } @@ -395,11 +393,11 @@ public class MParse extends Task * * @param tofile the file to write the options to. * @param options the array of options element to write to the file. - * @throws BuildException thrown if there is a problem while writing to the + * @throws TaskException thrown if there is a problem while writing to the * file. */ protected void generateOptionsFile( File tofile, String[] options ) - throws BuildException + throws TaskException { FileWriter fw = null; try @@ -408,13 +406,13 @@ public class MParse extends Task PrintWriter pw = new PrintWriter( fw ); for( int i = 0; i < options.length; i++ ) { - pw.println( options[i] ); + pw.println( options[ i ] ); } pw.flush(); } catch( IOException e ) { - throw new BuildException( "Error while writing options file " + tofile, e ); + throw new TaskException( "Error while writing options file " + tofile, e ); } finally { @@ -425,7 +423,8 @@ public class MParse extends Task fw.close(); } catch( IOException ignored ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java index 8865b344b..55766207e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.net; + import com.oroinc.net.ftp.FTPClient; import com.oroinc.net.ftp.FTPFile; import com.oroinc.net.ftp.FTPReply; @@ -21,7 +22,7 @@ import java.io.InputStream; import java.io.OutputStream; 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.FileScanner; import org.apache.tools.ant.Project; @@ -52,7 +53,7 @@ import org.apache.tools.ant.types.FileSet; * @author Magesh Umasankar */ public class FTP - extends Task + extends Task { protected final static int SEND_FILES = 0; protected final static int GET_FILES = 1; @@ -66,7 +67,7 @@ public class FTP "deleting", "listing", "making directory" - }; + }; protected final static String[] COMPLETED_ACTION_STRS = { "sent", @@ -74,7 +75,7 @@ public class FTP "deleted", "listed", "created directory" - }; + }; private boolean binary = true; private boolean passive = false; private boolean verbose = false; @@ -100,10 +101,10 @@ public class FTP * "mkdir" and "list". * * @param action The new Action value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setAction( Action action ) - throws BuildException + throws TaskException { this.action = action.getAction(); } @@ -146,10 +147,10 @@ public class FTP * other actions. * * @param listing The new Listing value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setListing( File listing ) - throws BuildException + throws TaskException { this.listing = listing; } @@ -232,7 +233,6 @@ public class FTP this.server = server; } - /** * set the failed transfer flag * @@ -276,10 +276,10 @@ public class FTP /** * Runs the task. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { checkConfiguration(); @@ -294,7 +294,7 @@ public class FTP ftp.connect( server, port ); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { - throw new BuildException( "FTP connection failed: " + ftp.getReplyString() ); + throw new TaskException( "FTP connection failed: " + ftp.getReplyString() ); } log( "connected", Project.MSG_VERBOSE ); @@ -302,7 +302,7 @@ public class FTP if( !ftp.login( userid, password ) ) { - throw new BuildException( "Could not login to FTP server" ); + throw new TaskException( "Could not login to FTP server" ); } log( "login succeeded", Project.MSG_VERBOSE ); @@ -312,7 +312,7 @@ public class FTP ftp.setFileType( com.oroinc.net.ftp.FTP.IMAGE_FILE_TYPE ); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { - throw new BuildException( + throw new TaskException( "could not set transfer type: " + ftp.getReplyString() ); } @@ -324,7 +324,7 @@ public class FTP ftp.enterLocalPassiveMode(); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { - throw new BuildException( + throw new TaskException( "could not enter into passive mode: " + ftp.getReplyString() ); } @@ -347,19 +347,19 @@ public class FTP ftp.changeWorkingDirectory( remotedir ); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { - throw new BuildException( + throw new TaskException( "could not change remote directory: " + ftp.getReplyString() ); } } - log( ACTION_STRS[action] + " files" ); + log( ACTION_STRS[ action ] + " files" ); transferFiles( ftp ); } } catch( IOException ex ) { - throw new BuildException( "error during FTP transfer: " + ex ); + throw new TaskException( "error during FTP transfer: " + ex ); } finally { @@ -390,10 +390,10 @@ public class FTP * @param dir Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void getFile( FTPClient ftp, String dir, String filename ) - throws IOException, BuildException + throws IOException, TaskException { OutputStream outstream = null; try @@ -426,14 +426,14 @@ public class FTP } else { - throw new BuildException( s ); + throw new TaskException( s ); } } else { log( "File " + file.getAbsolutePath() + " copied from " + server, - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); transferred++; } } @@ -462,10 +462,10 @@ public class FTP * @param remoteFile Description of Parameter * @return The UpToDate value * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected boolean isUpToDate( FTPClient ftp, File localFile, String remoteFile ) - throws IOException, BuildException + throws IOException, TaskException { log( "checking date for " + remoteFile, Project.MSG_VERBOSE ); @@ -486,12 +486,12 @@ public class FTP } else { - throw new BuildException( "could not date test remote file: " + - ftp.getReplyString() ); + throw new TaskException( "could not date test remote file: " + + ftp.getReplyString() ); } } - long remoteTimestamp = files[0].getTimestamp().getTime().getTime(); + long remoteTimestamp = files[ 0 ].getTimestamp().getTime().getTime(); long localTimestamp = localFile.lastModified(); if( this.action == SEND_FILES ) { @@ -506,32 +506,32 @@ public class FTP /** * Checks to see that all required parameters are set. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkConfiguration() - throws BuildException + throws TaskException { if( server == null ) { - throw new BuildException( "server attribute must be set!" ); + throw new TaskException( "server attribute must be set!" ); } if( userid == null ) { - throw new BuildException( "userid attribute must be set!" ); + throw new TaskException( "userid attribute must be set!" ); } if( password == null ) { - throw new BuildException( "password attribute must be set!" ); + throw new TaskException( "password attribute must be set!" ); } if( ( action == LIST_FILES ) && ( listing == null ) ) { - throw new BuildException( "listing attribute must be set for list action!" ); + throw new TaskException( "listing attribute must be set for list action!" ); } if( action == MK_DIR && remotedir == null ) { - throw new BuildException( "remotedir attribute must be set for mkdir action!" ); + throw new TaskException( "remotedir attribute must be set for mkdir action!" ); } } @@ -542,10 +542,10 @@ public class FTP * @param ftp Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void createParents( FTPClient ftp, String filename ) - throws IOException, BuildException + throws IOException, TaskException { Vector parents = new Vector(); File dir = new File( filename ); @@ -559,11 +559,11 @@ public class FTP for( int i = parents.size() - 1; i >= 0; i-- ) { - dir = ( File )parents.elementAt( i ); + dir = (File)parents.elementAt( i ); if( !dirCache.contains( dir ) ) { log( "creating remote directory " + resolveFile( dir.getPath() ), - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); ftp.makeDirectory( resolveFile( dir.getPath() ) ); // Both codes 550 and 553 can be produced by FTP Servers // to indicate that an attempt to create a directory has @@ -573,7 +573,7 @@ public class FTP ( result != 550 ) && ( result != 553 ) && !ignoreNoncriticalErrors ) { - throw new BuildException( + throw new TaskException( "could not create directory: " + ftp.getReplyString() ); } @@ -588,10 +588,10 @@ public class FTP * @param ftp Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void delFile( FTPClient ftp, String filename ) - throws IOException, BuildException + throws IOException, TaskException { if( verbose ) { @@ -608,7 +608,7 @@ public class FTP } else { - throw new BuildException( s ); + throw new TaskException( s ); } } else @@ -629,17 +629,17 @@ public class FTP * @param bw Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void listFile( FTPClient ftp, BufferedWriter bw, String filename ) - throws IOException, BuildException + throws IOException, TaskException { if( verbose ) { log( "listing " + filename ); } - FTPFile ftpfile = ftp.listFiles( resolveFile( filename ) )[0]; + FTPFile ftpfile = ftp.listFiles( resolveFile( filename ) )[ 0 ]; bw.write( ftpfile.toString() ); bw.newLine(); @@ -652,10 +652,10 @@ public class FTP * @param ftp The FTP client connection * @param dir The directory to create (format must be correct for host type) * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void makeRemoteDir( FTPClient ftp, String dir ) - throws IOException, BuildException + throws IOException, TaskException { if( verbose ) { @@ -671,8 +671,8 @@ public class FTP int rc = ftp.getReplyCode(); if( !( ignoreNoncriticalErrors && ( rc == 550 || rc == 553 || rc == 521 ) ) ) { - throw new BuildException( "could not create directory: " + - ftp.getReplyString() ); + throw new TaskException( "could not create directory: " + + ftp.getReplyString() ); } if( verbose ) @@ -702,7 +702,7 @@ public class FTP protected String resolveFile( String file ) { return file.replace( System.getProperty( "file.separator" ).charAt( 0 ), - remoteFileSep.charAt( 0 ) ); + remoteFileSep.charAt( 0 ) ); } /** @@ -718,10 +718,10 @@ public class FTP * @param dir Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void sendFile( FTPClient ftp, String dir, String filename ) - throws IOException, BuildException + throws IOException, TaskException { InputStream instream = null; try @@ -752,7 +752,7 @@ public class FTP } else { - throw new BuildException( s ); + throw new TaskException( s ); } } @@ -760,8 +760,8 @@ public class FTP { log( "File " + file.getAbsolutePath() + - " copied to " + server, - Project.MSG_VERBOSE ); + " copied to " + server, + Project.MSG_VERBOSE ); transferred++; } } @@ -789,10 +789,10 @@ public class FTP * @param fs Description of Parameter * @return Description of the Returned Value * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected int transferFiles( FTPClient ftp, FileSet fs ) - throws IOException, BuildException + throws IOException, TaskException { FileScanner ds; @@ -811,7 +811,7 @@ public class FTP String dir = null; if( ( ds.getBasedir() == null ) && ( ( action == SEND_FILES ) || ( action == GET_FILES ) ) ) { - throw new BuildException( "the dir attribute must be set for send and get actions" ); + throw new TaskException( "the dir attribute must be set for send and get actions" ); } else { @@ -835,36 +835,36 @@ public class FTP for( int i = 0; i < dsfiles.length; i++ ) { - switch ( action ) + switch( action ) { - case SEND_FILES: - { - sendFile( ftp, dir, dsfiles[i] ); - break; - } + case SEND_FILES: + { + sendFile( ftp, dir, dsfiles[ i ] ); + break; + } - case GET_FILES: - { - getFile( ftp, dir, dsfiles[i] ); - break; - } + case GET_FILES: + { + getFile( ftp, dir, dsfiles[ i ] ); + break; + } - case DEL_FILES: - { - delFile( ftp, dsfiles[i] ); - break; - } + case DEL_FILES: + { + delFile( ftp, dsfiles[ i ] ); + break; + } - case LIST_FILES: - { - listFile( ftp, bw, dsfiles[i] ); - break; - } + case LIST_FILES: + { + listFile( ftp, bw, dsfiles[ i ] ); + break; + } - default: - { - throw new BuildException( "unknown ftp action " + action ); - } + default: + { + throw new TaskException( "unknown ftp action " + action ); + } } } @@ -882,24 +882,24 @@ public class FTP * * @param ftp Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void transferFiles( FTPClient ftp ) - throws IOException, BuildException + throws IOException, TaskException { transferred = 0; skipped = 0; if( filesets.size() == 0 ) { - throw new BuildException( "at least one fileset must be specified." ); + throw new TaskException( "at least one fileset must be specified." ); } else { // get files from filesets for( int i = 0; i < filesets.size(); i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); if( fs != null ) { transferFiles( ftp, fs ); @@ -907,10 +907,10 @@ public class FTP } } - log( transferred + " files " + COMPLETED_ACTION_STRS[action] ); + log( transferred + " files " + COMPLETED_ACTION_STRS[ action ] ); if( skipped != 0 ) { - log( skipped + " files were not successfully " + COMPLETED_ACTION_STRS[action] ); + log( skipped + " files were not successfully " + COMPLETED_ACTION_STRS[ action ] ); } } @@ -919,7 +919,7 @@ public class FTP private final static String[] validActions = { "send", "put", "recv", "get", "del", "delete", "list", "mkdir" - }; + }; public int getAction() { @@ -971,12 +971,12 @@ public class FTP if( includes == null ) { // No includes supplied, so set it to 'matches all' - includes = new String[1]; - includes[0] = "**"; + includes = new String[ 1 ]; + includes[ 0 ] = "**"; } if( excludes == null ) { - excludes = new String[0]; + excludes = new String[ 0 ]; } filesIncluded = new Vector(); @@ -994,7 +994,7 @@ public class FTP } catch( IOException e ) { - throw new BuildException( "Unable to scan FTP server: ", e ); + throw new TaskException( "Unable to scan FTP server: ", e ); } } @@ -1016,7 +1016,7 @@ public class FTP for( int i = 0; i < newfiles.length; i++ ) { - FTPFile file = newfiles[i]; + FTPFile file = newfiles[ i ]; if( !file.getName().equals( "." ) && !file.getName().equals( ".." ) ) { if( file.isDirectory() ) @@ -1078,7 +1078,7 @@ public class FTP } catch( IOException e ) { - throw new BuildException( "Error while communicating with FTP server: ", e ); + throw new TaskException( "Error while communicating with FTP server: ", e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java index ec6043e87..543879179 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java @@ -6,15 +6,16 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.net; + import java.io.File; import java.io.FileInputStream; -import java.io.IOException;// Standard SDK imports +import java.io.IOException; import java.util.Properties; -import java.util.Vector;//imported for data source and handler +import java.util.Vector; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.mail.Message; -import javax.mail.MessagingException;//imported for the mail api +import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; @@ -22,13 +23,12 @@ import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project;// Ant imports +import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; - /** * A task to send SMTP email. This version has near identical syntax to the * SendEmail task, but is MIME aware. It also requires Sun's mail.jar and @@ -102,16 +102,17 @@ public class MimeMail extends Task /** * Creates new instance */ - public MimeMail() { } - + public MimeMail() + { + } // helper method to add recipients private static void addRecipients( MimeMessage msg, Message.RecipientType recipType, String addrUserName, String addrList - ) - throws MessagingException, BuildException + ) + throws MessagingException, TaskException { if( ( null == addrList ) || ( addrList.trim().length() <= 0 ) ) return; @@ -121,13 +122,13 @@ public class MimeMail extends Task InternetAddress[] addrArray = InternetAddress.parse( addrList ); if( ( null == addrArray ) || ( 0 == addrArray.length ) ) - throw new BuildException( "Empty " + addrUserName + " recipients list was specified" ); + throw new TaskException( "Empty " + addrUserName + " recipients list was specified" ); msg.setRecipients( recipType, addrArray ); } catch( AddressException ae ) { - throw new BuildException( "Invalid " + addrUserName + " recipient list" ); + throw new TaskException( "Invalid " + addrUserName + " recipient list" ); } } @@ -151,7 +152,6 @@ public class MimeMail extends Task this.ccList = ccList; } - /** * Sets the FailOnError attribute of the MimeMail object * @@ -162,7 +162,6 @@ public class MimeMail extends Task this.failOnError = failOnError; } - /** * Sets the "from" parameter of this build task. * @@ -173,7 +172,6 @@ public class MimeMail extends Task this.from = from; } - /** * Sets the mailhost parameter of this build task. * @@ -184,7 +182,6 @@ public class MimeMail extends Task this.mailhost = mailhost; } - /** * Sets the message parameter of this build task. * @@ -200,7 +197,6 @@ public class MimeMail extends Task this.messageFile = messageFile; } - /** * set type of the text message, plaintext by default but text/html or * text/xml is quite feasible @@ -247,10 +243,10 @@ public class MimeMail extends Task * * @exception MessagingException Description of Exception * @exception AddressException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void doMail() - throws MessagingException, AddressException, BuildException + throws MessagingException, AddressException, TaskException { Properties props = new Properties(); props.put( "mail.smtp.host", mailhost ); @@ -284,8 +280,8 @@ public class MimeMail extends Task //first a message if( messageFile != null ) { - int size = ( int )messageFile.length(); - byte data[] = new byte[size]; + int size = (int)messageFile.length(); + byte data[] = new byte[ size ]; try { @@ -296,7 +292,7 @@ public class MimeMail extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } @@ -309,7 +305,7 @@ public class MimeMail extends Task for( int i = 0; i < filesets.size(); i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); if( fs != null ) { DirectoryScanner ds = fs.getDirectoryScanner( project ); @@ -318,16 +314,16 @@ public class MimeMail extends Task for( int j = 0; j < dsfiles.length; j++ ) { - File file = new File( baseDir, dsfiles[j] ); + File file = new File( baseDir, dsfiles[ j ] ); MimeBodyPart body; body = new MimeBodyPart(); if( !file.exists() || !file.canRead() ) { - throw new BuildException( "File \"" + file.getAbsolutePath() - + "\" does not exist or is not readable." ); + throw new TaskException( "File \"" + file.getAbsolutePath() + + "\" does not exist or is not readable." ); } log( "Attaching " + file.toString() + " - " + file.length() + " bytes", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); FileDataSource fileData = new FileDataSource( file ); DataHandler fileDataHandler = new DataHandler( fileData ); body.setDataHandler( fileDataHandler ); @@ -342,15 +338,14 @@ public class MimeMail extends Task Transport.send( msg ); } - /** - * 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 { @@ -361,7 +356,7 @@ public class MimeMail extends Task { if( failOnError ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } else { @@ -371,32 +366,31 @@ public class MimeMail extends Task } } - /** * verify parameters * - * @throws BuildException if something is invalid + * @throws TaskException if something is invalid */ public void validate() { if( from == null ) { - throw new BuildException( "Attribute \"from\" is required." ); + throw new TaskException( "Attribute \"from\" is required." ); } if( ( toList == null ) && ( ccList == null ) && ( bccList == null ) ) { - throw new BuildException( "Attribute \"toList\", \"ccList\" or \"bccList\" is required." ); + throw new TaskException( "Attribute \"toList\", \"ccList\" or \"bccList\" is required." ); } if( message == null && filesets.isEmpty() && messageFile == null ) { - throw new BuildException( "FileSet, \"message\", or \"messageFile\" is required." ); + throw new TaskException( "FileSet, \"message\", or \"messageFile\" is required." ); } if( message != null && messageFile != null ) { - throw new BuildException( "Only one of \"message\" or \"messageFile\" may be specified." ); + throw new TaskException( "Only one of \"message\" or \"messageFile\" may be specified." ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java index 8fa57bed6..39164bb39 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.net; + import com.oroinc.net.telnet.TelnetClient; import java.io.IOException; import java.io.InputStream; @@ -13,7 +14,7 @@ import java.io.OutputStream; import java.util.Calendar; 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; @@ -136,7 +137,7 @@ public class TelnetTask extends Task public TelnetSubTask createRead() { - TelnetSubTask task = ( TelnetSubTask )new TelnetRead(); + TelnetSubTask task = (TelnetSubTask)new TelnetRead(); telnetTasks.addElement( task ); return task; } @@ -149,7 +150,7 @@ public class TelnetTask extends Task */ public TelnetSubTask createWrite() { - TelnetSubTask task = ( TelnetSubTask )new TelnetWrite(); + TelnetSubTask task = (TelnetSubTask)new TelnetWrite(); telnetTasks.addElement( task ); return task; } @@ -158,24 +159,24 @@ public class TelnetTask extends Task * Verify that all parameters are included. Connect and possibly login * Iterate through the list of Reads and writes * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { /** * A server name is required to continue */ if( server == null ) - throw new BuildException( "No Server Specified" ); + throw new TaskException( "No Server Specified" ); /** * A userid and password must appear together if they appear. They are * not required. */ if( userid == null && password != null ) - throw new BuildException( "No Userid Specified" ); + throw new TaskException( "No Userid Specified" ); if( password == null && userid != null ) - throw new BuildException( "No Password Specified" ); + throw new TaskException( "No Password Specified" ); /** * Create the telnet client object @@ -187,7 +188,7 @@ public class TelnetTask extends Task } catch( IOException e ) { - throw new BuildException( "Can't connect to " + server ); + throw new TaskException( "Can't connect to " + server ); } /** * Login if userid and password were specified @@ -200,9 +201,9 @@ public class TelnetTask extends Task Enumeration tasksToRun = telnetTasks.elements(); while( tasksToRun != null && tasksToRun.hasMoreElements() ) { - TelnetSubTask task = ( TelnetSubTask )tasksToRun.nextElement(); + TelnetSubTask task = (TelnetSubTask)tasksToRun.nextElement(); if( task instanceof TelnetRead && defaultTimeout != null ) - ( ( TelnetRead )task ).setDefaultTimeout( defaultTimeout ); + ( (TelnetRead)task ).setDefaultTimeout( defaultTimeout ); task.execute( telnet ); } } @@ -249,7 +250,7 @@ public class TelnetTask extends Task } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } @@ -284,7 +285,7 @@ public class TelnetTask extends Task { while( sb.toString().indexOf( s ) == -1 ) { - sb.append( ( char )is.read() ); + sb.append( (char)is.read() ); } } else @@ -299,19 +300,19 @@ public class TelnetTask extends Task Thread.sleep( 250 ); } if( is.available() == 0 ) - throw new BuildException( "Response Timed-Out" ); - sb.append( ( char )is.read() ); + throw new TaskException( "Response Timed-Out" ); + sb.append( (char)is.read() ); } } log( sb.toString(), Project.MSG_INFO ); } - catch( BuildException be ) + catch( TaskException be ) { throw be; } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } @@ -348,7 +349,7 @@ public class TelnetTask extends Task } public void execute( AntTelnetClient telnet ) - throws BuildException + throws TaskException { telnet.waitForString( taskString, timeout ); } @@ -375,9 +376,9 @@ public class TelnetTask extends Task } public void execute( AntTelnetClient telnet ) - throws BuildException + throws TaskException { - throw new BuildException( "Shouldn't be able instantiate a SubTask directly" ); + throw new TaskException( "Shouldn't be able instantiate a SubTask directly" ); } } @@ -396,7 +397,7 @@ public class TelnetTask extends Task } public void execute( AntTelnetClient telnet ) - throws BuildException + throws TaskException { telnet.sendString( taskString, echoString ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java index 9630aa7ff..ae0f53b45 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; + 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; @@ -86,19 +87,19 @@ public class P4Add extends P4Base private int m_changelist; public void setChangelist( int changelist ) - throws BuildException + throws TaskException { if( changelist <= 0 ) - throw new BuildException( "P4Add: Changelist# should be a positive number" ); + throw new TaskException( "P4Add: Changelist# should be a positive number" ); this.m_changelist = changelist; } public void setCommandlength( int len ) - throws BuildException + throws TaskException { if( len <= 0 ) - throw new BuildException( "P4Add: Commandlength should be a positive number" ); + throw new TaskException( "P4Add: Commandlength should be a positive number" ); this.m_cmdLength = len; } @@ -108,7 +109,7 @@ public class P4Add extends P4Base } public void execute() - throws BuildException + throws TaskException { if( P4View != null ) @@ -122,7 +123,7 @@ public class P4Add extends P4Base 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); @@ -131,7 +132,7 @@ public class P4Add extends P4Base { for( int j = 0; j < srcFiles.length; j++ ) { - File f = new File( ds.getBasedir(), srcFiles[j] ); + File f = new File( ds.getBasedir(), srcFiles[ j ] ); filelist.append( " " ).append( '"' ).append( f.getAbsolutePath() ).append( '"' ); if( filelist.length() > m_cmdLength ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java index f23e4f6b4..ae28709b6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java @@ -6,14 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; + import java.io.IOException; +import org.apache.myrmidon.api.TaskException; import org.apache.oro.text.perl.Perl5Util; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Execute; import org.apache.tools.ant.types.Commandline; - /** * Base class for Perforce (P4) ANT tasks. See individual task for example * usage. @@ -110,7 +110,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task } protected void execP4Command( String command ) - throws BuildException + throws TaskException { execP4Command( command, null ); } @@ -120,10 +120,10 @@ public abstract class P4Base extends org.apache.tools.ant.Task * * @param command The command to run * @param handler A P4Handler to process any input and output - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void execP4Command( String command, P4Handler handler ) - throws BuildException + throws TaskException { try { @@ -150,7 +150,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task String cmdl = ""; for( int i = 0; i < cmdline.length; i++ ) { - cmdl += cmdline[i] + " "; + cmdl += cmdline[ i ] + " "; } log( "Execing " + cmdl, Project.MSG_VERBOSE ); @@ -170,7 +170,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } finally { @@ -179,14 +179,14 @@ public abstract class P4Base extends org.apache.tools.ant.Task handler.stop(); } catch( Exception e ) - {} + { + } } - } catch( Exception e ) { - throw new BuildException( "Problem exec'ing P4 command: " + e.getMessage() ); + throw new TaskException( "Problem exec'ing P4 command: " + e.getMessage() ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java index 5068a9d13..f10bd6793 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -32,51 +33,50 @@ public class P4Change extends P4Base this.description = desc; } - public String getEmptyChangeList() - throws BuildException + throws TaskException { final StringBuffer stringbuf = new StringBuffer(); execP4Command( "change -o", - new P4HandlerAdapter() - { - public void process( String line ) - { - if( !util.match( "/^#/", line ) ) - { - if( util.match( "/error/", line ) ) - { - - log( "Client Error", Project.MSG_VERBOSE ); - throw new BuildException( "Perforce Error, check client settings and/or server" ); - } - else if( util.match( "//", line ) ) - { - - // we need to escape the description in case there are / - description = backslash( description ); - line = util.substitute( "s//" + description + "/", line ); - - } - else if( util.match( "/\\/\\//", line ) ) - { - //Match "//" for begining of depot filespec - return; - } - - stringbuf.append( line ); - stringbuf.append( "\n" ); - - } - } - } ); + new P4HandlerAdapter() + { + public void process( String line ) + { + if( !util.match( "/^#/", line ) ) + { + if( util.match( "/error/", line ) ) + { + + log( "Client Error", Project.MSG_VERBOSE ); + throw new TaskException( "Perforce Error, check client settings and/or server" ); + } + else if( util.match( "//", line ) ) + { + + // we need to escape the description in case there are / + description = backslash( description ); + line = util.substitute( "s//" + description + "/", line ); + + } + else if( util.match( "/\\/\\//", line ) ) + { + //Match "//" for begining of depot filespec + return; + } + + stringbuf.append( line ); + stringbuf.append( "\n" ); + + } + } + } ); return stringbuf.toString(); } public void execute() - throws BuildException + throws TaskException { if( emptyChangeList == null ) @@ -101,7 +101,7 @@ public class P4Change extends P4Base } else if( util.match( "/error/", line ) ) { - throw new BuildException( "Perforce Error, check client settings and/or server" ); + throw new TaskException( "Perforce Error, check client settings and/or server" ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java index 59949b617..7697036c6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -46,17 +47,17 @@ public class P4Counter extends P4Base } public void execute() - throws BuildException + throws TaskException { if( ( counter == null ) || counter.length() == 0 ) { - throw new BuildException( "No counter specified to retrieve" ); + throw new TaskException( "No counter specified to retrieve" ); } if( shouldSetValue && shouldSetProperty ) { - throw new BuildException( "Cannot both set the value of the property and retrieve the value of the property." ); + throw new TaskException( "Cannot both set the value of the property and retrieve the value of the property." ); } String command = "counter " + P4CmdOpts + " " + counter; @@ -90,7 +91,7 @@ public class P4Counter extends P4Base } catch( NumberFormatException nfe ) { - throw new BuildException( "Perforce error. Could not retrieve counter value." ); + throw new TaskException( "Perforce error. Could not retrieve counter value." ); } } }; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java index f711fd2ca..39b0b8518 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * P4Delete - checkout file(s) for delete. Example Usage:
@@ -30,12 +31,12 @@ public class P4Delete extends P4Base } public void execute() - throws BuildException + throws TaskException { if( change != null ) P4CmdOpts = "-c " + change; if( P4View == null ) - throw new BuildException( "No view specified to delete" ); + throw new TaskException( "No view specified to delete" ); execP4Command( "-s delete " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler( this ) ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java index c5b10ebc8..7a94b1ec7 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * P4Edit - checkout file(s) for edit. Example Usage:
@@ -27,12 +28,12 @@ public class P4Edit extends P4Base } public void execute() - throws BuildException + throws TaskException { if( change != null ) P4CmdOpts = "-c " + change; if( P4View == null ) - throw new BuildException( "No view specified to edit" ); + throw new TaskException( "No view specified to edit" ); execP4Command( "-s edit " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler( this ) ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java index 7175096c3..2da77afc2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; /** @@ -19,8 +20,8 @@ public interface P4Handler extends ExecuteStreamHandler { public void process( String line ) - throws BuildException; + throws TaskException; public void setOutput( String line ) - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java index d077d85ae..18ade82ea 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.SequenceInputStream; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; public abstract class P4HandlerAdapter implements P4Handler { @@ -49,9 +50,8 @@ public abstract class P4HandlerAdapter implements P4Handler public abstract void process( String line ); - public void start() - throws BuildException + throws TaskException { try @@ -68,7 +68,7 @@ public abstract class P4HandlerAdapter implements P4Handler BufferedReader input = new BufferedReader( new InputStreamReader( - new SequenceInputStream( is, es ) ) ); + new SequenceInputStream( is, es ) ) ); String line; while( ( line = input.readLine() ) != null ) @@ -81,9 +81,11 @@ public abstract class P4HandlerAdapter implements P4Handler } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } - public void stop() { } + public void stop() + { + } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java index 406b08b52..110a89147 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java @@ -6,8 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * P4Have - lists files currently on client. P4Have simply dumps the current @@ -19,7 +19,7 @@ public class P4Have extends P4Base { public void execute() - throws BuildException + throws TaskException { execP4Command( "have " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler( this ) ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java index 277256019..296a1b4cf 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java @@ -6,12 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; + import java.text.SimpleDateFormat; import java.util.Date; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; - /** * P4Label - create a Perforce Label. P4Label inserts a label into perforce * reflecting the current client contents. Label name defaults to AntLabel if @@ -44,7 +44,7 @@ public class P4Label extends P4Base } public void execute() - throws BuildException + throws TaskException { log( "P4Label exec:", Project.MSG_INFO ); @@ -94,13 +94,13 @@ public class P4Label extends P4Base execP4Command( "label -i", handler ); execP4Command( "labelsync -l " + name, - new P4HandlerAdapter() - { - public void process( String line ) - { - log( line, Project.MSG_VERBOSE ); - } - } ); + new P4HandlerAdapter() + { + public void process( String line ) + { + log( line, Project.MSG_VERBOSE ); + } + } ); log( "Created Label " + name + " (" + desc + ")", Project.MSG_INFO ); @@ -132,7 +132,6 @@ public class P4Label extends P4Base } }; - execP4Command( "label -o " + name, handler ); log( labelSpec.toString(), Project.MSG_DEBUG ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java index fdc248dc7..4f6285b16 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Interface for p4 job output stream handler. Classes implementing this @@ -18,5 +19,5 @@ public interface P4OutputHandler { public void process( String line ) - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java index ce1031a3a..19eacf784 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java @@ -6,33 +6,35 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /* * P4Reopen - move files to a new changelist * * @author Les Hughes */ + public class P4Reopen extends P4Base { private String toChange = ""; public void setToChange( String toChange ) - throws BuildException + throws TaskException { if( toChange == null && !toChange.equals( "" ) ) - throw new BuildException( "P4Reopen: tochange cannot be null or empty" ); + throw new TaskException( "P4Reopen: tochange cannot be null or empty" ); this.toChange = toChange; } public void execute() - throws BuildException + throws TaskException { if( P4View == null ) if( P4View == null ) - throw new BuildException( "No view specified to reopen" ); + throw new TaskException( "No view specified to reopen" ); execP4Command( "-s reopen -c " + toChange + " " + P4View, new SimpleP4OutputHandler( this ) ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java index f96d1862c..4c1dd7bcd 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java @@ -6,13 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /* * P4Revert - revert open files or files in a changelist * * @author Les Hughes */ + public class P4Revert extends P4Base { @@ -20,10 +22,10 @@ public class P4Revert extends P4Base private boolean onlyUnchanged = false; public void setChange( String revertChange ) - throws BuildException + throws TaskException { if( revertChange == null && !revertChange.equals( "" ) ) - throw new BuildException( "P4Revert: change cannot be null or empty" ); + throw new TaskException( "P4Revert: change cannot be null or empty" ); this.revertChange = revertChange; @@ -35,7 +37,7 @@ public class P4Revert extends P4Base } public void execute() - throws BuildException + throws TaskException { /* diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java index 07ebb1e97..587b5bb9a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -30,26 +31,26 @@ public class P4Submit extends P4Base } public void execute() - throws BuildException + throws TaskException { if( change != null ) { execP4Command( "submit -c " + change, - new P4HandlerAdapter() - { - public void process( String line ) - { - log( line, Project.MSG_VERBOSE ); - } - } - ); + new P4HandlerAdapter() + { + public void process( String line ) + { + log( line, Project.MSG_VERBOSE ); + } + } + ); } else { //here we'd parse the output from change -o into submit -i //in order to support default change. - throw new BuildException( "No change specified (no support for default change yet...." ); + throw new TaskException( "No change specified (no support for default change yet...." ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java index 8c6e9bcc6..869f7eb07 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -88,27 +89,26 @@ public class P4Sync extends P4Base String label; - public void setForce( String force ) - throws BuildException + throws TaskException { if( force == null && !label.equals( "" ) ) - throw new BuildException( "P4Sync: If you want to force, set force to non-null string!" ); + throw new TaskException( "P4Sync: If you want to force, set force to non-null string!" ); P4CmdOpts = "-f"; } public void setLabel( String label ) - throws BuildException + throws TaskException { if( label == null && !label.equals( "" ) ) - throw new BuildException( "P4Sync: Labels cannot be Null or Empty" ); + throw new TaskException( "P4Sync: Labels cannot be Null or Empty" ); this.label = label; } public void execute() - throws BuildException + throws TaskException { if( P4View != null ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java index fc8e97e66..7ab63ca4b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; public class SimpleP4OutputHandler extends P4HandlerAdapter @@ -20,7 +21,7 @@ public class SimpleP4OutputHandler extends P4HandlerAdapter } public void process( String line ) - throws BuildException + throws TaskException { if( parent.util.match( "/^exit/", line ) ) return; @@ -37,7 +38,7 @@ public class SimpleP4OutputHandler extends P4HandlerAdapter if( parent.util.match( "/error:/", line ) && !parent.util.match( "/up-to-date/", line ) ) { - throw new BuildException( line ); + throw new TaskException( line ); } parent.log( parent.util.substitute( "s/^.*: //", line ), Project.MSG_INFO ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java index 0068b772b..09d01e098 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.pvcs; + import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -19,7 +20,7 @@ import java.text.ParseException; import java.util.Enumeration; import java.util.Random; 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.taskdefs.Execute; import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; @@ -314,17 +315,17 @@ public class Pvcs extends org.apache.tools.ant.Task } /** - * @exception org.apache.tools.ant.BuildException Something is stopping the + * @exception org.apache.tools.ant.TaskException Something is stopping the * build... */ public void execute() - throws org.apache.tools.ant.BuildException + throws org.apache.tools.ant.TaskException { Project aProj = getProject(); int result = 0; if( repository == null || repository.trim().equals( "" ) ) - throw new BuildException( "Required argument repository not specified" ); + throw new TaskException( "Required argument repository not specified" ); // Check workspace exists // Launch PCLI listversionedfiles -z -aw @@ -351,9 +352,9 @@ public class Pvcs extends org.apache.tools.ant.Task Enumeration e = getPvcsprojects().elements(); while( e.hasMoreElements() ) { - String projectName = ( ( PvcsProject )e.nextElement() ).getName(); + String projectName = ( (PvcsProject)e.nextElement() ).getName(); if( projectName == null || ( projectName.trim() ).equals( "" ) ) - throw new BuildException( "name is a required attribute of pvcsproject" ); + throw new TaskException( "name is a required attribute of pvcsproject" ); commandLine.createArgument().setValue( projectName ); } } @@ -370,11 +371,11 @@ public class Pvcs extends org.apache.tools.ant.Task if( result != 0 && !ignorerc ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } if( !tmp.exists() ) - throw new BuildException( "Communication between ant and pvcs failed. No output generated from executing PVCS commandline interface \"pcli\" and \"get\"" ); + throw new TaskException( "Communication between ant and pvcs failed. No output generated from executing PVCS commandline interface \"pcli\" and \"get\"" ); // Create folders in workspace log( "Creating folders", Project.MSG_INFO ); @@ -412,24 +413,24 @@ public class Pvcs extends org.apache.tools.ant.Task if( result != 0 && !ignorerc ) { String msg = "Failed executing: " + commandLine.toString() + ". Return code was " + result; - throw new BuildException( msg ); + throw new TaskException( msg ); } } catch( FileNotFoundException e ) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } catch( IOException e ) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } catch( ParseException e ) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } finally { @@ -444,7 +445,6 @@ public class Pvcs extends org.apache.tools.ant.Task } } - protected int runCmd( Commandline cmd, ExecuteStreamHandler out ) { try @@ -459,7 +459,7 @@ public class Pvcs extends org.apache.tools.ant.Task catch( java.io.IOException e ) { String msg = "Failed executing: " + cmd.toString() + ". Exception: " + e.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -495,7 +495,7 @@ public class Pvcs extends org.apache.tools.ant.Task line.startsWith( getLineStart() ) ) { Object[] objs = mf.parse( line ); - String f = ( String )objs[1]; + String f = (String)objs[ 1 ]; // Extract the name of the directory from the filename int index = f.lastIndexOf( File.separator ); if( index > -1 ) @@ -521,7 +521,7 @@ public class Pvcs extends org.apache.tools.ant.Task else { log( "File separator problem with " + line, - Project.MSG_WARN ); + Project.MSG_WARN ); } } else diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java index 524de2f1b..9d2f34a73 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.taskdefs.optional.pvcs; - /** * class to handle <pvcsprojec> elements * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java index 1c7832216..2b5caef0f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.scm; + import com.starbase.starteam.Folder; import com.starbase.starteam.Item; import com.starbase.starteam.Property; @@ -15,9 +16,8 @@ import com.starbase.starteam.Type; import com.starbase.starteam.View; import com.starbase.util.Platform; import java.util.StringTokenizer; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; /** * Checks out files from a specific StarTeam server, project, view, and folder. @@ -44,7 +44,7 @@ import org.apache.tools.ant.Project; * You can set AntStarTeamCheckOut to verbose or quiet mode. Also, it has a * safeguard against overwriting the files on your computer: If the target * directory you specify already exists, the program will throw a - * BuildException. To override the exception, set force to true. + * TaskException. To override the exception, set force to true. *
*
* This program makes use of functions from the StarTeam API. As a result @@ -187,20 +187,19 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task */ private boolean targetFolderAbsolute = false; - /** * convenient method to check for conditions * * @param value Description of Parameter * @param msg Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private static void assertTrue( boolean value, String msg ) - throws BuildException + throws TaskException { if( !value ) { - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -549,7 +548,6 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task return targetFolder; } - /** * returns whether the StarTeam default path is factored into calculated * target path locations (false) or whether targetFolder is an absolute @@ -600,10 +598,10 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task /** * Do the execution. * - * @exception BuildException + * @exception TaskException */ public void execute() - throws BuildException + throws TaskException { // Connect to the StarTeam server, and log on. Server s = getServer(); @@ -638,7 +636,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Property[] properties = t.getProperties(); for( int i = 0; i < properties.length; i++ ) { - Property p = properties[i]; + Property p = properties[ i ]; if( p.isPrimaryDescriptor() ) { return p; @@ -660,7 +658,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Property[] properties = t.getProperties(); for( int i = 0; i < properties.length; i++ ) { - Property p = properties[i]; + Property p = properties[ i ]; if( p.isDescriptor() && !p.isPrimaryDescriptor() ) { return p; @@ -689,7 +687,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task } protected void checkParameters() - throws BuildException + throws TaskException { // Check all of the properties that are required. assertTrue( getServerName() != null, "ServerName must be set." ); @@ -713,8 +711,8 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task java.io.File dirExist = new java.io.File( getTargetFolder() ); if( dirExist.isDirectory() && !getForce() ) { - throw new BuildException( "Target directory exists. Set \"force\" to \"true\" " + - "to continue anyway." ); + throw new TaskException( "Target directory exists. Set \"force\" to \"true\" " + + "to continue anyway." ); } } @@ -741,7 +739,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { if( p.getTypeCode() == Property.Types.ENUMERATED ) { - return "\"" + p.getEnumDisplayName( ( ( Integer )value ).intValue() ) + "\""; + return "\"" + p.getEnumDisplayName( ( (Integer)value ).intValue() ) + "\""; } else { @@ -797,7 +795,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Item[] items = f.getItems( t.getName() ); for( int i = 0; i < items.length; i++ ) { - runItem( s, p, v, t, f, items[i], tgt ); + runItem( s, p, v, t, f, items[ i ], tgt ); } // Process all subfolders recursively if recursion is on. @@ -806,7 +804,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Folder[] subfolders = f.getSubFolders(); for( int i = 0; i < subfolders.length; i++ ) { - runFolder( s, p, v, t, subfolders[i], new java.io.File( tgt, subfolders[i].getName() ) ); + runFolder( s, p, v, t, subfolders[ i ], new java.io.File( tgt, subfolders[ i ].getName() ) ); } } } @@ -835,7 +833,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Property p1 = getPrimaryDescriptor( t ); Property p2 = getSecondaryDescriptor( t ); - String pName = ( String )item.get( p1.getName() ); + String pName = (String)item.get( p1.getName() ); if( !shouldCheckout( pName ) ) { return; @@ -905,11 +903,11 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task // Check it out; also ugly. // Change the item to be checked out to a StarTeam File. - com.starbase.starteam.File remote = ( com.starbase.starteam.File )item; + com.starbase.starteam.File remote = (com.starbase.starteam.File)item; // The local file name is simply the local target path (tgt) which has // been passed recursively down from the top of the tree, with the item's name appended. - java.io.File local = new java.io.File( tgt, ( String )item.get( p1.getName() ) ); + java.io.File local = new java.io.File( tgt, (String)item.get( p1.getName() ) ); try { @@ -918,7 +916,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task } catch( Exception e ) { - throw new BuildException( "Failed to checkout '" + local + "'", e ); + throw new TaskException( "Failed to checkout '" + local + "'", e ); } } @@ -933,14 +931,14 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task View[] views = p.getViews(); for( int i = 0; i < views.length; i++ ) { - View v = views[i]; + View v = views[ i ]; if( v.getName().equals( getViewName() ) ) { if( getVerbose() ) { log( "Found " + getProjectName() + delim + getViewName() + delim ); } - runType( s, p, v, s.typeForName( ( String )s.getTypeNames().FILE ) ); + runType( s, p, v, s.typeForName( (String)s.getTypeNames().FILE ) ); break; } } @@ -956,7 +954,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task com.starbase.starteam.Project[] projects = s.getProjects(); for( int i = 0; i < projects.length; i++ ) { - com.starbase.starteam.Project p = projects[i]; + com.starbase.starteam.Project p = projects[ i ]; if( p.getName().equals( getProjectName() ) ) { @@ -992,15 +990,15 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { f = StarTeamFinder.findFolder( v.getRootFolder(), getFolderName() ); assertTrue( null != f, "ERROR: " + getProjectName() + delim + getViewName() + delim + - v.getRootFolder() + delim + getFolderName() + delim + - " does not exist." ); + v.getRootFolder() + delim + getFolderName() + delim + + " does not exist." ); } } if( getVerbose() && getFolderName() != null ) { log( "Found " + getProjectName() + delim + getViewName() + - delim + getFolderName() + delim + "\n" ); + delim + getFolderName() + delim + "\n" ); } // For performance reasons, it is important to pre-fetch all the @@ -1021,13 +1019,13 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task } // Now, build an array of the property names. - String[] strNames = new String[nProperties]; + String[] strNames = new String[ nProperties ]; int iProperty = 0; - strNames[iProperty++] = s.getPropertyNames().OBJECT_ID; - strNames[iProperty++] = p1.getName(); + strNames[ iProperty++ ] = s.getPropertyNames().OBJECT_ID; + strNames[ iProperty++ ] = p1.getName(); if( p2 != null ) { - strNames[iProperty++] = p2.getName(); + strNames[ iProperty++ ] = p2.getName(); } // Pre-fetch the item properties and cache them. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java index 6711b46bf..9f1778702 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Random; 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; @@ -48,7 +49,9 @@ public class CovMerge extends Task //---------------- the tedious job begins here - public CovMerge() { } + public CovMerge() + { + } /** * set the coverage home. it must point to JProbe coverage directories where @@ -94,10 +97,10 @@ public class CovMerge extends Task /** * execute the jpcovmerge by providing a parameter file * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { checkOptions(); @@ -122,12 +125,12 @@ public class CovMerge extends Task int exitValue = exec.execute(); if( exitValue != 0 ) { - throw new BuildException( "JProbe Coverage Merging failed (" + exitValue + ")" ); + throw new TaskException( "JProbe Coverage Merging failed (" + exitValue + ")" ); } } catch( IOException e ) { - throw new BuildException( "Failed to run JProbe Coverage Merge: " + e ); + throw new TaskException( "Failed to run JProbe Coverage Merge: " + e ); } finally { @@ -142,25 +145,26 @@ public class CovMerge extends Task * @return The Snapshots value */ protected File[] getSnapshots() + throws TaskException { Vector v = new Vector(); final int size = filesets.size(); for( int i = 0; i < size; i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); DirectoryScanner ds = fs.getDirectoryScanner( getProject() ); ds.scan(); String[] f = ds.getIncludedFiles(); for( int j = 0; j < f.length; j++ ) { - String pathname = f[j]; + String pathname = f[ j ]; File file = new File( ds.getBasedir(), pathname ); file = resolveFile( file.getPath() ); v.addElement( file ); } } - File[] files = new File[v.size()]; + File[] files = new File[ v.size() ]; v.copyInto( files ); return files; } @@ -168,39 +172,38 @@ public class CovMerge extends Task /** * check for mandatory options * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { if( tofile == null ) { - throw new BuildException( "'tofile' attribute must be set." ); + throw new TaskException( "'tofile' attribute must be set." ); } // check coverage home if( home == null || !home.isDirectory() ) { - throw new BuildException( "Invalid home directory. Must point to JProbe home directory" ); + throw new TaskException( "Invalid home directory. Must point to JProbe home directory" ); } home = new File( home, "coverage" ); File jar = new File( home, "coverage.jar" ); if( !jar.exists() ) { - throw new BuildException( "Cannot find Coverage directory: " + home ); + throw new TaskException( "Cannot find Coverage directory: " + home ); } } - /** * create the parameters file that contains all file to merge and the output * filename. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected File createParamFile() - throws BuildException + throws TaskException { File[] snapshots = getSnapshots(); File file = createTmpFile(); @@ -211,7 +214,7 @@ public class CovMerge extends Task PrintWriter pw = new PrintWriter( fw ); for( int i = 0; i < snapshots.length; i++ ) { - pw.println( snapshots[i].getAbsolutePath() ); + pw.println( snapshots[ i ].getAbsolutePath() ); } // last file is the output snapshot pw.println( resolveFile( tofile.getPath() ) ); @@ -219,7 +222,7 @@ public class CovMerge extends Task } catch( IOException e ) { - throw new BuildException( "I/O error while writing to " + file, e ); + throw new TaskException( "I/O error while writing to " + file, e ); } finally { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java index 01a62e3b4..207c303fc 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.io.File; import java.io.IOException; import java.util.Vector; @@ -16,7 +17,7 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -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.taskdefs.Execute; @@ -26,7 +27,6 @@ import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.Path; import org.w3c.dom.Document; - /** * Convenient task to run the snapshot merge utility for JProbe Coverage 3.0. * @@ -118,8 +118,9 @@ public class CovReport extends Task */ private Reference reference = null; - - public CovReport() { } + public CovReport() + { + } /** * set the filters @@ -141,7 +142,6 @@ public class CovReport extends Task this.format = value.getValue(); } - /** * Set the coverage home. it must point to JProbe coverage directories where * are stored native libraries and jars. @@ -227,7 +227,7 @@ public class CovReport extends Task } public void execute() - throws BuildException + throws TaskException { checkOptions(); try @@ -238,7 +238,7 @@ public class CovReport extends Task String[] params = getParameters(); for( int i = 0; i < params.length; i++ ) { - cmdl.createArgument().setValue( params[i] ); + cmdl.createArgument().setValue( params[ i ] ); } // use the custom handler for stdin issues @@ -249,7 +249,7 @@ public class CovReport extends Task int exitValue = exec.execute(); if( exitValue != 0 ) { - throw new BuildException( "JProbe Coverage Report failed (" + exitValue + ")" ); + throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" ); } log( "coveragePath: " + coveragePath, Project.MSG_VERBOSE ); log( "format: " + format, Project.MSG_VERBOSE ); @@ -261,12 +261,12 @@ public class CovReport extends Task } catch( IOException e ) { - throw new BuildException( "Failed to execute JProbe Coverage Report.", e ); + throw new TaskException( "Failed to execute JProbe Coverage Report.", e ); } } - protected String[] getParameters() + throws TaskException { Vector v = new Vector(); if( format != null ) @@ -300,7 +300,7 @@ public class CovReport extends Task v.addElement( "-inc_src_text=" + ( includeSource ? "on" : "off" ) ); } - String[] params = new String[v.size()]; + String[] params = new String[ v.size() ]; v.copyInto( params ); return params; } @@ -308,28 +308,28 @@ public class CovReport extends Task /** * check for mandatory options * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { if( tofile == null ) { - throw new BuildException( "'tofile' attribute must be set." ); + throw new TaskException( "'tofile' attribute must be set." ); } if( snapshot == null ) { - throw new BuildException( "'snapshot' attribute must be set." ); + throw new TaskException( "'snapshot' attribute must be set." ); } if( home == null ) { - throw new BuildException( "'home' attribute must be set to JProbe home directory" ); + throw new TaskException( "'home' attribute must be set to JProbe home directory" ); } home = new File( home, "coverage" ); File jar = new File( home, "coverage.jar" ); if( !jar.exists() ) { - throw new BuildException( "Cannot find Coverage directory: " + home ); + throw new TaskException( "Cannot find Coverage directory: " + home ); } if( reference != null && !"xml".equals( format ) ) { @@ -355,7 +355,6 @@ public class CovReport extends Task } } - public class Reference { protected Path classPath; @@ -380,18 +379,18 @@ public class CovReport extends Task } protected void createEnhancedXMLReport() - throws BuildException + throws TaskException { // we need a classpath element if( classPath == null ) { - throw new BuildException( "Need a 'classpath' element." ); + throw new TaskException( "Need a 'classpath' element." ); } // and a valid one... String[] paths = classPath.list(); if( paths.length == 0 ) { - throw new BuildException( "Coverage path is invalid. It does not contain any existing path." ); + throw new TaskException( "Coverage path is invalid. It does not contain any existing path." ); } // and we need at least one filter include/exclude. if( filters == null || filters.size() == 0 ) @@ -418,7 +417,7 @@ public class CovReport extends Task } catch( Exception e ) { - throw new BuildException( "Error while performing enhanced XML report from file " + tofile, e ); + throw new TaskException( "Error while performing enhanced XML report from file " + tofile, e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java index 5b0039698..6517128c2 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -14,7 +15,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.Random; 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.taskdefs.Execute; @@ -85,7 +86,9 @@ public class Coverage extends Task //---------------- the tedious job begins here - public Coverage() { } + public Coverage() + { + } /** * default to false unless file is htm or html @@ -267,10 +270,10 @@ public class Coverage extends Task /** * execute the jplauncher by providing a parameter file * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { File paramfile = null; // if an input file is used, all other options are ignored... @@ -297,12 +300,12 @@ public class Coverage extends Task int exitValue = exec.execute(); if( exitValue != 0 ) { - throw new BuildException( "JProbe Coverage failed (" + exitValue + ")" ); + throw new TaskException( "JProbe Coverage failed (" + exitValue + ")" ); } } catch( IOException e ) { - throw new BuildException( "Failed to execute JProbe Coverage.", e ); + throw new TaskException( "Failed to execute JProbe Coverage.", e ); } finally { @@ -322,6 +325,7 @@ public class Coverage extends Task * @return The Parameters value */ protected String[] getParameters() + throws TaskException { Vector params = new Vector(); params.addElement( "-jp_function=" + function ); @@ -358,7 +362,7 @@ public class Coverage extends Task String[] vmargs = cmdlJava.getVmCommand().getArguments(); for( int i = 0; i < vmargs.length; i++ ) { - params.addElement( vmargs[i] ); + params.addElement( vmargs[ i ] ); } // classpath Path classpath = cmdlJava.getClasspath(); @@ -375,10 +379,10 @@ public class Coverage extends Task String[] args = cmdlJava.getJavaCommand().getArguments(); for( int i = 0; i < args.length; i++ ) { - params.addElement( args[i] ); + params.addElement( args[ i ] ); } - String[] array = new String[params.size()]; + String[] array = new String[ params.size() ]; params.copyInto( array ); return array; } @@ -386,21 +390,21 @@ public class Coverage extends Task /** * wheck what is necessary to check, Coverage will do the job for us * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { // check coverage home if( home == null || !home.isDirectory() ) { - throw new BuildException( "Invalid home directory. Must point to JProbe home directory" ); + throw new TaskException( "Invalid home directory. Must point to JProbe home directory" ); } home = new File( home, "coverage" ); File jar = new File( home, "coverage.jar" ); if( !jar.exists() ) { - throw new BuildException( "Cannot find Coverage directory: " + home ); + throw new TaskException( "Cannot find Coverage directory: " + home ); } // make sure snapshot dir exists and is resolved @@ -411,7 +415,7 @@ public class Coverage extends Task snapshotDir = resolveFile( snapshotDir.getPath() ); if( !snapshotDir.isDirectory() || !snapshotDir.exists() ) { - throw new BuildException( "Snapshot directory does not exists :" + snapshotDir ); + throw new TaskException( "Snapshot directory does not exists :" + snapshotDir ); } if( workingDir == null ) { @@ -440,18 +444,17 @@ public class Coverage extends Task } } - /** * create the parameter file from the given options. The file is created * with a random name in the current directory. * * @return the file object where are written the configuration to run JProbe * Coverage - * @throws BuildException thrown if something bad happens while writing the + * @throws TaskException thrown if something bad happens while writing the * arguments to the file. */ protected File createParamFile() - throws BuildException + throws TaskException { //@todo change this when switching to JDK 1.2 and use File.createTmpFile() File file = createTmpFile(); @@ -464,7 +467,7 @@ public class Coverage extends Task String[] params = getParameters(); for( int i = 0; i < params.length; i++ ) { - pw.println( params[i] ); + pw.println( params[ i ] ); } pw.flush(); log( "JProbe Coverage parameters:\n" + sw.toString(), Project.MSG_VERBOSE ); @@ -479,7 +482,7 @@ public class Coverage extends Task } catch( IOException e ) { - throw new BuildException( "Could not write parameter file " + file, e ); + throw new TaskException( "Could not write parameter file " + file, e ); } finally { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java index 6b6c9b345..2615352f4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.util.Vector; /** @@ -31,7 +32,9 @@ public class Filters */ protected Vector filters = new Vector(); - public Filters() { } + public Filters() + { + } public void setDefaultExclude( boolean value ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java index d8b5f2307..9f0c0438d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.util.Vector; import org.apache.tools.ant.util.regexp.RegexpMatcher; import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; @@ -28,7 +29,9 @@ public class ReportFilters */ protected Vector matchers = null; - public ReportFilters() { } + public ReportFilters() + { + } /** * Check whether a given <classname><method>() is accepted by @@ -51,8 +54,8 @@ public class ReportFilters final int size = filters.size(); for( int i = 0; i < size; i++ ) { - FilterElement filter = ( FilterElement )filters.elementAt( i ); - RegexpMatcher matcher = ( RegexpMatcher )matchers.elementAt( i ); + FilterElement filter = (FilterElement)filters.elementAt( i ); + RegexpMatcher matcher = (RegexpMatcher)matchers.elementAt( i ); if( filter instanceof Include ) { result = result || matcher.matches( methodname ); @@ -95,7 +98,7 @@ public class ReportFilters matchers = new Vector(); for( int i = 0; i < size; i++ ) { - FilterElement filter = ( FilterElement )filters.elementAt( i ); + FilterElement filter = (FilterElement)filters.elementAt( i ); RegexpMatcher matcher = factory.newRegexpMatcher(); String pattern = filter.getAsPattern(); matcher.setPattern( pattern ); @@ -112,7 +115,6 @@ public class ReportFilters { } - /** * default abstract filter element class * diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java index 5675959ed..6f693979c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java @@ -17,7 +17,9 @@ public final class StringUtil /** * private constructor, it's a utility class */ - private StringUtil() { } + private StringUtil() + { + } /** * Replaces all occurences of find with replacement in the diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java index c7d716f44..e99cd2b5d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.util.Hashtable; import java.util.Vector; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Trigger information. It will return as a command line argument by calling the @@ -44,7 +45,9 @@ public class Triggers eventMap.put( "exit", "X" ); } - public Triggers() { } + public Triggers() + { + } public void addMethod( Method method ) { @@ -67,7 +70,6 @@ public class Triggers return buf.toString(); } - public static class Method { protected String action; @@ -76,11 +78,11 @@ public class Triggers protected String param; public void setAction( String value ) - throws BuildException + throws TaskException { if( actionMap.get( value ) == null ) { - throw new BuildException( "Invalid action, must be one of " + actionMap ); + throw new TaskException( "Invalid action, must be one of " + actionMap ); } action = value; } @@ -89,7 +91,7 @@ public class Triggers { if( eventMap.get( value ) == null ) { - throw new BuildException( "Invalid event, must be one of " + eventMap ); + throw new TaskException( "Invalid event, must be one of " + eventMap ); } event = value; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java index f6ce7d400..078dd7db4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.io.File; import java.io.FileInputStream; import java.util.Enumeration; @@ -150,13 +151,13 @@ public class XMLReport Enumeration enum = cpl.loaders(); while( enum.hasMoreElements() ) { - ClassPathLoader.FileLoader fl = ( ClassPathLoader.FileLoader )enum.nextElement(); + ClassPathLoader.FileLoader fl = (ClassPathLoader.FileLoader)enum.nextElement(); ClassFile[] classes = fl.getClasses(); log( "Processing " + classes.length + " classes in " + fl.getFile() ); // process all classes for( int i = 0; i < classes.length; i++ ) { - classFiles.put( classes[i].getFullName(), classes[i] ); + classFiles.put( classes[ i ].getFullName(), classes[ i ] ); } } @@ -178,7 +179,7 @@ public class XMLReport Enumeration classes = classFiles.elements(); while( classes.hasMoreElements() ) { - ClassFile cf = ( ClassFile )classes.nextElement(); + ClassFile cf = (ClassFile)classes.nextElement(); serializeClass( cf ); } // update the document with the stats @@ -208,14 +209,14 @@ public class XMLReport Node child = children.item( i ); if( child.getNodeType() == Node.ELEMENT_NODE ) { - Element elem = ( Element )child; + Element elem = (Element)child; if( "class".equals( elem.getNodeName() ) ) { v.addElement( elem ); } } } - Element[] elems = new Element[v.size()]; + Element[] elems = new Element[ v.size() ]; v.copyInto( elems ); return elems; } @@ -229,7 +230,7 @@ public class XMLReport Node child = children.item( i ); if( child.getNodeType() == Node.ELEMENT_NODE ) { - Element elem = ( Element )child; + Element elem = (Element)child; if( "cov.data".equals( elem.getNodeName() ) ) { return elem; @@ -245,7 +246,7 @@ public class XMLReport Vector methods = new Vector( methodlist.length ); for( int i = 0; i < methodlist.length; i++ ) { - MethodInfo method = methodlist[i]; + MethodInfo method = methodlist[ i ]; String signature = getMethodSignature( classFile, method ); if( filters.accept( signature ) ) { @@ -254,7 +255,7 @@ public class XMLReport } else { -// log("discarding " + signature); + // log("discarding " + signature); } } return methods; @@ -274,17 +275,17 @@ public class XMLReport String[] params = method.getParametersType(); for( int i = 0; i < params.length; i++ ) { - String type = params[i]; + String type = params[ i ]; int pos = type.lastIndexOf( '.' ); if( pos != -1 ) { String pkg = type.substring( 0, pos ); if( "java.lang".equals( pkg ) ) { - params[i] = type.substring( pos + 1 ); + params[ i ] = type.substring( pos + 1 ); } } - buf.append( params[i] ); + buf.append( params[ i ] ); if( i != params.length - 1 ) { buf.append( ", " ); @@ -321,7 +322,7 @@ public class XMLReport Node child = children.item( i ); if( child.getNodeType() == Node.ELEMENT_NODE ) { - Element elem = ( Element )child; + Element elem = (Element)child; if( "method".equals( elem.getNodeName() ) ) { String name = elem.getAttribute( "name" ); @@ -342,14 +343,14 @@ public class XMLReport Node child = children.item( i ); if( child.getNodeType() == Node.ELEMENT_NODE ) { - Element elem = ( Element )child; + Element elem = (Element)child; if( "package".equals( elem.getNodeName() ) ) { v.addElement( elem ); } } } - Element[] elems = new Element[v.size()]; + Element[] elems = new Element[ v.size() ]; v.copyInto( elems ); return elems; } @@ -402,7 +403,6 @@ public class XMLReport return methodElem; } - /** * create node maps so that we can access node faster by their name */ @@ -417,7 +417,7 @@ public class XMLReport log( "Indexing " + pkglen + " packages" ); for( int i = pkglen - 1; i > -1; i-- ) { - Element pkg = ( Element )packages.item( i ); + Element pkg = (Element)packages.item( i ); String pkgname = pkg.getAttribute( "name" ); int nbclasses = 0; @@ -428,7 +428,7 @@ public class XMLReport log( "Indexing " + classlen + " classes in package " + pkgname ); for( int j = classlen - 1; j > -1; j-- ) { - Element clazz = ( Element )classes.item( j ); + Element clazz = (Element)classes.item( j ); String classname = clazz.getAttribute( "name" ); if( pkgname != null && pkgname.length() != 0 ) { @@ -440,7 +440,7 @@ public class XMLReport final int methodlen = methods.getLength(); for( int k = methodlen - 1; k > -1; k-- ) { - Element meth = ( Element )methods.item( k ); + Element meth = (Element)methods.item( k ); StringBuffer methodname = new StringBuffer( meth.getAttribute( "name" ) ); methodname.delete( methodname.toString().indexOf( "(" ), methodname.toString().length() ); String signature = classname + "." + methodname + "()"; @@ -516,9 +516,9 @@ public class XMLReport final int size = methods.length; for( int i = 0; i < size; i++ ) { - MethodInfo method = methods[i]; + MethodInfo method = methods[ i ]; String methodSig = getMethodSignature( method ); - Element methodNode = ( Element )methodNodeList.get( methodSig ); + Element methodNode = (Element)methodNodeList.get( methodSig ); if( methodNode != null && Utils.isAbstract( method.getAccessFlags() ) ) { @@ -538,7 +538,7 @@ public class XMLReport // the class already is reported so ignore it String fullclassname = classFile.getFullName(); log( "Looking for '" + fullclassname + "'" ); - Element clazz = ( Element )classMap.get( fullclassname ); + Element clazz = (Element)classMap.get( fullclassname ); // ignore classes that are already reported, all the information is // already there. @@ -564,7 +564,7 @@ public class XMLReport String pkgname = classFile.getPackage(); // System.out.println("Looking for package " + pkgname); - Element pkgElem = ( Element )pkgMap.get( pkgname ); + Element pkgElem = (Element)pkgMap.get( pkgname ); if( pkgElem == null ) { pkgElem = createPackageElement( pkgname ); @@ -582,7 +582,7 @@ public class XMLReport for( int i = 0; i < methods.size(); i++ ) { // create the method element - MethodInfo method = ( MethodInfo )methods.elementAt( i ); + MethodInfo method = (MethodInfo)methods.elementAt( i ); if( Utils.isAbstract( method.getAccessFlags() ) ) { continue;// no need to report abstract methods @@ -601,7 +601,6 @@ public class XMLReport classMap.put( fullclassname, classElem ); } - /** * update the count of the XML, that is accumulate the stats on methods, * classes and package so that the numbers are valid according to the info @@ -619,7 +618,7 @@ public class XMLReport Enumeration enum = pkgMap.elements(); while( enum.hasMoreElements() ) { - Element pkgElem = ( Element )enum.nextElement(); + Element pkgElem = (Element)enum.nextElement(); String pkgname = pkgElem.getAttribute( "name" ); Element[] classes = getClasses( pkgElem ); int pkg_calls = 0; @@ -630,7 +629,7 @@ public class XMLReport //System.out.println("Processing package '" + pkgname + "': " + classes.length + " classes"); for( int j = 0; j < classes.length; j++ ) { - Element clazz = classes[j]; + Element clazz = classes[ j ]; String classname = clazz.getAttribute( "name" ); if( pkgname != null && pkgname.length() != 0 ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java index 25bf53a4d..228299b9a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; + import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; @@ -14,7 +15,6 @@ import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; import org.apache.tools.ant.taskdefs.optional.depend.constantpool.Utf8CPInfo; import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.attributes.AttributeInfo; - /** * Object representing a class. Information are kept to the strict minimum for * JProbe reports so that not too many objects are created for a class, @@ -50,7 +50,7 @@ public final class ClassFile // class information access_flags = dis.readShort(); int this_class = dis.readShort(); - fullname = ( ( ClassCPInfo )constantPool.getEntry( this_class ) ).getClassName().replace( '/', '.' ); + fullname = ( (ClassCPInfo)constantPool.getEntry( this_class ) ).getClassName().replace( '/', '.' ); int super_class = dis.readShort(); // skip interfaces... @@ -75,11 +75,11 @@ public final class ClassFile // read methods int method_count = dis.readShort(); - methods = new MethodInfo[method_count]; + methods = new MethodInfo[ method_count ]; for( int i = 0; i < method_count; i++ ) { - methods[i] = new MethodInfo(); - methods[i].read( constantPool, dis ); + methods[ i ] = new MethodInfo(); + methods[ i ].read( constantPool, dis ); } // get interesting attributes. @@ -92,7 +92,7 @@ public final class ClassFile if( AttributeInfo.SOURCE_FILE.equals( attr_name ) ) { int name_index = dis.readShort(); - sourceFile = ( ( Utf8CPInfo )constantPool.getEntry( name_index ) ).getValue(); + sourceFile = ( (Utf8CPInfo)constantPool.getEntry( name_index ) ).getValue(); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java index 26f19526c..ff2b49b0d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; + import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -52,7 +53,7 @@ public class ClassPathLoader File file = new File( st.nextToken() ); entries.addElement( file ); } - files = new File[entries.size()]; + files = new File[ entries.size() ]; entries.copyInto( files ); } @@ -63,10 +64,10 @@ public class ClassPathLoader */ public ClassPathLoader( String[] entries ) { - files = new File[entries.length]; + files = new File[ entries.length ]; for( int i = 0; i < entries.length; i++ ) { - files[i] = new File( entries[i] ); + files[ i ] = new File( entries[ i ] ); } } @@ -93,7 +94,7 @@ public class ClassPathLoader throws IOException { is = new BufferedInputStream( is ); - byte[] buffer = new byte[8192]; + byte[] buffer = new byte[ 8192 ]; ByteArrayOutputStream baos = new ByteArrayOutputStream( 2048 ); int n; baos.reset(); @@ -124,7 +125,7 @@ public class ClassPathLoader Enumeration enum = loaders(); while( enum.hasMoreElements() ) { - FileLoader loader = ( FileLoader )enum.nextElement(); + FileLoader loader = (FileLoader)enum.nextElement(); System.out.println( "Processing " + loader.getFile() ); long t0 = System.currentTimeMillis(); ClassFile[] classes = loader.getClasses(); @@ -132,12 +133,12 @@ public class ClassPathLoader System.out.println( "" + classes.length + " classes loaded in " + dt + "ms" ); for( int j = 0; j < classes.length; j++ ) { - String name = classes[j].getFullName(); + String name = classes[ j ].getFullName(); // do not allow duplicates entries to preserve 'classpath' behavior // first class in wins if( !map.containsKey( name ) ) { - map.put( name, classes[j] ); + map.put( name, classes[ j ] ); } } } @@ -197,7 +198,7 @@ public class ClassPathLoader { throw new NoSuchElementException(); } - File file = files[index++]; + File file = files[ index++ ]; if( !file.exists() ) { return new NullLoader( file ); @@ -240,7 +241,7 @@ class NullLoader implements ClassPathLoader.FileLoader public ClassFile[] getClasses() throws IOException { - return new ClassFile[0]; + return new ClassFile[ 0 ]; } public File getFile() @@ -273,7 +274,7 @@ class JarLoader implements ClassPathLoader.FileLoader Enumeration entries = zipFile.entries(); while( entries.hasMoreElements() ) { - ZipEntry entry = ( ZipEntry )entries.nextElement(); + ZipEntry entry = (ZipEntry)entries.nextElement(); if( entry.getName().endsWith( ".class" ) ) { InputStream is = ClassPathLoader.getCachedStream( zipFile.getInputStream( entry ) ); @@ -282,7 +283,7 @@ class JarLoader implements ClassPathLoader.FileLoader v.addElement( classFile ); } } - ClassFile[] classes = new ClassFile[v.size()]; + ClassFile[] classes = new ClassFile[ v.size() ]; v.copyInto( classes ); return classes; } @@ -346,7 +347,7 @@ class DirectoryLoader implements ClassPathLoader.FileLoader String[] files = directory.list( filter ); for( int i = 0; i < files.length; i++ ) { - list.addElement( new File( directory, files[i] ) ); + list.addElement( new File( directory, files[ i ] ) ); } files = null;// we don't need it anymore if( recurse ) @@ -354,7 +355,7 @@ class DirectoryLoader implements ClassPathLoader.FileLoader String[] subdirs = directory.list( new DirectoryFilter() ); for( int i = 0; i < subdirs.length; i++ ) { - listFilesTo( list, new File( directory, subdirs[i] ), filter, recurse ); + listFilesTo( list, new File( directory, subdirs[ i ] ), filter, recurse ); } } return list; @@ -367,7 +368,7 @@ class DirectoryLoader implements ClassPathLoader.FileLoader Vector files = listFiles( directory, new ClassFilter(), true ); for( int i = 0; i < files.size(); i++ ) { - File file = ( File )files.elementAt( i ); + File file = (File)files.elementAt( i ); InputStream is = null; try { @@ -386,11 +387,12 @@ class DirectoryLoader implements ClassPathLoader.FileLoader is.close(); } catch( IOException ignored ) - {} + { + } } } } - ClassFile[] classes = new ClassFile[v.size()]; + ClassFile[] classes = new ClassFile[ v.size() ]; v.copyInto( classes ); return classes; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java index 5d335ae3b..b3d648841 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; + import java.io.DataInputStream; import java.io.IOException; import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; @@ -24,7 +25,9 @@ public final class MethodInfo private String descriptor; private String name; - public MethodInfo() { } + public MethodInfo() + { + } public String getAccess() { @@ -73,7 +76,7 @@ public final class MethodInfo String[] params = getParametersType(); for( int i = 0; i < params.length; i++ ) { - buf.append( params[i] ); + buf.append( params[ i ] ); if( i != params.length - 1 ) { buf.append( ", " ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java index 74af7a06e..b9de64698 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; + import java.util.Vector; import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; import org.apache.tools.ant.taskdefs.optional.depend.constantpool.Utf8CPInfo; @@ -73,7 +74,9 @@ public class Utils /** * private constructor */ - private Utils() { } + private Utils() + { + } /** * return the class access flag as java modifiers @@ -231,7 +234,7 @@ public class Utils break; } } - String[] array = new String[params.size()]; + String[] array = new String[ params.size() ]; params.copyInto( array ); return array; } @@ -260,7 +263,7 @@ public class Utils */ public static String getUTF8Value( ConstantPool pool, int index ) { - return ( ( Utf8CPInfo )pool.getEntry( index ) ).getValue(); + return ( (Utf8CPInfo)pool.getEntry( index ) ).getValue(); } /** @@ -434,49 +437,49 @@ public class Utils dim.append( "[]" ); } // now get the type - switch ( descriptor.charAt( i ) ) + switch( descriptor.charAt( i ) ) { - case 'B': - sb.append( "byte" ); - break; - case 'C': - sb.append( "char" ); - break; - case 'D': - sb.append( "double" ); - break; - case 'F': - sb.append( "float" ); - break; - case 'I': - sb.append( "int" ); - break; - case 'J': - sb.append( "long" ); - break; - case 'S': - sb.append( "short" ); - break; - case 'Z': - sb.append( "boolean" ); - break; - case 'V': - sb.append( "void" ); - break; - case 'L': - // it is a class - int pos = descriptor.indexOf( ';', i + 1 ); - String classname = descriptor.substring( i + 1, pos ).replace( '/', '.' ); - sb.append( classname ); - i = pos; - break; - default: - //@todo, yeah this happens because I got things like: - // ()Ljava/lang/Object; and it will return and ) will be here - // think about it. + case 'B': + sb.append( "byte" ); + break; + case 'C': + sb.append( "char" ); + break; + case 'D': + sb.append( "double" ); + break; + case 'F': + sb.append( "float" ); + break; + case 'I': + sb.append( "int" ); + break; + case 'J': + sb.append( "long" ); + break; + case 'S': + sb.append( "short" ); + break; + case 'Z': + sb.append( "boolean" ); + break; + case 'V': + sb.append( "void" ); + break; + case 'L': + // it is a class + int pos = descriptor.indexOf( ';', i + 1 ); + String classname = descriptor.substring( i + 1, pos ).replace( '/', '.' ); + sb.append( classname ); + i = pos; + break; + default: + //@todo, yeah this happens because I got things like: + // ()Ljava/lang/Object; and it will return and ) will be here + // think about it. - //ooooops should never happen - //throw new IllegalArgumentException("Invalid descriptor symbol: '" + i + "' in '" + descriptor + "'"); + //ooooops should never happen + //throw new IllegalArgumentException("Invalid descriptor symbol: '" + i + "' in '" + descriptor + "'"); } sb.append( dim.toString() ); return ++i; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java index 64e1b8e88..a69f1086a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sound; + import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioFormat; @@ -14,17 +15,14 @@ import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; -import javax.sound.sampled.LineEvent;// imports for all the sound classes required -// note: comes with jmf or jdk1.3 + -// these can be obtained from http://java.sun.com/products/java-media/sound/ +import javax.sound.sampled.LineEvent; import javax.sound.sampled.LineListener; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; -import org.apache.tools.ant.BuildEvent;// ant includes +import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.Project; - /** * This class is designed to be used by any AntTask that requires audio output. * It implements the BuildListener interface to listen for BuildEvents and could @@ -47,8 +45,9 @@ public class AntSoundPlayer implements LineListener, BuildListener private int loopsFail = 0; private Long durationFail = null; - public AntSoundPlayer() { } - + public AntSoundPlayer() + { + } /** * @param fileFail The feature to be added to the BuildFailedSound attribute @@ -98,13 +97,14 @@ public class AntSoundPlayer implements LineListener, BuildListener } } - /** * Fired before any targets are started. * * @param event Description of Parameter */ - public void buildStarted( BuildEvent event ) { } + public void buildStarted( BuildEvent event ) + { + } /** * Fired whenever a message is logged. @@ -113,7 +113,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @see BuildEvent#getMessage() * @see BuildEvent#getPriority() */ - public void messageLogged( BuildEvent event ) { } + public void messageLogged( BuildEvent event ) + { + } /** * Fired when a target has finished. This event will still be thrown if an @@ -122,7 +124,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @param event Description of Parameter * @see BuildEvent#getException() */ - public void targetFinished( BuildEvent event ) { } + public void targetFinished( BuildEvent event ) + { + } /** * Fired when a target is started. @@ -130,7 +134,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @param event Description of Parameter * @see BuildEvent#getTarget() */ - public void targetStarted( BuildEvent event ) { } + public void targetStarted( BuildEvent event ) + { + } /** * Fired when a task has finished. This event will still be throw if an @@ -139,7 +145,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @param event Description of Parameter * @see BuildEvent#getException() */ - public void taskFinished( BuildEvent event ) { } + public void taskFinished( BuildEvent event ) + { + } /** * Fired when a task is started. @@ -147,7 +155,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @param event Description of Parameter * @see BuildEvent#getTask() */ - public void taskStarted( BuildEvent event ) { } + public void taskStarted( BuildEvent event ) + { + } /** * This is implemented to listen for any line events and closes the clip if @@ -205,10 +215,10 @@ public class AntSoundPlayer implements LineListener, BuildListener { AudioFormat format = audioInputStream.getFormat(); DataLine.Info info = new DataLine.Info( Clip.class, format, - AudioSystem.NOT_SPECIFIED ); + AudioSystem.NOT_SPECIFIED ); try { - audioClip = ( Clip )AudioSystem.getLine( info ); + audioClip = (Clip)AudioSystem.getLine( info ); audioClip.addLineListener( this ); audioClip.open( audioInputStream ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java index 8854c4c0d..3f20c2c7c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sound; + import java.io.File; import java.util.Random; 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; @@ -33,7 +34,9 @@ public class SoundTask extends Task private BuildAlert success = null; private BuildAlert fail = null; - public SoundTask() { } + public SoundTask() + { + } public BuildAlert createFail() { @@ -59,7 +62,7 @@ public class SoundTask extends Task else { soundPlayer.addBuildSuccessfulSound( success.getSource(), - success.getLoops(), success.getDuration() ); + success.getLoops(), success.getDuration() ); } if( fail == null ) @@ -69,14 +72,16 @@ public class SoundTask extends Task else { soundPlayer.addBuildFailedSound( fail.getSource(), - fail.getLoops(), fail.getDuration() ); + fail.getLoops(), fail.getDuration() ); } getProject().addBuildListener( soundPlayer ); } - public void init() { } + public void init() + { + } /** * A class to be extended by any BuildAlert's that require the output of @@ -158,7 +163,7 @@ public class SoundTask extends Task Vector files = new Vector(); for( int i = 0; i < entries.length; i++ ) { - File f = new File( source, entries[i] ); + File f = new File( source, entries[ i ] ); if( f.isFile() ) { files.addElement( f ); @@ -166,14 +171,14 @@ public class SoundTask extends Task } if( files.size() < 1 ) { - throw new BuildException( "No files found in directory " + source ); + throw new TaskException( "No files found in directory " + source ); } int numfiles = files.size(); // get a random number between 0 and the number of files Random rn = new Random(); int x = rn.nextInt( numfiles ); // set the source to the file at that location - this.source = ( File )files.elementAt( x ); + this.source = (File)files.elementAt( x ); } } else diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java index 63a63e54a..7dfcfdf5e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; -import org.apache.tools.ant.BuildException; + +import java.io.IOException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Execute; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; -import java.io.IOException; /** * A base class for creating tasks for executing commands on Visual SourceSafe. @@ -203,8 +204,8 @@ public abstract class MSVSS extends Task try { Execute exe = new Execute( new LogStreamHandler( this, - Project.MSG_INFO, - Project.MSG_WARN ) ); + Project.MSG_INFO, + Project.MSG_WARN ) ); // If location of ss.ini is specified we need to set the // environment-variable SSDIR to this value @@ -213,14 +214,14 @@ public abstract class MSVSS extends Task String[] env = exe.getEnvironment(); if( env == null ) { - env = new String[0]; + env = new String[ 0 ]; } - String[] newEnv = new String[env.length + 1]; + String[] newEnv = new String[ env.length + 1 ]; for( int i = 0; i < env.length; i++ ) { - newEnv[i] = env[i]; + newEnv[ i ] = env[ i ]; } - newEnv[env.length] = "SSDIR=" + m_serverPath; + newEnv[ env.length ] = "SSDIR=" + m_serverPath; exe.setEnvironment( newEnv ); } @@ -232,7 +233,7 @@ public abstract class MSVSS extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java index c69dc33b1..7377accf3 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -134,6 +135,7 @@ public class MSVSSCHECKIN extends MSVSS * @param cmd Description of Parameter */ public void getLocalpathCommand( Commandline cmd ) + throws TaskException { if( m_LocalPath == null ) { @@ -150,7 +152,7 @@ public class MSVSSCHECKIN extends MSVSS { String msg = "Directory " + m_LocalPath + " creation was not " + "succesful for an unknown reason"; - throw new BuildException( msg ); + throw new TaskException( msg ); } project.log( "Created dir: " + dir.getAbsolutePath() ); } @@ -195,10 +197,10 @@ public class MSVSSCHECKIN extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -207,7 +209,7 @@ public class MSVSSCHECKIN extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -237,7 +239,7 @@ public class MSVSSCHECKIN extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java index e3f0124ee..3b5899173 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -161,6 +162,7 @@ public class MSVSSCHECKOUT extends MSVSS * @param cmd Description of Parameter */ public void getLocalpathCommand( Commandline cmd ) + throws TaskException { if( m_LocalPath == null ) { @@ -177,7 +179,7 @@ public class MSVSSCHECKOUT extends MSVSS { String msg = "Directory " + m_LocalPath + " creation was not " + "succesful for an unknown reason"; - throw new BuildException( msg ); + throw new TaskException( msg ); } project.log( "Created dir: " + dir.getAbsolutePath() ); } @@ -230,10 +232,10 @@ public class MSVSSCHECKOUT extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -242,7 +244,7 @@ public class MSVSSCHECKOUT extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -270,7 +272,7 @@ public class MSVSSCHECKOUT extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java index 8ec462510..82dad7363 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -369,6 +370,7 @@ public class MSVSSGET extends MSVSS * @param cmd Description of Parameter */ public void getLocalpathCommand( Commandline cmd ) + throws TaskException { if( m_LocalPath == null ) { @@ -385,7 +387,7 @@ public class MSVSSGET extends MSVSS { String msg = "Directory " + m_LocalPath + " creation was not " + "successful for an unknown reason"; - throw new BuildException( msg ); + throw new TaskException( msg ); } project.log( "Created dir: " + dir.getAbsolutePath() ); } @@ -461,10 +463,10 @@ public class MSVSSGET extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -473,7 +475,7 @@ public class MSVSSGET extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -505,7 +507,7 @@ public class MSVSSGET extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java index 58b2d1e4f..dfea9efc5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; + import java.io.File; import java.text.DateFormat; import java.text.ParseException; @@ -13,7 +14,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.EnumeratedAttribute; @@ -160,7 +161,7 @@ public class MSVSSHISTORY extends MSVSS } else { - throw new BuildException( "Style " + attr + " unknown." ); + throw new TaskException( "Style " + attr + " unknown." ); } } @@ -214,10 +215,10 @@ public class MSVSSHISTORY extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -226,7 +227,7 @@ public class MSVSSHISTORY extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -272,7 +273,7 @@ public class MSVSSHISTORY extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -322,10 +323,10 @@ public class MSVSSHISTORY extends MSVSS * Builds the version date command. * * @param cmd the commandline the command is to be added to - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void getVersionDateCommand( Commandline cmd ) - throws BuildException + throws TaskException { if( m_FromDate == null && m_ToDate == null && m_NumDays == Integer.MIN_VALUE ) { @@ -346,7 +347,7 @@ public class MSVSSHISTORY extends MSVSS catch( ParseException ex ) { String msg = "Error parsing date: " + m_ToDate; - throw new BuildException( msg ); + throw new TaskException( msg ); } cmd.createArgument().setValue( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + startDate ); } @@ -360,7 +361,7 @@ public class MSVSSHISTORY extends MSVSS catch( ParseException ex ) { String msg = "Error parsing date: " + m_FromDate; - throw new BuildException( msg ); + throw new TaskException( msg ); } cmd.createArgument().setValue( FLAG_VERSION_DATE + endDate + VALUE_FROMDATE + m_FromDate ); } @@ -381,10 +382,10 @@ public class MSVSSHISTORY extends MSVSS * Builds the version date command. * * @param cmd the commandline the command is to be added to - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void getVersionLabelCommand( Commandline cmd ) - throws BuildException + throws TaskException { if( m_FromLabel == null && m_ToLabel == null ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java index d9ac730f8..cc4b6c472 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; /** @@ -316,10 +317,10 @@ public class MSVSSLABEL extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -328,12 +329,12 @@ public class MSVSSLABEL extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } if( getLabel() == null ) { String msg = "label attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -368,7 +369,7 @@ public class MSVSSLABEL extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index 934d8e199..4ec600fbf 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -6,13 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; + import java.io.File; import java.util.Random; import java.util.Vector; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Rmic; import org.apache.tools.ant.types.Commandline; -import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.FileNameMapper; @@ -35,7 +35,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter private Rmic attributes; private FileNameMapper mapper; - public DefaultRmicAdapter() { } + public DefaultRmicAdapter() + { + } public void setRmic( Rmic attributes ) { @@ -93,7 +95,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { for( int i = 0; i < options.length; i++ ) { - cmd.createArgument().setValue( options[i] ); + cmd.createArgument().setValue( options[ i ] ); } } @@ -144,7 +146,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter if( attributes.getIiopopts() != null ) { attributes.log( "IIOP Options: " + attributes.getIiopopts(), - Project.MSG_INFO ); + Project.MSG_INFO ); cmd.createArgument().setValue( attributes.getIiopopts() ); } } @@ -157,7 +159,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { cmd.createArgument().setValue( attributes.getIdlopts() ); attributes.log( "IDL Options: " + attributes.getIdlopts(), - Project.MSG_INFO ); + Project.MSG_INFO ); } } @@ -237,7 +239,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter Vector compileList = attributes.getCompileList(); attributes.log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); StringBuffer niceSourceList = new StringBuffer( "File" ); if( compileList.size() != 1 ) @@ -248,7 +250,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter for( int i = 0; i < compileList.size(); i++ ) { - String arg = ( String )compileList.elementAt( i ); + String arg = (String)compileList.elementAt( i ); cmd.createArgument().setValue( arg ); niceSourceList.append( " " + arg ); } @@ -264,29 +266,35 @@ public abstract class DefaultRmicAdapter implements RmicAdapter private class RmicFileNameMapper implements FileNameMapper { - RmicFileNameMapper() { } + RmicFileNameMapper() + { + } /** * Empty implementation. * * @param s The new From value */ - public void setFrom( String s ) { } + public void setFrom( String s ) + { + } /** * Empty implementation. * * @param s The new To value */ - public void setTo( String s ) { } + public void setTo( String s ) + { + } public String[] mapFileName( String name ) { if( name == null - || !name.endsWith( ".class" ) - || name.endsWith( getStubClassSuffix() + ".class" ) - || name.endsWith( getSkelClassSuffix() + ".class" ) - || name.endsWith( getTieClassSuffix() + ".class" ) ) + || !name.endsWith( ".class" ) + || name.endsWith( getStubClassSuffix() + ".class" ) + || name.endsWith( getSkelClassSuffix() + ".class" ) + || name.endsWith( getTieClassSuffix() + ".class" ) ) { // Not a .class file or the one we'd generate return null; @@ -317,14 +325,14 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { target = new String[]{ base + getStubClassSuffix() + ".class" - }; + }; } else { target = new String[]{ base + getStubClassSuffix() + ".class", base + getSkelClassSuffix() + ".class", - }; + }; } } else if( !attributes.getIdl() ) @@ -358,8 +366,8 @@ public abstract class DefaultRmicAdapter implements RmicAdapter // only stub, no tie target = new String[]{ dirname + "_" + filename + getStubClassSuffix() - + ".class" - }; + + ".class" + }; } else { @@ -386,28 +394,28 @@ public abstract class DefaultRmicAdapter implements RmicAdapter target = new String[]{ dirname + "_" + filename + getTieClassSuffix() - + ".class", + + ".class", iDir + "_" + iName.substring( iIndex ) - + getStubClassSuffix() + ".class" - }; + + getStubClassSuffix() + ".class" + }; } } catch( ClassNotFoundException e ) { attributes.log( "Unable to verify class " + classname - + ". It could not be found.", - Project.MSG_WARN ); + + ". It could not be found.", + Project.MSG_WARN ); } catch( NoClassDefFoundError e ) { attributes.log( "Unable to verify class " + classname - + ". It is not defined.", Project.MSG_WARN ); + + ". It is not defined.", Project.MSG_WARN ); } catch( Throwable t ) { attributes.log( "Unable to verify class " + classname - + ". Loading caused Exception: " - + t.getMessage(), Project.MSG_WARN ); + + ". Loading caused Exception: " + + t.getMessage(), Project.MSG_WARN ); } } return target; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java index c835faf9f..cfc02497d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; + import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; @@ -21,7 +22,7 @@ public class KaffeRmic extends DefaultRmicAdapter { public boolean execute() - throws BuildException + throws TaskException { getRmic().log( "Using Kaffe rmic", Project.MSG_VERBOSE ); Commandline cmd = setupRmicCommand(); @@ -34,25 +35,25 @@ public class KaffeRmic extends DefaultRmicAdapter Object rmic = cons.newInstance( new Object[]{cmd.getArguments()} ); Method doRmic = c.getMethod( "run", null ); String str[] = cmd.getArguments(); - Boolean ok = ( Boolean )doRmic.invoke( rmic, null ); + Boolean ok = (Boolean)doRmic.invoke( rmic, null ); return ok.booleanValue(); } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use Kaffe rmic, as it is not available" + - " A common solution is to set the environment variable" + - " JAVA_HOME or CLASSPATH." ); + throw new TaskException( "Cannot use Kaffe rmic, as it is not available" + + " A common solution is to set the environment variable" + + " JAVA_HOME or CLASSPATH." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting Kaffe rmic: ", ex ); + throw new TaskException( "Error starting Kaffe rmic: ", ex ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java index 34491f984..0bfc26448 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.taskdefs.Rmic; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.FileNameMapper; @@ -38,10 +39,10 @@ public interface RmicAdapter * Executes the task. * * @return has the compilation been successful - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean execute() - throws BuildException; + throws TaskException; /** * Maps source class files to the files generated by this rmic diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java index a8b21d048..fa5000e98 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java @@ -6,9 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; +import org.apache.myrmidon.api.TaskException; +import org.apache.tools.ant.Task; /** * Creates the necessary rmic adapter, given basic criteria. @@ -22,7 +22,9 @@ public class RmicAdapterFactory /** * This is a singlton -- can't create instances!! */ - private RmicAdapterFactory() { } + private RmicAdapterFactory() + { + } /** * Based on the parameter passed in, this method creates the necessary @@ -39,11 +41,11 @@ public class RmicAdapterFactory * classname of the rmic's adapter. * @param task a task to log through. * @return The Rmic value - * @throws BuildException if the rmic type could not be resolved into a rmic + * @throws TaskException if the rmic type could not be resolved into a rmic * adapter. */ public static RmicAdapter getRmic( String rmicType, Task task ) - throws BuildException + throws TaskException { if( rmicType == null ) { @@ -66,7 +68,7 @@ public class RmicAdapterFactory } catch( ClassNotFoundException cnfk ) { - throw new BuildException( "Couldn\'t guess rmic implementation" ); + throw new TaskException( "Couldn\'t guess rmic implementation" ); } } } @@ -92,32 +94,32 @@ public class RmicAdapterFactory * * @param className The fully qualified classname to be created. * @return Description of the Returned Value - * @throws BuildException This is the fit that is thrown if className isn't + * @throws TaskException This is the fit that is thrown if className isn't * an instance of RmicAdapter. */ private static RmicAdapter resolveClassName( String className ) - throws BuildException + throws TaskException { try { Class c = Class.forName( className ); Object o = c.newInstance(); - return ( RmicAdapter )o; + return (RmicAdapter)o; } catch( ClassNotFoundException cnfe ) { - throw new BuildException( className + " can\'t be found.", cnfe ); + throw new TaskException( className + " can\'t be found.", cnfe ); } catch( ClassCastException cce ) { - throw new BuildException( className + " isn\'t the classname of " - + "a rmic adapter.", cce ); + throw new TaskException( className + " isn\'t the classname of " + + "a rmic adapter.", cce ); } catch( Throwable t ) { // for all other possibilities - throw new BuildException( className + " caused an interesting " - + "exception.", t ); + throw new TaskException( className + " caused an interesting " + + "exception.", t ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java index c21c07c09..7826be65f 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; + import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.Commandline; @@ -24,7 +25,7 @@ public class SunRmic extends DefaultRmicAdapter { public boolean execute() - throws BuildException + throws TaskException { getRmic().log( "Using SUN rmic compiler", Project.MSG_VERBOSE ); Commandline cmd = setupRmicCommand(); @@ -37,30 +38,30 @@ public class SunRmic extends DefaultRmicAdapter { Class c = Class.forName( "sun.rmi.rmic.Main" ); Constructor cons = c.getConstructor( new Class[] - {OutputStream.class, String.class} ); + {OutputStream.class, String.class} ); Object rmic = cons.newInstance( new Object[]{logstr, "rmic"} ); Method doRmic = c.getMethod( "compile", - new Class[]{String[].class} ); - Boolean ok = ( Boolean )doRmic.invoke( rmic, - ( new Object[]{cmd.getArguments()} ) ); + new Class[]{String[].class} ); + Boolean ok = (Boolean)doRmic.invoke( rmic, + ( new Object[]{cmd.getArguments()} ) ); return ok.booleanValue(); } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use SUN rmic, as it is not available" + - " A common solution is to set the environment variable" + - " JAVA_HOME or CLASSPATH." ); + throw new TaskException( "Cannot use SUN rmic, as it is not available" + + " A common solution is to set the environment variable" + + " JAVA_HOME or CLASSPATH." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting SUN rmic: ", ex ); + throw new TaskException( "Error starting SUN rmic: ", ex ); } } finally @@ -71,7 +72,7 @@ public class SunRmic extends DefaultRmicAdapter } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java index fae6392a0..36e543908 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; + import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; @@ -40,7 +41,7 @@ public class WLRmic extends DefaultRmicAdapter } public boolean execute() - throws BuildException + throws TaskException { getRmic().log( "Using WebLogic rmic", Project.MSG_VERBOSE ); Commandline cmd = setupRmicCommand( new String[]{"-noexit"} ); @@ -50,25 +51,25 @@ public class WLRmic extends DefaultRmicAdapter // Create an instance of the rmic Class c = Class.forName( "weblogic.rmic" ); Method doRmic = c.getMethod( "main", - new Class[]{String[].class} ); + new Class[]{String[].class} ); doRmic.invoke( null, new Object[]{cmd.getArguments()} ); return true; } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use WebLogic rmic, as it is not available" + - " A common solution is to set the environment variable" + - " CLASSPATH." ); + throw new TaskException( "Cannot use WebLogic rmic, as it is not available" + + " A common solution is to set the environment variable" + + " CLASSPATH." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting WebLogic rmic: ", ex ); + throw new TaskException( "Error starting WebLogic rmic: ", ex ); } } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java index 226e992d0..5d700e333 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Commandline.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.StringTokenizer; import java.util.Vector; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.BuildException; /** * Commandline objects help handling command lines specifying processes to @@ -40,6 +39,7 @@ public class Commandline implements Cloneable private String executable = null; public Commandline( String to_process ) + throws TaskException { super(); String[] tmp = translateCommandline( to_process ); @@ -75,7 +75,7 @@ public class Commandline implements Cloneable { if( argument.indexOf( "\'" ) > -1 ) { - throw new BuildException( "Can\'t handle single and double quotes in same argument" ); + throw new TaskException( "Can\'t handle single and double quotes in same argument" ); } else { @@ -120,6 +120,7 @@ public class Commandline implements Cloneable } public static String[] translateCommandline( String to_process ) + throws TaskException { if( to_process == null || to_process.length() == 0 ) { @@ -193,7 +194,7 @@ public class Commandline implements Cloneable if( state == inQuote || state == inDoubleQuote ) { - throw new BuildException( "unbalanced quotes in " + to_process ); + throw new TaskException( "unbalanced quotes in " + to_process ); } String[] args = new String[ v.size() ]; @@ -356,6 +357,7 @@ public class Commandline implements Cloneable * @param line line to split into several commandline arguments */ public void setLine( String line ) + throws TaskException { parts = translateCommandline( line ); } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java index 489edcdc0..f0aef1e7e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/CommandlineJava.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.util.Enumeration; import java.util.Properties; import java.util.Vector; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; +import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; +import org.apache.tools.ant.Project; /** * A representation of a Java command line that is nothing more than a composite @@ -76,7 +77,7 @@ public class CommandlineJava implements Cloneable } public void setSystemProperties() - throws BuildException + throws TaskException { sysProperties.setSystem(); } @@ -116,17 +117,18 @@ public class CommandlineJava implements Cloneable * @return the list of all arguments necessary to run the vm. */ public String[] getCommandline() + throws TaskException { - String[] result = new String[size()]; + String[] result = new String[ size() ]; int pos = 0; String[] vmArgs = getActualVMCommand().getCommandline(); // first argument is the java.exe path... - result[pos++] = vmArgs[0]; + result[ pos++ ] = vmArgs[ 0 ]; // -jar must be the first option in the command line. if( executeJar ) { - result[pos++] = "-jar"; + result[ pos++ ] = "-jar"; } // next follows the vm options System.arraycopy( vmArgs, 1, result, pos, vmArgs.length - 1 ); @@ -135,20 +137,20 @@ public class CommandlineJava implements Cloneable if( sysProperties.size() > 0 ) { System.arraycopy( sysProperties.getVariables(), 0, - result, pos, sysProperties.size() ); + result, pos, sysProperties.size() ); pos += sysProperties.size(); } // classpath is a vm option too.. Path fullClasspath = classpath != null ? classpath.concatSystemClasspath( "ignore" ) : null; if( fullClasspath != null && fullClasspath.toString().trim().length() > 0 ) { - result[pos++] = "-classpath"; - result[pos++] = fullClasspath.toString(); + result[ pos++ ] = "-classpath"; + result[ pos++ ] = fullClasspath.toString(); } // this is the classname to run as well as its arguments. // in case of 'executeJar', the executable is a jar file. System.arraycopy( javaCommand.getCommandline(), 0, - result, pos, javaCommand.size() ); + result, pos, javaCommand.size() ); return result; } @@ -202,13 +204,13 @@ public class CommandlineJava implements Cloneable public Object clone() { CommandlineJava c = new CommandlineJava(); - c.vmCommand = ( Commandline )vmCommand.clone(); - c.javaCommand = ( Commandline )javaCommand.clone(); - c.sysProperties = ( SysProperties )sysProperties.clone(); + c.vmCommand = (Commandline)vmCommand.clone(); + c.javaCommand = (Commandline)javaCommand.clone(); + c.sysProperties = (SysProperties)sysProperties.clone(); c.maxMemory = maxMemory; if( classpath != null ) { - c.classpath = ( Path )classpath.clone(); + c.classpath = (Path)classpath.clone(); } c.vmVersion = vmVersion; c.executeJar = executeJar; @@ -235,7 +237,7 @@ public class CommandlineJava implements Cloneable } public void restoreSystemProperties() - throws BuildException + throws TaskException { sysProperties.restoreSystem(); } @@ -247,6 +249,7 @@ public class CommandlineJava implements Cloneable * @see #getCommandline() */ public int size() + throws TaskException { int size = getActualVMCommand().size() + javaCommand.size() + sysProperties.size(); // classpath is "-classpath " -> 2 args @@ -263,15 +266,21 @@ public class CommandlineJava implements Cloneable return size; } - public String toString() { - return Commandline.toString( getCommandline() ); + try + { + return Commandline.toString( getCommandline() ); + } + catch( TaskException e ) + { + return e.toString(); + } } private Commandline getActualVMCommand() { - Commandline actualVMCommand = ( Commandline )vmCommand.clone(); + Commandline actualVMCommand = (Commandline)vmCommand.clone(); if( maxMemory != null ) { if( vmVersion.startsWith( "1.1" ) ) @@ -298,7 +307,7 @@ public class CommandlineJava implements Cloneable // PATH. java.io.File jExecutable = new java.io.File( System.getProperty( "java.home" ) + - "/../bin/java" + extension ); + "/../bin/java" + extension ); if( jExecutable.exists() && !Os.isFamily( "netware" ) ) { @@ -323,27 +332,27 @@ public class CommandlineJava implements Cloneable Properties sys = null; public void setSystem() - throws BuildException + throws TaskException { try { Properties p = new Properties( sys = System.getProperties() ); - for( Enumeration e = variables.elements(); e.hasMoreElements(); ) + for( Enumeration e = variables.elements(); e.hasMoreElements(); ) { - Environment.Variable v = ( Environment.Variable )e.nextElement(); + Environment.Variable v = (Environment.Variable)e.nextElement(); p.put( v.getKey(), v.getValue() ); } System.setProperties( p ); } catch( SecurityException e ) { - throw new BuildException( "Cannot modify system properties", e ); + throw new TaskException( "Cannot modify system properties", e ); } } public String[] getVariables() - throws BuildException + throws TaskException { String props[] = super.getVariables(); @@ -352,7 +361,7 @@ public class CommandlineJava implements Cloneable for( int i = 0; i < props.length; i++ ) { - props[i] = "-D" + props[i]; + props[ i ] = "-D" + props[ i ]; } return props; } @@ -361,8 +370,8 @@ public class CommandlineJava implements Cloneable { try { - SysProperties c = ( SysProperties )super.clone(); - c.variables = ( Vector )variables.clone(); + SysProperties c = (SysProperties)super.clone(); + c.variables = (Vector)variables.clone(); return c; } catch( CloneNotSupportedException e ) @@ -372,10 +381,10 @@ public class CommandlineJava implements Cloneable } public void restoreSystem() - throws BuildException + throws TaskException { if( sys == null ) - throw new BuildException( "Unbalanced nesting of SysProperties" ); + throw new TaskException( "Unbalanced nesting of SysProperties" ); try { @@ -384,7 +393,7 @@ public class CommandlineJava implements Cloneable } catch( SecurityException e ) { - throw new BuildException( "Cannot modify system properties", e ); + throw new TaskException( "Cannot modify system properties", e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/DataType.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/DataType.java index 7ac037887..494b1b940 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/DataType.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/DataType.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.types; import java.util.Stack; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; @@ -135,9 +134,9 @@ public abstract class DataType * * @return Description of the Returned Value */ - protected BuildException circularReference() + protected TaskException circularReference() { - return new BuildException( "This data type contains a circular reference." ); + return new TaskException( "This data type contains a circular reference." ); } /** @@ -145,7 +144,7 @@ public abstract class DataType * the Stack (which holds all DataType instances that directly or indirectly * reference this instance, including this instance itself).

* - * If one is included, throw a BuildException created by {@link + * If one is included, throw a TaskException created by {@link * #circularReference circularReference}.

* * This implementation is appropriate only for a DataType that cannot hold @@ -157,10 +156,10 @@ public abstract class DataType * * @param stk Description of Parameter * @param p Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void dieOnCircularReference( Stack stk, Project p ) - throws BuildException + throws TaskException { if( checked || !isReference() ) @@ -191,9 +190,9 @@ public abstract class DataType * * @return Description of the Returned Value */ - protected BuildException noChildrenAllowed() + protected TaskException noChildrenAllowed() { - return new BuildException( "You must not specify nested elements when using refid" ); + return new TaskException( "You must not specify nested elements when using refid" ); } /** @@ -202,9 +201,9 @@ public abstract class DataType * * @return Description of the Returned Value */ - protected BuildException tooManyAttributes() + protected TaskException tooManyAttributes() { - return new BuildException( "You must not specify more than one attribute" + - " when using refid" ); + return new TaskException( "You must not specify more than one attribute" + + " when using refid" ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Description.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Description.java index 861006aac..ab6727dab 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Description.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Description.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.types; - /** * Description is used to provide a project-wide description element (that is, a * description that applies to a buildfile as a whole). If present, the diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java index 24bd08bd3..17bc5467b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.types; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Helper class for attributes that can only take one of a fixed list of values. @@ -21,21 +22,23 @@ public abstract class EnumeratedAttribute protected String value; - public EnumeratedAttribute() { } + public EnumeratedAttribute() + { + } /** * Invoked by {@link org.apache.tools.ant.IntrospectionHelper * IntrospectionHelper}. * * @param value The new Value value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public final void setValue( String value ) - throws BuildException + throws TaskException { if( !containsValue( value ) ) { - throw new BuildException( value + " is not a legal value for this attribute" ); + throw new TaskException( value + " is not a legal value for this attribute" ); } this.value = value; } @@ -73,7 +76,7 @@ public abstract class EnumeratedAttribute for( int i = 0; i < values.length; i++ ) { - if( value.equals( values[i] ) ) + if( value.equals( values[ i ] ) ) { return true; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Environment.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Environment.java index ca2cd0260..dd7b63023 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Environment.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Environment.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.util.Vector; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Wrapper for environment variables. @@ -25,16 +26,16 @@ public class Environment } public String[] getVariables() - throws BuildException + throws TaskException { if( variables.size() == 0 ) { return null; } - String[] result = new String[variables.size()]; + String[] result = new String[ variables.size() ]; for( int i = 0; i < result.length; i++ ) { - result[i] = ( ( Variable )variables.elementAt( i ) ).getContent(); + result[ i ] = ( (Variable)variables.elementAt( i ) ).getContent(); } return result; } @@ -74,11 +75,11 @@ public class Environment } public String getContent() - throws BuildException + throws TaskException { if( key == null || value == null ) { - throw new BuildException( "key and value must be specified for environment variables." ); + throw new TaskException( "key and value must be specified for environment variables." ); } StringBuffer sb = new StringBuffer( key.trim() ); sb.append( "=" ).append( value.trim() ); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileList.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileList.java index 1d369eb8a..cd7432caf 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileList.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileList.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.io.File; import java.util.Stack; 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; /** @@ -41,7 +42,7 @@ public class FileList extends DataType } public void setDir( File dir ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -74,10 +75,10 @@ public class FileList extends DataType * if you make it a reference.

* * @param r The new Refid value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setRefid( Reference r ) - throws BuildException + throws TaskException { if( ( dir != null ) || ( filenames.size() != 0 ) ) { @@ -110,15 +111,15 @@ public class FileList extends DataType if( dir == null ) { - throw new BuildException( "No directory specified for filelist." ); + throw new TaskException( "No directory specified for filelist." ); } if( filenames.size() == 0 ) { - throw new BuildException( "No files specified for filelist." ); + throw new TaskException( "No files specified for filelist." ); } - String result[] = new String[filenames.size()]; + String result[] = new String[ filenames.size() ]; filenames.copyInto( result ); return result; } @@ -143,11 +144,11 @@ public class FileList extends DataType if( !( o instanceof FileList ) ) { String msg = ref.getRefId() + " doesn\'t denote a filelist"; - throw new BuildException( msg ); + throw new TaskException( msg ); } else { - return ( FileList )o; + return (FileList)o; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java index 372a1a765..fdab4b91e 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.Stack; 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.FileScanner; import org.apache.tools.ant.Project; @@ -185,6 +184,7 @@ public class FileSet extends DataType implements Cloneable } public void setupDirectoryScanner( FileScanner ds, Project p ) + throws TaskException { if( ds == null ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java index 5e4a6bb48..ccc02ece5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/FilterSet.java @@ -15,7 +15,6 @@ import java.util.Hashtable; import java.util.Properties; import java.util.Vector; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; /** @@ -105,10 +104,10 @@ public class FilterSet extends DataType implements Cloneable * * @param filtersFile sets the filter fil to read filters for this filter * set from. - * @exception BuildException if there is a problem reading the filters + * @exception TaskException if there is a problem reading the filters */ public void setFiltersfile( File filtersFile ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -253,11 +252,11 @@ public class FilterSet extends DataType implements Cloneable * Read the filters from the given file. * * @param filtersFile the file from which filters are read - * @exception BuildException Throw a build exception when unable to read the + * @exception TaskException Throw a build exception when unable to read the * file. */ public void readFiltersFromFile( File filtersFile ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -285,7 +284,7 @@ public class FilterSet extends DataType implements Cloneable } catch( Exception e ) { - throw new BuildException( "Could not read filters from file: " + filtersFile ); + throw new TaskException( "Could not read filters from file: " + filtersFile ); } finally { @@ -303,7 +302,7 @@ public class FilterSet extends DataType implements Cloneable } else { - throw new BuildException( "Must specify a file not a directory in the filtersfile attribute:" + filtersFile ); + throw new TaskException( "Must specify a file not a directory in the filtersfile attribute:" + filtersFile ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Mapper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Mapper.java index 28f126d29..98603bc32 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Mapper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Mapper.java @@ -9,10 +9,10 @@ package org.apache.tools.ant.types; import java.util.Properties; import java.util.Stack; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.Project; import org.apache.tools.ant.util.FileNameMapper; -import org.apache.myrmidon.api.TaskException; /** * Element to define a FileNameMapper. @@ -43,6 +43,7 @@ public class Mapper extends DataType implements Cloneable * @param classname The new Classname value */ public void setClassname( String classname ) + throws TaskException { if( isReference() ) { @@ -57,6 +58,7 @@ public class Mapper extends DataType implements Cloneable * @param classpath The new Classpath value */ public void setClasspath( Path classpath ) + throws TaskException { if( isReference() ) { @@ -79,6 +81,7 @@ public class Mapper extends DataType implements Cloneable * @param r The new ClasspathRef value */ public void setClasspathRef( Reference r ) + throws TaskException { if( isReference() ) { @@ -93,6 +96,7 @@ public class Mapper extends DataType implements Cloneable * @param from The new From value */ public void setFrom( String from ) + throws TaskException { if( isReference() ) { @@ -125,6 +129,7 @@ public class Mapper extends DataType implements Cloneable * @param to The new To value */ public void setTo( String to ) + throws TaskException { if( isReference() ) { @@ -139,6 +144,7 @@ public class Mapper extends DataType implements Cloneable * @param type The new Type value */ public void setType( MapperType type ) + throws TaskException { if( isReference() ) { @@ -219,6 +225,7 @@ public class Mapper extends DataType implements Cloneable * @return Description of the Returned Value */ public Path createClasspath() + throws TaskException { if( isReference() ) { @@ -238,6 +245,7 @@ public class Mapper extends DataType implements Cloneable * @return The Ref value */ protected Mapper getRef() + throws TaskException { if( !checked ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java index 94dbee1ac..428acbd92 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Path.java @@ -13,7 +13,6 @@ import java.util.Locale; import java.util.Stack; 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.PathTokenizer; import org.apache.tools.ant.Project; @@ -193,6 +192,7 @@ public class Path * @return Description of the Returned Value */ private static String resolveFile( Project project, String relativeName ) + throws TaskException { if( project != null ) { @@ -208,10 +208,10 @@ public class Path * * @param location the location of the element to add (must not be null * nor empty. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setLocation( File location ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -224,10 +224,10 @@ public class Path * Parses a path definition and creates single PathElements. * * @param path the path definition. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setPath( String path ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -243,7 +243,7 @@ public class Path * if you make it a reference.

* * @param r The new Refid value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setRefid( Reference r ) throws TaskException @@ -326,7 +326,7 @@ public class Path * Adds a nested <fileset> element. * * @param fs The feature to be added to the Fileset attribute - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void addFileset( FileSet fs ) throws TaskException @@ -427,9 +427,17 @@ public class Path */ public Object clone() { - Path p = new Path( getProject() ); - p.append( this ); - return p; + try + { + Path p = new Path( getProject() ); + p.append( this ); + return p; + } + catch( TaskException e ) + { + throw new IllegalStateException( e.getMessage() ); + } + } /** @@ -439,6 +447,7 @@ public class Path * @return Description of the Returned Value */ public Path concatSystemClasspath() + throws TaskException { return concatSystemClasspath( "last" ); } @@ -505,10 +514,10 @@ public class Path * Creates a nested <path> element. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Path createPath() - throws BuildException + throws TaskException { if( isReference() ) { @@ -524,10 +533,10 @@ public class Path * Creates the nested <pathelement> element. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public PathElement createPathElement() - throws BuildException + throws TaskException { if( isReference() ) { @@ -668,10 +677,10 @@ public class Path * * @param stk Description of Parameter * @param p Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void dieOnCircularReference( Stack stk, Project p ) - throws BuildException + throws TaskException { if( checked ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Reference.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Reference.java index 11cb33915..9b3faac71 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Reference.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Reference.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.types; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -41,17 +42,17 @@ public class Reference } public Object getReferencedObject( Project project ) - throws BuildException + throws TaskException { if( refid == null ) { - throw new BuildException( "No reference specified" ); + throw new TaskException( "No reference specified" ); } Object o = project.getReference( refid ); if( o == null ) { - throw new BuildException( "Reference " + refid + " not found." ); + throw new TaskException( "Reference " + refid + " not found." ); } return o; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/RegularExpression.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/RegularExpression.java index 6f0d31451..a89fccdf4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/RegularExpression.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/RegularExpression.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.util.Stack; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.util.regexp.Regexp; import org.apache.tools.ant.util.regexp.RegexpFactory; @@ -51,11 +52,13 @@ public class RegularExpression extends DataType private Regexp regexp; public RegularExpression() + throws TaskException { this.regexp = factory.newRegexp(); } public void setPattern( String pattern ) + throws TaskException { this.regexp.setPattern( pattern ); } @@ -67,6 +70,7 @@ public class RegularExpression extends DataType * @return The Pattern value */ public String getPattern( Project p ) + throws TaskException { if( isReference() ) return getRef( p ).getPattern( p ); @@ -82,6 +86,7 @@ public class RegularExpression extends DataType * @return The Ref value */ public RegularExpression getRef( Project p ) + throws TaskException { if( !checked ) { @@ -94,11 +99,11 @@ public class RegularExpression extends DataType if( !( o instanceof RegularExpression ) ) { String msg = ref.getRefId() + " doesn\'t denote a regularexpression"; - throw new BuildException( msg ); + throw new TaskException( msg ); } else { - return ( RegularExpression )o; + return (RegularExpression)o; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Substitution.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Substitution.java index c640c0466..726d9f8ff 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/Substitution.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/Substitution.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.util.Stack; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.DataType; /** * A regular expression substitution datatype. It is an expression that is meant @@ -72,11 +72,11 @@ public class Substitution extends DataType if( !( o instanceof Substitution ) ) { String msg = ref.getRefId() + " doesn\'t denote a substitution"; - throw new BuildException( msg ); + throw new TaskException( msg ); } else { - return ( Substitution )o; + return (Substitution)o; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipFileSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipFileSet.java index c98d28ac7..fe0d01c1b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipFileSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipFileSet.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; @@ -39,14 +40,14 @@ public class ZipFileSet extends FileSet * being specified. * * @param dir The new Dir value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setDir( File dir ) - throws BuildException + throws TaskException { if( srcFile != null ) { - throw new BuildException( "Cannot set both dir and src attributes" ); + throw new TaskException( "Cannot set both dir and src attributes" ); } else { @@ -86,7 +87,7 @@ public class ZipFileSet extends FileSet { if( hasDir ) { - throw new BuildException( "Cannot set both dir and src attributes" ); + throw new TaskException( "Cannot set both dir and src attributes" ); } this.srcFile = srcFile; } @@ -100,6 +101,7 @@ public class ZipFileSet extends FileSet * @return The DirectoryScanner value */ public DirectoryScanner getDirectoryScanner( Project p ) + throws TaskException { if( isReference() ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipScanner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipScanner.java index 4ed9fec95..2493a234d 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipScanner.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/ZipScanner.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.io.File; import org.apache.tools.ant.DirectoryScanner; @@ -46,7 +47,7 @@ public class ZipScanner extends DirectoryScanner */ public String[] getIncludedDirectories() { - return new String[0]; + return new String[ 0 ]; } /** @@ -58,8 +59,8 @@ public class ZipScanner extends DirectoryScanner */ public String[] getIncludedFiles() { - String[] result = new String[1]; - result[0] = srcFile.getAbsolutePath(); + String[] result = new String[ 1 ]; + result[ 0 ] = srcFile.getAbsolutePath(); return result; } @@ -71,12 +72,12 @@ public class ZipScanner extends DirectoryScanner if( includes == null ) { // No includes supplied, so set it to 'matches all' - includes = new String[1]; - includes[0] = "**"; + includes = new String[ 1 ]; + includes[ 0 ] = "**"; } if( excludes == null ) { - excludes = new String[0]; + excludes = new String[ 0 ]; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java index 287d945ac..ef77cceb9 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java @@ -6,15 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.types.optional.depend; -import java.io.File; + import java.util.ArrayList; import java.util.List; -import java.util.Stack; -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; -import org.apache.tools.ant.util.depend.Dependencies; /** * A DepSet is a FileSet, that enlists all classes that depend on a certain @@ -35,7 +33,7 @@ public class ClassfileSet extends FileSet } public void setRootClass( String rootClass ) - throws BuildException + throws TaskException { rootClasses.add( rootClass ); } @@ -64,7 +62,7 @@ public class ClassfileSet extends FileSet { if( isReference() ) { - return new ClassfileSet( ( ClassfileSet )getRef( getProject() ) ); + return new ClassfileSet( (ClassfileSet)getRef( getProject() ) ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java index 4144487dc..be84607f6 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/types/optional/depend/DependScanner.java @@ -6,8 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.types.optional.depend; -import java.io.*; -import java.util.*; + +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; import org.apache.bcel.*; import org.apache.bcel.classfile.*; import org.apache.tools.ant.DirectoryScanner; @@ -50,11 +57,17 @@ public class DependScanner extends DirectoryScanner this.basedir = basedir; } - public void setCaseSensitive( boolean isCaseSensitive ) { } + public void setCaseSensitive( boolean isCaseSensitive ) + { + } - public void setExcludes( String[] excludes ) { } + public void setExcludes( String[] excludes ) + { + } - public void setIncludes( String[] includes ) { } + public void setIncludes( String[] includes ) + { + } /** * Sets the domain, where dependant classes are searched @@ -88,7 +101,7 @@ public class DependScanner extends DirectoryScanner public String[] getIncludedDirectories() { - return new String[0]; + return new String[ 0 ]; } /** @@ -99,10 +112,10 @@ public class DependScanner extends DirectoryScanner public String[] getIncludedFiles() { int count = included.size(); - String[] files = new String[count]; + String[] files = new String[ count ]; for( int i = 0; i < count; i++ ) { - files[i] = included.get( i ) + ".class"; + files[ i ] = included.get( i ) + ".class"; //System.err.println(" " + files[i]); } return files; @@ -118,7 +131,9 @@ public class DependScanner extends DirectoryScanner return null; } - public void addDefaultExcludes() { } + public void addDefaultExcludes() + { + } /** * Scans the base directory for files that baseClass depends on @@ -140,10 +155,10 @@ public class DependScanner extends DirectoryScanner throw new IllegalArgumentException( e.getMessage() ); } - for( Iterator rootClassIterator = rootClasses.iterator(); rootClassIterator.hasNext(); ) + for( Iterator rootClassIterator = rootClasses.iterator(); rootClassIterator.hasNext(); ) { Set newSet = new HashSet(); - String start = ( String )rootClassIterator.next(); + String start = (String)rootClassIterator.next(); start = start.replace( '.', '/' ); newSet.add( start ); @@ -154,7 +169,7 @@ public class DependScanner extends DirectoryScanner Iterator i = newSet.iterator(); while( i.hasNext() ) { - String fileName = base + ( ( String )i.next() ).replace( '/', File.separatorChar ) + ".class"; + String fileName = base + ( (String)i.next() ).replace( '/', File.separatorChar ) + ".class"; try { @@ -171,17 +186,17 @@ public class DependScanner extends DirectoryScanner visitor.clearDependencies(); Dependencies.applyFilter( newSet, - new Filter() - { - public boolean accept( Object object ) - { - String fileName = base + ( ( String )object ).replace( '/', File.separatorChar ) + ".class"; - return new File( fileName ).exists(); - } - } ); + new Filter() + { + public boolean accept( Object object ) + { + String fileName = base + ( (String)object ).replace( '/', File.separatorChar ) + ".class"; + return new File( fileName ).exists(); + } + } ); newSet.removeAll( set ); set.addAll( newSet ); - }while ( newSet.size() > 0 ); + } while( newSet.size() > 0 ); } included.clear(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/DOMElementWriter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/DOMElementWriter.java index ca4d1b867..18c2da6c4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/DOMElementWriter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/DOMElementWriter.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.util; + import java.io.IOException; import java.io.Writer; import org.w3c.dom.Attr; @@ -81,7 +82,7 @@ public class DOMElementWriter String name = ent.substring( 1, ent.length() - 1 ); for( int i = 0; i < knownEntities.length; i++ ) { - if( name.equals( knownEntities[i] ) ) + if( name.equals( knownEntities[ i ] ) ) { return true; } @@ -101,35 +102,35 @@ public class DOMElementWriter for( int i = 0; i < value.length(); i++ ) { char c = value.charAt( i ); - switch ( c ) + switch( c ) { - case '<': - sb.append( "<" ); - break; - case '>': - sb.append( ">" ); - break; - case '\'': - sb.append( "'" ); - break; - case '\"': - sb.append( """ ); - break; - case '&': - int nextSemi = value.indexOf( ";", i ); - if( nextSemi < 0 - || !isReference( value.substring( i, nextSemi + 1 ) ) ) - { - sb.append( "&" ); - } - else - { - sb.append( '&' ); - } - break; - default: - sb.append( c ); - break; + case '<': + sb.append( "<" ); + break; + case '>': + sb.append( ">" ); + break; + case '\'': + sb.append( "'" ); + break; + case '\"': + sb.append( """ ); + break; + case '&': + int nextSemi = value.indexOf( ";", i ); + if( nextSemi < 0 + || !isReference( value.substring( i, nextSemi + 1 ) ) ) + { + sb.append( "&" ); + } + else + { + sb.append( '&' ); + } + break; + default: + sb.append( c ); + break; } } return sb.toString(); @@ -164,7 +165,7 @@ public class DOMElementWriter NamedNodeMap attrs = element.getAttributes(); for( int i = 0; i < attrs.getLength(); i++ ) { - Attr attr = ( Attr )attrs.item( i ); + Attr attr = (Attr)attrs.item( i ); out.write( " " ); out.write( attr.getName() ); out.write( "=\"" ); @@ -180,41 +181,41 @@ public class DOMElementWriter { Node child = children.item( i ); - switch ( child.getNodeType() ) + switch( child.getNodeType() ) { - case Node.ELEMENT_NODE: - if( !hasChildren ) - { - out.write( lSep ); - hasChildren = true; - } - write( ( Element )child, out, indent + 1, indentWith ); - break; - case Node.TEXT_NODE: - out.write( encode( child.getNodeValue() ) ); - break; - case Node.CDATA_SECTION_NODE: - out.write( "" ); - break; - case Node.ENTITY_REFERENCE_NODE: - out.write( '&' ); - out.write( child.getNodeName() ); - out.write( ';' ); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - out.write( " 0 ) - { - out.write( ' ' ); - out.write( data ); - } - out.write( "?>" ); - break; + case Node.ELEMENT_NODE: + if( !hasChildren ) + { + out.write( lSep ); + hasChildren = true; + } + write( (Element)child, out, indent + 1, indentWith ); + break; + case Node.TEXT_NODE: + out.write( encode( child.getNodeValue() ) ); + break; + case Node.CDATA_SECTION_NODE: + out.write( "" ); + break; + case Node.ENTITY_REFERENCE_NODE: + out.write( '&' ); + out.write( child.getNodeName() ); + out.write( ';' ); + break; + case Node.PROCESSING_INSTRUCTION_NODE: + out.write( " 0 ) + { + out.write( ' ' ); + out.write( data ); + } + out.write( "?>" ); + break; } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java index 75d33d52a..68309453a 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/FileUtils.java @@ -65,7 +65,7 @@ public class FileUtils * * @param file The new FileLastModified value * @param time The new FileLastModified value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setFileLastModified( File file, long time ) throws TaskException diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java index 37c6e5bad..a02730dc1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java @@ -24,14 +24,18 @@ public class FlatFileNameMapper implements FileNameMapper * * @param from The new From value */ - public void setFrom( String from ) { } + public void setFrom( String from ) + { + } /** * Ignored. * * @param to The new To value */ - public void setTo( String to ) { } + public void setTo( String to ) + { + } /** * Returns an one-element array containing the source file name without any diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/GlobPatternMapper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/GlobPatternMapper.java index f9cb24277..6ca42d3b4 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/GlobPatternMapper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/GlobPatternMapper.java @@ -103,14 +103,14 @@ public class GlobPatternMapper implements FileNameMapper public String[] mapFileName( String sourceFileName ) { if( fromPrefix == null - || !sourceFileName.startsWith( fromPrefix ) - || !sourceFileName.endsWith( fromPostfix ) ) + || !sourceFileName.startsWith( fromPrefix ) + || !sourceFileName.endsWith( fromPostfix ) ) { return null; } return new String[]{toPrefix - + extractVariablePart( sourceFileName ) - + toPostfix}; + + extractVariablePart( sourceFileName ) + + toPostfix}; } /** @@ -123,6 +123,6 @@ public class GlobPatternMapper implements FileNameMapper protected String extractVariablePart( String name ) { return name.substring( prefixLength, - name.length() - postfixLength ); + name.length() - postfixLength ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/IdentityMapper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/IdentityMapper.java index a93007e83..d94a5ecd3 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/IdentityMapper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/IdentityMapper.java @@ -23,14 +23,18 @@ public class IdentityMapper implements FileNameMapper * * @param from The new From value */ - public void setFrom( String from ) { } + public void setFrom( String from ) + { + } /** * Ignored. * * @param to The new To value */ - public void setTo( String to ) { } + public void setTo( String to ) + { + } /** * Returns an one-element array containing the source file name. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/MergingMapper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/MergingMapper.java index d9c0b866e..b9b27bdec 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/MergingMapper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/MergingMapper.java @@ -24,7 +24,9 @@ public class MergingMapper implements FileNameMapper * * @param from The new From value */ - public void setFrom( String from ) { } + public void setFrom( String from ) + { + } /** * Sets the name of the merged file. diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java index df29877a4..d2382c5a5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/RegexpPatternMapper.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.util; + import java.util.Vector; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.util.regexp.RegexpMatcher; import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; @@ -23,7 +24,7 @@ public class RegexpPatternMapper implements FileNameMapper protected StringBuffer result = new StringBuffer(); public RegexpPatternMapper() - throws BuildException + throws TaskException { reg = ( new RegexpMatcherFactory() ).newRegexpMatcher(); } @@ -32,10 +33,10 @@ public class RegexpPatternMapper implements FileNameMapper * Sets the "from" pattern. Required. * * @param from The new From value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setFrom( String from ) - throws BuildException + throws TaskException { try { @@ -45,8 +46,8 @@ public class RegexpPatternMapper implements FileNameMapper { // depending on the implementation the actual RE won't // get instantiated in the constructor. - throw new BuildException( "Cannot load regular expression matcher", - e ); + throw new TaskException( "Cannot load regular expression matcher", + e ); } } @@ -70,7 +71,7 @@ public class RegexpPatternMapper implements FileNameMapper public String[] mapFileName( String sourceFileName ) { if( reg == null || to == null - || !reg.matches( sourceFileName ) ) + || !reg.matches( sourceFileName ) ) { return null; } @@ -91,18 +92,18 @@ public class RegexpPatternMapper implements FileNameMapper result.setLength( 0 ); for( int i = 0; i < to.length; i++ ) { - if( to[i] == '\\' ) + if( to[ i ] == '\\' ) { if( ++i < to.length ) { - int value = Character.digit( to[i], 10 ); + int value = Character.digit( to[ i ], 10 ); if( value > -1 ) { - result.append( ( String )v.elementAt( value ) ); + result.append( (String)v.elementAt( value ) ); } else { - result.append( to[i] ); + result.append( to[ i ] ); } } else @@ -113,7 +114,7 @@ public class RegexpPatternMapper implements FileNameMapper } else { - result.append( to[i] ); + result.append( to[ i ] ); } } return result.toString(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java index 4106357ac..f0aa9447c 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/SourceFileScanner.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.util; + import java.io.File; import java.util.Vector; +import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; -import org.apache.myrmidon.framework.Os; /** * Utility class that collects the functionality of the various scanDir methods @@ -74,40 +75,40 @@ public class SourceFileScanner for( int i = 0; i < files.length; i++ ) { - String[] targets = mapper.mapFileName( files[i] ); + String[] targets = mapper.mapFileName( files[ i ] ); if( targets == null || targets.length == 0 ) { - task.log( files[i] + " skipped - don\'t know how to handle it", - Project.MSG_VERBOSE ); + task.log( files[ i ] + " skipped - don\'t know how to handle it", + Project.MSG_VERBOSE ); continue; } - File src = fileUtils.resolveFile( srcDir, files[i] ); + File src = fileUtils.resolveFile( srcDir, files[ i ] ); if( src.lastModified() > now ) { - task.log( "Warning: " + files[i] + " modified in the future.", - Project.MSG_WARN ); + task.log( "Warning: " + files[ i ] + " modified in the future.", + Project.MSG_WARN ); } boolean added = false; targetList.setLength( 0 ); for( int j = 0; !added && j < targets.length; j++ ) { - File dest = fileUtils.resolveFile( destDir, targets[j] ); + File dest = fileUtils.resolveFile( destDir, targets[ j ] ); if( !dest.exists() ) { - task.log( files[i] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.", - Project.MSG_VERBOSE ); - v.addElement( files[i] ); + task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.", + Project.MSG_VERBOSE ); + v.addElement( files[ i ] ); added = true; } else if( src.lastModified() > dest.lastModified() ) { - task.log( files[i] + " added as " + dest.getAbsolutePath() + " is outdated.", - Project.MSG_VERBOSE ); - v.addElement( files[i] ); + task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.", + Project.MSG_VERBOSE ); + v.addElement( files[ i ] ); added = true; } else @@ -122,13 +123,13 @@ public class SourceFileScanner if( !added ) { - task.log( files[i] + " omitted as " + targetList.toString() - + ( targets.length == 1 ? " is" : " are " ) - + " up to date.", Project.MSG_VERBOSE ); + task.log( files[ i ] + " omitted as " + targetList.toString() + + ( targets.length == 1 ? " is" : " are " ) + + " up to date.", Project.MSG_VERBOSE ); } } - String[] result = new String[v.size()]; + String[] result = new String[ v.size() ]; v.copyInto( result ); return result; } @@ -147,10 +148,10 @@ public class SourceFileScanner FileNameMapper mapper ) { String[] res = restrict( files, srcDir, destDir, mapper ); - File[] result = new File[res.length]; + File[] result = new File[ res.length ]; for( int i = 0; i < res.length; i++ ) { - result[i] = new File( srcDir, res[i] ); + result[ i ] = new File( srcDir, res[ i ] ); } return result; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/StringUtils.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/StringUtils.java index 6881490c0..6e131df20 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/StringUtils.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/StringUtils.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.util; + import java.io.PrintWriter; import java.io.StringWriter; diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/depend/Dependencies.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/depend/Dependencies.java index b7808ff0c..cda32fbb5 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/depend/Dependencies.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/depend/Dependencies.java @@ -6,12 +6,17 @@ * the LICENSE file. */ package org.apache.tools.ant.util.depend; -import java.io.*; -import java.util.*; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeSet; import org.apache.bcel.*; import org.apache.bcel.classfile.*; - public class Dependencies implements Visitor { private boolean verbose = false; @@ -44,9 +49,9 @@ public class Dependencies implements Visitor int o = 0; String arg = null; - if( "-base".equals( args[0] ) ) + if( "-base".equals( args[ 0 ] ) ) { - arg = args[1]; + arg = args[ 1 ]; if( !arg.endsWith( File.separator ) ) { arg = arg + File.separator; @@ -57,7 +62,7 @@ public class Dependencies implements Visitor for( int i = o; i < args.length; i++ ) { - String fileName = args[i].substring( 0, args[i].length() - ".class".length() ); + String fileName = args[ i ].substring( 0, args[ i ].length() - ".class".length() ); if( base != null && fileName.startsWith( base ) ) fileName = fileName.substring( base.length() ); newSet.add( fileName ); @@ -84,19 +89,19 @@ public class Dependencies implements Visitor visitor.clearDependencies(); applyFilter( newSet, - new Filter() - { - public boolean accept( Object object ) - { - String fileName = object + ".class"; - if( base != null ) - fileName = base + fileName; - return new File( fileName ).exists(); - } - } ); + new Filter() + { + public boolean accept( Object object ) + { + String fileName = object + ".class"; + if( base != null ) + fileName = base + fileName; + return new File( fileName ).exists(); + } + } ); newSet.removeAll( set ); set.addAll( newSet ); - }while ( newSet.size() > 0 ); + } while( newSet.size() > 0 ); Iterator i = set.iterator(); while( i.hasNext() ) @@ -121,9 +126,13 @@ public class Dependencies implements Visitor dependencies.clear(); } - public void visitCode( Code obj ) { } + public void visitCode( Code obj ) + { + } - public void visitCodeException( CodeException obj ) { } + public void visitCodeException( CodeException obj ) + { + } public void visitConstantClass( ConstantClass obj ) { @@ -135,21 +144,37 @@ public class Dependencies implements Visitor dependencies.add( "" + obj.getConstantValue( constantPool ) ); } - public void visitConstantDouble( ConstantDouble obj ) { } + public void visitConstantDouble( ConstantDouble obj ) + { + } - public void visitConstantFieldref( ConstantFieldref obj ) { } + public void visitConstantFieldref( ConstantFieldref obj ) + { + } - public void visitConstantFloat( ConstantFloat obj ) { } + public void visitConstantFloat( ConstantFloat obj ) + { + } - public void visitConstantInteger( ConstantInteger obj ) { } + public void visitConstantInteger( ConstantInteger obj ) + { + } - public void visitConstantInterfaceMethodref( ConstantInterfaceMethodref obj ) { } + public void visitConstantInterfaceMethodref( ConstantInterfaceMethodref obj ) + { + } - public void visitConstantLong( ConstantLong obj ) { } + public void visitConstantLong( ConstantLong obj ) + { + } - public void visitConstantMethodref( ConstantMethodref obj ) { } + public void visitConstantMethodref( ConstantMethodref obj ) + { + } - public void visitConstantNameAndType( ConstantNameAndType obj ) { } + public void visitConstantNameAndType( ConstantNameAndType obj ) + { + } public void visitConstantPool( ConstantPool obj ) { @@ -168,15 +193,25 @@ public class Dependencies implements Visitor } } - public void visitConstantString( ConstantString obj ) { } + public void visitConstantString( ConstantString obj ) + { + } - public void visitConstantUtf8( ConstantUtf8 obj ) { } + public void visitConstantUtf8( ConstantUtf8 obj ) + { + } - public void visitConstantValue( ConstantValue obj ) { } + public void visitConstantValue( ConstantValue obj ) + { + } - public void visitDeprecated( Deprecated obj ) { } + public void visitDeprecated( Deprecated obj ) + { + } - public void visitExceptionTable( ExceptionTable obj ) { } + public void visitExceptionTable( ExceptionTable obj ) + { + } public void visitField( Field obj ) { @@ -188,9 +223,13 @@ public class Dependencies implements Visitor addClasses( obj.getSignature() ); } - public void visitInnerClass( InnerClass obj ) { } + public void visitInnerClass( InnerClass obj ) + { + } - public void visitInnerClasses( InnerClasses obj ) { } + public void visitInnerClasses( InnerClasses obj ) + { + } public void visitJavaClass( JavaClass obj ) { @@ -209,24 +248,32 @@ public class Dependencies implements Visitor Field[] fields = obj.getFields(); for( int i = 0; i < fields.length; i++ ) { - fields[i].accept( this ); + fields[ i ].accept( this ); } // visit methods Method[] methods = obj.getMethods(); for( int i = 0; i < methods.length; i++ ) { - methods[i].accept( this ); + methods[ i ].accept( this ); } } - public void visitLineNumber( LineNumber obj ) { } + public void visitLineNumber( LineNumber obj ) + { + } - public void visitLineNumberTable( LineNumberTable obj ) { } + public void visitLineNumberTable( LineNumberTable obj ) + { + } - public void visitLocalVariable( LocalVariable obj ) { } + public void visitLocalVariable( LocalVariable obj ) + { + } - public void visitLocalVariableTable( LocalVariableTable obj ) { } + public void visitLocalVariableTable( LocalVariableTable obj ) + { + } public void visitMethod( Method obj ) { @@ -241,15 +288,25 @@ public class Dependencies implements Visitor addClasses( signature.substring( pos + 1 ) ); } - public void visitSourceFile( SourceFile obj ) { } + public void visitSourceFile( SourceFile obj ) + { + } - public void visitStackMap( StackMap obj ) { } + public void visitStackMap( StackMap obj ) + { + } - public void visitStackMapEntry( StackMapEntry obj ) { } + public void visitStackMapEntry( StackMapEntry obj ) + { + } - public void visitSynthetic( Synthetic obj ) { } + public void visitSynthetic( Synthetic obj ) + { + } - public void visitUnknown( Unknown obj ) { } + public void visitUnknown( Unknown obj ) + { + } void addClass( String string ) { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/depend/Filter.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/depend/Filter.java index 2cd26d2aa..62bda990b 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/depend/Filter.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/depend/Filter.java @@ -6,7 +6,6 @@ * the LICENSE file. */ package org.apache.tools.ant.util.depend; -import java.util.*; public interface Filter { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java index 1c6d57994..a0d26dbed 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.oro.text.regex.MatchResult; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.Perl5Compiler; import org.apache.oro.text.regex.Perl5Matcher; -import org.apache.tools.ant.BuildException; /** * Implementation of RegexpMatcher for Jakarta-ORO. @@ -26,7 +27,9 @@ public class JakartaOroMatcher implements RegexpMatcher private String pattern; - public JakartaOroMatcher() { } + public JakartaOroMatcher() + { + } /** * Set the regexp pattern from the String description. @@ -46,10 +49,10 @@ public class JakartaOroMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String argument ) - throws BuildException + throws TaskException { return getGroups( argument, MATCH_DEFAULT ); } @@ -63,10 +66,10 @@ public class JakartaOroMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String input, int options ) - throws BuildException + throws TaskException { if( !matches( input, options ) ) { @@ -97,10 +100,10 @@ public class JakartaOroMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String argument ) - throws BuildException + throws TaskException { return matches( argument, MATCH_DEFAULT ); } @@ -111,10 +114,10 @@ public class JakartaOroMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String input, int options ) - throws BuildException + throws TaskException { Pattern p = getCompiledPattern( options ); return matcher.contains( input, p ); @@ -125,10 +128,10 @@ public class JakartaOroMatcher implements RegexpMatcher * * @param options Description of Parameter * @return The CompiledPattern value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected Pattern getCompiledPattern( int options ) - throws BuildException + throws TaskException { try { @@ -138,7 +141,7 @@ public class JakartaOroMatcher implements RegexpMatcher } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java index 88e8f31f6..a7fdc0855 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java @@ -6,11 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + +import org.apache.myrmidon.api.TaskException; import org.apache.oro.text.regex.Perl5Substitution; import org.apache.oro.text.regex.Substitution; import org.apache.oro.text.regex.Util; -import org.apache.tools.ant.BuildException; - /** * Regular expression implementation using the Jakarta Oro package @@ -27,7 +27,7 @@ public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp } public String substitute( String input, String argument, int options ) - throws BuildException + throws TaskException { // translate \1 to $1 so that the Perl5Substitution will work StringBuffer subst = new StringBuffer(); @@ -64,12 +64,12 @@ public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp // Do the substitution Substitution s = new Perl5Substitution( subst.toString(), - Perl5Substitution.INTERPOLATE_ALL ); + Perl5Substitution.INTERPOLATE_ALL ); return Util.substitute( matcher, - getCompiledPattern( options ), - s, - input, - getSubsOptions( options ) ); + getCompiledPattern( options ), + s, + input, + getSubsOptions( options ) ); } protected int getSubsOptions( int options ) diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java index a51a8ff3a..de9c49807 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.regexp.RE; import org.apache.regexp.RESyntaxException; -import org.apache.tools.ant.BuildException; /** * Implementation of RegexpMatcher for Jakarta-Regexp. @@ -41,16 +42,16 @@ public class JakartaRegexpMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String argument ) - throws BuildException + throws TaskException { return getGroups( argument, MATCH_DEFAULT ); } public Vector getGroups( String input, int options ) - throws BuildException + throws TaskException { RE reg = getCompiledPattern( options ); if( !matches( input, reg ) ) @@ -81,10 +82,10 @@ public class JakartaRegexpMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String argument ) - throws BuildException + throws TaskException { return matches( argument, MATCH_DEFAULT ); } @@ -95,16 +96,16 @@ public class JakartaRegexpMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String input, int options ) - throws BuildException + throws TaskException { return matches( input, getCompiledPattern( options ) ); } protected RE getCompiledPattern( int options ) - throws BuildException + throws TaskException { int cOptions = getCompilerOptions( options ); try @@ -115,7 +116,7 @@ public class JakartaRegexpMatcher implements RegexpMatcher } catch( RESyntaxException e ) { - throw new BuildException( e ); + throw new TaskException( e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java index 3f41e50e5..de5c807ca 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.regexp.RE; -import org.apache.tools.ant.BuildException; /** * Regular expression implementation using the Jakarta Regexp package @@ -25,7 +26,7 @@ public class JakartaRegexpRegexp extends JakartaRegexpMatcher implements Regexp } public String substitute( String input, String argument, int options ) - throws BuildException + throws TaskException { Vector v = getGroups( input, options ); @@ -42,7 +43,7 @@ public class JakartaRegexpRegexp extends JakartaRegexpMatcher implements Regexp int value = Character.digit( c, 10 ); if( value > -1 ) { - result.append( ( String )v.elementAt( value ) ); + result.append( (String)v.elementAt( value ) ); } else { diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java index a58796880..b6c509819 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Implementation of RegexpMatcher for the built-in regexp matcher of JDK 1.4. @@ -24,7 +25,9 @@ public class Jdk14RegexpMatcher implements RegexpMatcher private String pattern; - public Jdk14RegexpMatcher() { } + public Jdk14RegexpMatcher() + { + } /** * Set the regexp pattern from the String description. @@ -44,10 +47,10 @@ public class Jdk14RegexpMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String argument ) - throws BuildException + throws TaskException { return getGroups( argument, MATCH_DEFAULT ); } @@ -61,10 +64,10 @@ public class Jdk14RegexpMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String input, int options ) - throws BuildException + throws TaskException { Pattern p = getCompiledPattern( options ); Matcher matcher = p.matcher( input ); @@ -96,10 +99,10 @@ public class Jdk14RegexpMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String argument ) - throws BuildException + throws TaskException { return matches( argument, MATCH_DEFAULT ); } @@ -110,10 +113,10 @@ public class Jdk14RegexpMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String input, int options ) - throws BuildException + throws TaskException { try { @@ -122,12 +125,12 @@ public class Jdk14RegexpMatcher implements RegexpMatcher } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } protected Pattern getCompiledPattern( int options ) - throws BuildException + throws TaskException { int cOptions = getCompilerOptions( options ); try @@ -137,7 +140,7 @@ public class Jdk14RegexpMatcher implements RegexpMatcher } catch( PatternSyntaxException e ) { - throw new BuildException( e ); + throw new TaskException( e ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java index 23998f0e6..1a2973626 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.tools.ant.BuildException; - +import org.apache.myrmidon.api.TaskException; /** * Regular expression implementation using the JDK 1.4 regular expression @@ -27,7 +27,7 @@ public class Jdk14RegexpRegexp extends Jdk14RegexpMatcher implements Regexp } public String substitute( String input, String argument, int options ) - throws BuildException + throws TaskException { // translate \1 to $(1) so that the Matcher will work StringBuffer subst = new StringBuffer(); diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Regexp.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Regexp.java index 2acaeda47..b5901beab 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Regexp.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/Regexp.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Interface which represents a regular expression, and the operations that can @@ -35,8 +36,8 @@ public interface Regexp extends RegexpMatcher * @param options The list of options for the match and replace. See the * MATCH_ and REPLACE_ constants above. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ String substitute( String input, String argument, int options ) - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java index 559bdf958..5e9015a00 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -20,18 +21,20 @@ import org.apache.tools.ant.Project; */ public class RegexpFactory extends RegexpMatcherFactory { - public RegexpFactory() { } + public RegexpFactory() + { + } /** * Create a new regular expression matcher instance. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Regexp newRegexp() - throws BuildException + throws TaskException { - return ( Regexp )newRegexp( null ); + return (Regexp)newRegexp( null ); } /** @@ -39,10 +42,10 @@ public class RegexpFactory extends RegexpMatcherFactory * * @param p Project whose ant.regexp.regexpimpl property will be used. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Regexp newRegexp( Project p ) - throws BuildException + throws TaskException { String systemDefault = null; if( p == null ) @@ -51,7 +54,7 @@ public class RegexpFactory extends RegexpMatcherFactory } else { - systemDefault = ( String )p.getProperties().get( "ant.regexp.regexpimpl" ); + systemDefault = (String)p.getProperties().get( "ant.regexp.regexpimpl" ); } if( systemDefault != null ) @@ -65,24 +68,27 @@ public class RegexpFactory extends RegexpMatcherFactory { return createRegexpInstance( "org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } try { return createRegexpInstance( "org.apache.tools.ant.util.regexp.JakartaOroRegexp" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } try { return createRegexpInstance( "org.apache.tools.ant.util.regexp.JakartaRegexpRegexp" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } - throw new BuildException( "No supported regular expression matcher found" ); + throw new TaskException( "No supported regular expression matcher found" ); } /** @@ -91,21 +97,21 @@ public class RegexpFactory extends RegexpMatcherFactory * * @param classname Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @since 1.3 */ protected Regexp createRegexpInstance( String classname ) - throws BuildException + throws TaskException { RegexpMatcher m = createInstance( classname ); if( m instanceof Regexp ) { - return ( Regexp )m; + return (Regexp)m; } else { - throw new BuildException( classname + " doesn't implement the Regexp interface" ); + throw new TaskException( classname + " doesn't implement the Regexp interface" ); } } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpMatcher.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpMatcher.java index 26ef487c0..83b9a8bc1 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpMatcher.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpMatcher.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Interface describing a regular expression matcher. @@ -39,34 +40,33 @@ public interface RegexpMatcher */ int MATCH_SINGLELINE = 0x00010000; - /** * Set the regexp pattern from the String description. * * @param pattern The new Pattern value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void setPattern( String pattern ) - throws BuildException; + throws TaskException; /** * Get a String representation of the regexp pattern * * @return The Pattern value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ String getPattern() - throws BuildException; + throws TaskException; /** * Does the given argument match the pattern? * * @param argument Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean matches( String argument ) - throws BuildException; + throws TaskException; /** * Returns a Vector of matched groups found in the argument.

@@ -76,10 +76,10 @@ public interface RegexpMatcher * * @param argument Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ Vector getGroups( String argument ) - throws BuildException; + throws TaskException; /** * Does this regular expression match the input, given certain options @@ -88,10 +88,10 @@ public interface RegexpMatcher * @param options The list of options for the match. See the MATCH_ * constants above. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean matches( String input, int options ) - throws BuildException; + throws TaskException; /** * Get the match groups from this regular expression. The return type of the @@ -101,9 +101,9 @@ public interface RegexpMatcher * @param options The list of options for the match. See the MATCH_ * constants above. * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ Vector getGroups( String input, int options ) - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java index 5620b9b70..22f8f2cc7 100644 --- a/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java +++ b/proposal/myrmidon/src/main/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -22,16 +23,18 @@ import org.apache.tools.ant.Project; public class RegexpMatcherFactory { - public RegexpMatcherFactory() { } + public RegexpMatcherFactory() + { + } /** * Create a new regular expression instance. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public RegexpMatcher newRegexpMatcher() - throws BuildException + throws TaskException { return newRegexpMatcher( null ); } @@ -41,10 +44,10 @@ public class RegexpMatcherFactory * * @param p Project whose ant.regexp.regexpimpl property will be used. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public RegexpMatcher newRegexpMatcher( Project p ) - throws BuildException + throws TaskException { String systemDefault = null; if( p == null ) @@ -53,7 +56,7 @@ public class RegexpMatcherFactory } else { - systemDefault = ( String )p.getProperties().get( "ant.regexp.regexpimpl" ); + systemDefault = (String)p.getProperties().get( "ant.regexp.regexpimpl" ); } if( systemDefault != null ) @@ -67,37 +70,40 @@ public class RegexpMatcherFactory { return createInstance( "org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } try { return createInstance( "org.apache.tools.ant.util.regexp.JakartaOroMatcher" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } try { return createInstance( "org.apache.tools.ant.util.regexp.JakartaRegexpMatcher" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } - throw new BuildException( "No supported regular expression matcher found" ); + throw new TaskException( "No supported regular expression matcher found" ); } protected RegexpMatcher createInstance( String className ) - throws BuildException + throws TaskException { try { Class implClass = Class.forName( className ); - return ( RegexpMatcher )implClass.newInstance(); + return (RegexpMatcher)implClass.newInstance(); } catch( Throwable t ) { - throw new BuildException( "Error", t ); + throw new TaskException( "Error", t ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/AntStructure.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/AntStructure.java index 39416e5a4..a6a487755 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/AntStructure.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/AntStructure.java @@ -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.io.UnsupportedEncodingException; 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; @@ -31,7 +32,6 @@ import org.apache.tools.ant.types.EnumeratedAttribute; public class AntStructure extends Task { - private final String lSep = System.getProperty( "line.separator" ); private final String BOOLEAN = "%boolean;"; @@ -53,12 +53,12 @@ public class AntStructure extends Task } 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 @@ public class AntStructure extends Task } 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 @@ public class AntStructure extends Task } catch( IOException ioe ) { - throw new BuildException( "Error writing " + output.getAbsolutePath(), - ioe ); + throw new TaskException( "Error writing " + output.getAbsolutePath(), + ioe ); } finally { @@ -152,7 +152,7 @@ public class AntStructure extends Task { for( int i = 0; i < s.length; i++ ) { - if( !isNmtoken( s[i] ) ) + if( !isNmtoken( s[ i ] ) ) { return false; } @@ -161,7 +161,7 @@ public class AntStructure extends Task } private void printElementDecl( PrintWriter out, String name, Class element ) - throws BuildException + throws TaskException { if( visited.containsKey( name ) ) @@ -213,7 +213,7 @@ public class AntStructure extends Task Enumeration enum = ih.getNestedElements(); while( enum.hasMoreElements() ) { - v.addElement( ( String )enum.nextElement() ); + v.addElement( (String)enum.nextElement() ); } if( v.isEmpty() ) @@ -247,7 +247,7 @@ public class AntStructure extends Task 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 @@ public class AntStructure extends Task 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 @@ public class AntStructure extends Task { sb.append( " | " ); } - sb.append( values[i] ); + sb.append( values[ i ] ); } sb.append( ") " ); } @@ -309,11 +309,11 @@ public class AntStructure extends Task 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 @@ public class AntStructure extends Task boolean first = true; while( tasks.hasMoreElements() ) { - String taskName = ( String )tasks.nextElement(); + String taskName = (String)tasks.nextElement(); if( !first ) { out.print( " | " ); @@ -345,7 +345,7 @@ public class AntStructure extends Task first = true; while( types.hasMoreElements() ) { - String typeName = ( String )types.nextElement(); + String typeName = (String)types.nextElement(); if( !first ) { out.print( " | " ); @@ -370,7 +370,9 @@ public class AntStructure extends Task out.println( "" ); } - private void printTail( PrintWriter out ) { } + private void printTail( PrintWriter out ) + { + } private void printTargetDecl( PrintWriter out ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java index 94c6e8c5a..de7d75ec8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Available.java @@ -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.EnumeratedAttribute; 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 @@ public class Available this.resource = resource; } - - public void setType( FileDir type ) + public void setType( FileDir type ) { this.type = type; } @@ -114,7 +113,7 @@ public class Available { 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 @@ public class Available { if( property == null ) { - throw new BuildException( "property attribute is required"); + throw new TaskException( "property attribute is required" ); } if( eval() ) @@ -218,6 +217,7 @@ public class Available } private boolean checkFile() + throws TaskException { if( filepath == null ) { @@ -228,7 +228,7 @@ public class Available 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 ) @@ -242,11 +242,11 @@ public class Available * 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 @@ public class Available 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 @@ public class Available 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 @@ public class Available if( path.exists() && path.isDirectory() ) { if( checkFile( new File( path, file ), - file + " in " + path ) ) + file + " in " + path ) ) { return true; } @@ -303,7 +303,7 @@ public class Available if( parent != null && parent.exists() ) { if( checkFile( new File( parent, file ), - file + " in " + parent ) ) + file + " in " + parent ) ) { return true; } @@ -316,7 +316,7 @@ public class Available if( grandParent != null && grandParent.exists() ) { if( checkFile( new File( grandParent, file ), - file + " in " + grandParent ) ) + file + " in " + grandParent ) ) { return true; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/BUnzip2.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/BUnzip2.java index 3b2dc6fdf..b33901acd 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/BUnzip2.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/BUnzip2.java @@ -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 @@ public class BUnzip2 extends Unpack 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 @@ public class BUnzip2 extends Unpack bis.close(); } catch( IOException ioex ) - {} + { + } } if( fis != null ) { @@ -88,7 +90,8 @@ public class BUnzip2 extends Unpack fis.close(); } catch( IOException ioex ) - {} + { + } } if( out != null ) { @@ -97,7 +100,8 @@ public class BUnzip2 extends Unpack out.close(); } catch( IOException ioex ) - {} + { + } } if( zIn != null ) { @@ -106,7 +110,8 @@ public class BUnzip2 extends Unpack zIn.close(); } catch( IOException ioex ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/BZip2.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/BZip2.java index be8635f3f..8a06764c1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/BZip2.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/BZip2.java @@ -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 @@ public class BZip2 extends Pack 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 @@ public class BZip2 extends Pack zOut.close(); } catch( IOException e ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/CVSPass.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/CVSPass.java index 44b7ed617..6c82ee6df 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/CVSPass.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/CVSPass.java @@ -6,15 +6,15 @@ * 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 @@ -100,10 +100,10 @@ public class CVSPass extends Task /** * 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 @@ public class CVSPass extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } @@ -158,7 +158,7 @@ public class CVSPass extends Task 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(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Checksum.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Checksum.java index e9b444d54..6f971a1b5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Checksum.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Checksum.java @@ -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.security.NoSuchProviderException; 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 @@ public class Checksum extends MatchingTask implements Condition * * @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 @@ public class Checksum extends MatchingTask implements Condition /** * 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 @@ public class Checksum extends MatchingTask implements Condition * 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 @@ public class Checksum extends MatchingTask implements Condition else { log( file + " omitted as " + dest + " is up to date.", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); } } else @@ -229,10 +228,10 @@ public class Checksum extends MatchingTask implements Condition 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 @@ public class Checksum extends MatchingTask implements Condition * 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 @@ public class Checksum extends MatchingTask implements Condition 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 @@ public class Checksum extends MatchingTask implements Condition 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 @@ public class Checksum extends MatchingTask implements Condition { if( isCondition ) { - File existingFile = ( File )destination; + File existingFile = (File)destination; if( existingFile.exists() && existingFile.length() == checksum.length() ) { @@ -318,7 +317,7 @@ public class Checksum extends MatchingTask implements Condition } else { - File dest = ( File )destination; + File dest = (File)destination; fos = new FileOutputStream( dest ); fos.write( checksum.getBytes() ); fos.close(); @@ -329,7 +328,7 @@ public class Checksum extends MatchingTask implements Condition } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } finally { @@ -340,7 +339,8 @@ public class Checksum extends MatchingTask implements Condition fis.close(); } catch( IOException e ) - {} + { + } } if( fos != null ) { @@ -349,7 +349,8 @@ public class Checksum extends MatchingTask implements Condition fos.close(); } catch( IOException e ) - {} + { + } } } return checksumMatches; @@ -359,10 +360,10 @@ public class Checksum extends MatchingTask implements Condition * 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 @@ public class Checksum extends MatchingTask implements Condition 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 @@ public class Checksum extends MatchingTask implements Condition 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 ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Chmod.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Chmod.java index 6df33d6bd..2c61b6613 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Chmod.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Chmod.java @@ -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 class Chmod extends ExecuteOn 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 @@ public class Chmod extends ExecuteOn 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 class Chmod extends ExecuteOn 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 class Chmod extends ExecuteOn } public void execute() - throws BuildException + throws TaskException { if( defaultSetDefined || defaultSet.getDir( project ) == null ) { @@ -161,7 +160,7 @@ public class Chmod extends ExecuteOn } catch( IOException e ) { - throw new BuildException( "Execute failed: " + e, e ); + throw new TaskException( "Execute failed: " + e, e ); } finally { @@ -180,7 +179,7 @@ public class Chmod extends ExecuteOn { 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 ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ConditionTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ConditionTask.java index db05c6075..16261d965 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ConditionTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ConditionTask.java @@ -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 @@ -54,7 +54,7 @@ public class ConditionTask extends ConditionBase /** * 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 @@ public class ConditionTask extends ConditionBase { throw new TaskException( "You must nest a condition into " ); } - Condition c = ( Condition )getConditions().nextElement(); + Condition c = (Condition)getConditions().nextElement(); if( c.eval() ) { getProject().setNewProperty( property, value ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Copy.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Copy.java index ba97365c5..54713ad34 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Copy.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Copy.java @@ -13,7 +13,6 @@ import java.util.Enumeration; 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 @@ public class Copy extends Task * 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 @@ public class Copy extends Task /** * Performs the copy operation. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() throws TaskException @@ -369,7 +368,7 @@ public class Copy extends Task { 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 @@ public class Copy extends Task * 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 diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Cvs.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Cvs.java index 371f6ca9d..be8acb91b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Cvs.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Cvs.java @@ -14,7 +14,6 @@ import java.io.IOException; 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 class Cvs extends Task 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) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Delete.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Delete.java index f96f39b7d..939b01b5a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Delete.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Delete.java @@ -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 @@ public class Delete extends MatchingTask this.file = file; } - /** * Used to delete empty directories. * @@ -225,10 +225,10 @@ public class Delete extends MatchingTask /** * 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask { 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 @@ public class Delete extends MatchingTask // 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask else { log( be.getMessage(), - quiet ? Project.MSG_VERBOSE : Project.MSG_WARN ); + quiet ? Project.MSG_VERBOSE : Project.MSG_WARN ); } } } @@ -328,7 +328,7 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask { 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 @@ public class Delete extends MatchingTask { 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask 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 @@ public class Delete extends MatchingTask if( dirCount > 0 ) { log( "Deleted " + dirCount + " director" + - ( dirCount == 1 ? "y" : "ies" ) + - " from " + d.getAbsolutePath() ); + ( dirCount == 1 ? "y" : "ies" ) + + " from " + d.getAbsolutePath() ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java index 0768f88e9..8e786d664 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/DependSet.java @@ -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; @@ -72,7 +73,9 @@ public class DependSet extends MatchingTask /** * Creates a new DependSet Task. */ - public DependSet() { } + public DependSet() + { + } /** * Nested <srcfilelist> element. @@ -117,21 +120,19 @@ public class DependSet extends MatchingTask /** * 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 or element must be set" ); + throw new TaskException( "At least one or element must be set" ); } if( ( targetFileSets.size() == 0 ) && ( targetFileLists.size() == 0 ) ) { - throw new BuildException( "At least one or element must be set" ); + throw new TaskException( "At least one or element must be set" ); } long now = ( new Date() ).getTime(); @@ -153,20 +154,20 @@ public class DependSet extends MatchingTask 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 @@ public class DependSet extends MatchingTask 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 @@ public class DependSet extends MatchingTask } 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 @@ public class DependSet extends MatchingTask 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 @@ public class DependSet extends MatchingTask 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 @@ public class DependSet extends MatchingTask 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(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Ear.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Ear.java index 3456e63e8..6d177d0fe 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Ear.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Ear.java @@ -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 @@ public class Ear extends Jar { 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 @@ public class Ear extends Jar 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 @@ public class Ear extends Jar 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 { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Echo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Echo.java index 1dbd30558..87b5e280c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Echo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Echo.java @@ -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 @@ public class Echo extends Task /** * 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 @@ public class Echo extends Task } catch( IOException ioe ) { - throw new BuildException( "Error", ioe); + throw new TaskException( "Error", ioe ); } finally { @@ -143,7 +143,8 @@ public class Echo extends Task out.close(); } catch( IOException ioex ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecTask.java index d81f23827..1aac3b0c2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecTask.java @@ -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.FileNotFoundException; 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 @@ public class ExecTask extends Task } /** - * 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 @@ public class ExecTask extends Task /** * 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 @@ public class ExecTask extends Task { if( failOnError ) { - throw new BuildException( taskType + " returned: " + err ); + throw new TaskException( taskType + " returned: " + err ); } else { @@ -271,22 +272,22 @@ public class ExecTask extends Task /** * 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 @@ public class ExecTask extends Task * 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 @@ public class ExecTask extends Task } 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 @@ public class ExecTask extends Task else { return new LogStreamHandler( this, - Project.MSG_INFO, Project.MSG_WARN ); + Project.MSG_INFO, Project.MSG_WARN ); } } @@ -333,10 +334,10 @@ public class ExecTask extends Task * 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 @@ public class ExecTask extends Task baos.close(); } catch( IOException io ) - {} + { + } } /** @@ -378,10 +380,10 @@ public class ExecTask extends Task * 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 @@ public class ExecTask extends Task { 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 @@ public class ExecTask extends Task * 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 @@ public class ExecTask extends Task { if( failIfExecFails ) { - throw new BuildException( "Execute failed: " + e.toString(), e ); + throw new TaskException( "Execute failed: " + e.toString(), e ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Execute.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Execute.java index c9b0ddf72..8b323717d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Execute.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Execute.java @@ -18,11 +18,10 @@ import java.util.Locale; 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 @@ public class Execute * * @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 @@ public class Execute 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 @@ public class Execute * 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 @@ public class Execute } 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 ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteJava.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteJava.java index 1c20e5ffd..4d015623d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteJava.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteJava.java @@ -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 @@ import org.apache.tools.ant.types.Path; * @author thomas.haas@softwired-inc.com * @author Stefan Bodewig */ + public class ExecuteJava { @@ -43,7 +44,7 @@ public class ExecuteJava } public void execute( Project project ) - throws BuildException + throws TaskException { final String classname = javaCommand.getExecutable(); final Object[] argument = {javaCommand.getArguments()}; @@ -75,27 +76,27 @@ public class ExecuteJava } 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 { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java index 02598c18d..daa6903b3 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -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 @@ public class ExecuteOn extends ExecTask this.destDir = destDir; } - /** * Shall the command work on all specified files in parallel? * @@ -110,14 +110,14 @@ public class ExecuteOn extends ExecTask * 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 @@ public class ExecuteOn extends ExecTask { 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 @@ public class ExecuteOn extends ExecTask { 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask } } } - 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 @@ public class ExecuteOn extends ExecTask int targetIndex = targetFilePos.getPosition(); if( srcIndex < targetIndex - || ( srcIndex == targetIndex && srcIsFirst ) ) + || ( srcIndex == targetIndex && srcIsFirst ) ) { // 0 --> srcIndex @@ -220,18 +220,18 @@ public class ExecuteOn extends ExecTask // 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 @@ public class ExecuteOn extends ExecTask // 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask { 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 @@ public class ExecuteOn extends ExecTask { SourceFileScanner sfs = new SourceFileScanner( this ); return sfs.restrict( ds.getIncludedDirectories(), baseDir, destDir, - mapper ); + mapper ); } else { @@ -332,7 +332,7 @@ public class ExecuteOn extends ExecTask { SourceFileScanner sfs = new SourceFileScanner( this ); return sfs.restrict( ds.getIncludedFiles(), baseDir, destDir, - mapper ); + mapper ); } else { @@ -345,27 +345,27 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask ; for( int j = 0; j < s.length; j++ ) { - fileNames.addElement( s[j] ); + fileNames.addElement( s[ j ] ); baseDirs.addElement( base ); } } @@ -408,13 +408,13 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask 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 @@ public class ExecuteOn extends ExecTask } catch( IOException e ) { - throw new BuildException( "Execute failed: " + e, e ); + throw new TaskException( "Execute failed: " + e, e ); } finally { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java index f9f64cca6..4129b61d2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteStreamHandler.java @@ -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; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java index 318e622aa..4edcfc65f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java @@ -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; /** * Destroys a process running for too long. For example:

@@ -84,16 +85,16 @@ public class ExecuteWatchdog implements Runnable
      * 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 @@ public class ExecuteWatchdog implements Runnable
         return killedProcess;
     }
 
-
     /**
      * Watches the process and terminates it, if it runs for to long.
      */
@@ -127,7 +127,8 @@ public class ExecuteWatchdog implements Runnable
                     wait( until - now );
                 }
                 catch( InterruptedException e )
-                {}
+                {
+                }
             }
 
             // if we are here, either someone stopped the watchdog,
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Exit.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Exit.java
index 60ae24009..0f441a1e7 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Exit.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Exit.java
@@ -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 class Exit extends Task
     }
 
     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" );
             }
         }
     }
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Expand.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Expand.java
index 88e1bd21d..ac86f32ac 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Expand.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Expand.java
@@ -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.Date;
 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 @@ public class Expand extends MatchingTask
     /**
      * 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 @@ public class Expand extends MatchingTask
         {
             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 @@ public class Expand extends MatchingTask
         {
             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 @@ public class Expand extends MatchingTask
             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 @@ public class Expand extends MatchingTask
                     zis.close();
                 }
                 catch( IOException e )
-                {}
+                {
+                }
             }
         }
     }
@@ -199,13 +201,13 @@ public class Expand extends MatchingTask
             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 @@ public class Expand extends MatchingTask
                 {
                     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 @@ public class Expand extends MatchingTask
         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 @@ public class Expand extends MatchingTask
             }
             else
             {
-                byte[] buffer = new byte[1024];
+                byte[] buffer = new byte[ 1024 ];
                 int length = 0;
                 FileOutputStream fos = null;
                 try
@@ -282,7 +284,8 @@ public class Expand extends MatchingTask
                             fos.close();
                         }
                         catch( IOException e )
-                        {}
+                        {
+                        }
                     }
                 }
             }
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java
index b51e712f6..d8ac808ad 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Filter.java
@@ -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 class Filter extends Task
     }
 
     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 @@ public class Filter extends Task
     }
 
     protected void readFilters()
-        throws BuildException
+        throws TaskException
     {
         log( "Reading filters from " + filtersFile, Project.MSG_VERBOSE );
         project.getGlobalFilterSet().readFiltersFromFile( filtersFile );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/FixCRLF.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/FixCRLF.java
index 18c757c2d..2a2288eb0 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/FixCRLF.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/FixCRLF.java
@@ -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.Reader;
 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;
@@ -192,7 +193,6 @@ public class FixCRLF extends MatchingTask
         }
     }
 
-
     /**
      * Specify how EndOfLine characters are to be handled
      *
@@ -270,14 +270,14 @@ public class FixCRLF extends MatchingTask
      * 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 @@ public class FixCRLF extends MatchingTask
     /**
      * 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 @@ public class FixCRLF extends MatchingTask
         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 @@ public class FixCRLF extends MatchingTask
      *
      * @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 @@ public class FixCRLF extends MatchingTask
             }
         }// 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 @@ public class FixCRLF extends MatchingTask
      * 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 @@ public class FixCRLF extends MatchingTask
         //  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 @@ public class FixCRLF extends MatchingTask
         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 @@ public class FixCRLF extends MatchingTask
         // 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 @@ public class FixCRLF extends MatchingTask
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error", e );
+                throw new TaskException( "Error", e );
             }// end of try-catch
         }
         else
@@ -519,9 +517,9 @@ public class FixCRLF extends MatchingTask
                 ; 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 @@ public class FixCRLF extends MatchingTask
             }
             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 @@ public class FixCRLF extends MatchingTask
 
     }
 
-
     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 @@ public class FixCRLF extends MatchingTask
             {
                 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 @@ public class FixCRLF extends MatchingTask
 
                 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 @@ public class FixCRLF extends MatchingTask
                     }
                     catch( IOException e )
                     {
-                        throw new BuildException( "Error", e );
+                        throw new TaskException( "Error", e );
                     }// end of try-catch
 
                 }
@@ -630,78 +627,78 @@ public class FixCRLF extends MatchingTask
                     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;
+                                }
+
+                                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() ) );
                                 }
-                            }
-
-                            // 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;
+                                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 @@ public class FixCRLF extends MatchingTask
                 }
                 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 @@ public class FixCRLF extends MatchingTask
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error", e );
+                throw new TaskException( "Error", e );
             }
             finally
             {
@@ -743,7 +740,7 @@ public class FixCRLF extends MatchingTask
                 }
                 catch( IOException e )
                 {
-                    throw new BuildException( "Error", e );
+                    throw new TaskException( "Error", e );
                 }
             }
 
@@ -756,7 +753,7 @@ public class FixCRLF extends MatchingTask
             }
             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 @@ public class FixCRLF extends MatchingTask
                     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 @@ public class FixCRLF extends MatchingTask
                 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 @@ public class FixCRLF extends MatchingTask
         }
         catch( IOException e )
         {
-            throw new BuildException( "Error", e );
+            throw new TaskException( "Error", e );
         }
         finally
         {
@@ -860,7 +857,6 @@ public class FixCRLF extends MatchingTask
         }
     }
 
-
     class OneLiner implements Enumeration
     {
 
@@ -874,7 +870,7 @@ public class FixCRLF extends MatchingTask
         private BufferedReader reader;
 
         public OneLiner( File srcFile )
-            throws BuildException
+            throws TaskException
         {
             try
             {
@@ -884,7 +880,7 @@ public class FixCRLF extends MatchingTask
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error", e );
+                throw new TaskException( "Error", e );
             }
         }
 
@@ -931,7 +927,7 @@ public class FixCRLF extends MatchingTask
         }
 
         protected void nextLine()
-            throws BuildException
+            throws TaskException
         {
             int ch = -1;
             int eolcount = 0;
@@ -944,7 +940,7 @@ public class FixCRLF extends MatchingTask
                 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 @@ public class FixCRLF extends MatchingTask
                     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 @@ public class FixCRLF extends MatchingTask
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error", e );
+                throw new TaskException( "Error", e );
             }
         }
 
@@ -1026,7 +1022,7 @@ public class FixCRLF extends MatchingTask
             private String line;
 
             public BufferLine( String line, String eolStr )
-                throws BuildException
+                throws TaskException
             {
                 next = 0;
                 column = 0;
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GUnzip.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GUnzip.java
index 50088af38..bcd2aa6eb 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GUnzip.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GUnzip.java
@@ -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 @@ public class GUnzip extends Unpack
                 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 @@ public class GUnzip extends Unpack
                         fis.close();
                     }
                     catch( IOException ioex )
-                    {}
+                    {
+                    }
                 }
                 if( out != null )
                 {
@@ -76,7 +78,8 @@ public class GUnzip extends Unpack
                         out.close();
                     }
                     catch( IOException ioex )
-                    {}
+                    {
+                    }
                 }
                 if( zIn != null )
                 {
@@ -85,7 +88,8 @@ public class GUnzip extends Unpack
                         zIn.close();
                     }
                     catch( IOException ioex )
-                    {}
+                    {
+                    }
                 }
             }
         }
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GZip.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GZip.java
index 1469cccee..40fd8c279 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GZip.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GZip.java
@@ -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 @@ public class GZip extends Pack
         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 @@ public class GZip extends Pack
                     zOut.close();
                 }
                 catch( IOException e )
-                {}
+                {
+                }
             }
         }
     }
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GenerateKey.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GenerateKey.java
index 06a0425ea..4a3691a20 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GenerateKey.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/GenerateKey.java
@@ -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 @@ public class GenerateKey extends Task
     {
         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 class GenerateKey extends Task
     }
 
     public void setKeysize( final String keysize )
-        throws BuildException
+        throws TaskException
     {
         try
         {
@@ -76,7 +77,7 @@ public class GenerateKey extends Task
         }
         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 class GenerateKey extends Task
     }
 
     public void setValidity( final String validity )
-        throws BuildException
+        throws TaskException
     {
         try
         {
@@ -109,7 +110,7 @@ public class GenerateKey extends Task
         }
         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 class GenerateKey extends Task
     }
 
     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 @@ public class GenerateKey extends Task
         }
 
         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 @@ public class GenerateKey extends Task
                 }
                 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() ) );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java
index d05868236..b8288c89b 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Get.java
@@ -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.HttpURLConnection;
 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 @@ public class Get extends Task
         }
     }
 
-
     /**
      * Username for basic auth.
      *
@@ -121,33 +121,32 @@ public class Get extends Task
         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 @@ public class Get extends Task
                 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 @@ public class Get extends Task
             //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 @@ public class Get extends Task
                 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 @@ public class Get extends Task
             log( "Error getting " + source + " to " + dest );
             if( ignoreErrors )
                 return;
-            throw new BuildException( "Error", ioe);
+            throw new TaskException( "Error", ioe );
         }
     }
 
@@ -294,16 +293,16 @@ public class Get extends Task
      * @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 class Get extends Task
 
         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 @@ public class Get extends Task
             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 @@ public class Get extends Task
             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 );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Input.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Input.java
index caf080870..21903f655 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Input.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Input.java
@@ -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 @@ public class Input extends Task
     /**
      * No arg constructor.
      */
-    public Input() { }
+    public Input()
+    {
+    }
 
     /**
      * Defines the name of a property to be created from input. Behaviour is
@@ -90,10 +93,10 @@ public class Input extends Task
     /**
      * 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 @@ public class Input extends Task
             }
             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 @@ public class Input extends Task
         {
             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
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Jar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Jar.java
index 8d5aec951..37877733c 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Jar.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Jar.java
@@ -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 @@ public class Jar extends Zip
     {
         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 @@ public class Jar extends Zip
         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 class Jar extends Zip
     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 @@ public class Jar extends Zip
      * @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 @@ public class Jar extends Zip
             {
                 // 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 @@ public class Jar extends Zip
     }
 
     protected void finalizeZipOutputStream( ZipOutputStream zOut )
-        throws IOException, BuildException
+        throws IOException, TaskException
     {
         if( index )
         {
@@ -222,7 +231,7 @@ public class Jar extends Zip
     }
 
     protected void initZipOutputStream( ZipOutputStream zOut )
-        throws IOException, BuildException
+        throws IOException, TaskException
     {
         try
         {
@@ -232,9 +241,9 @@ public class Jar extends Zip
             {
                 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 @@ public class Jar extends Zip
         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 @@ public class Jar extends Zip
         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 @@ public class Jar extends Zip
             }
             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 @@ public class Jar extends Zip
         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 @@ public class Jar extends Zip
         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 @@ public class Jar extends Zip
         catch( ManifestException e )
         {
             log( "Manifest is invalid: " + e.getMessage(), Project.MSG_ERR );
-            throw new BuildException( "Invalid Manifest", e );
+            throw new TaskException( "Invalid Manifest", e );
         }
     }
 }
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
index 2671c6e0f..24972620c 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Java.java
@@ -12,7 +12,7 @@ import java.io.FileOutputStream;
 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 @@ public class Java extends Task
      * 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 @@ public class Java extends Task
     }
 
     /**
-     * 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 @@ public class Java extends Task
      * 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 @@ public class Java extends Task
     /**
      * 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 @@ public class Java extends Task
      *
      * @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 @@ public class Java extends Task
      *
      * @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 @@ public class Java extends Task
      * 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 @@ public class Java extends Task
             }
             catch( IOException io )
             {
-                throw new BuildException( "Error", io );
+                throw new TaskException( "Error", io );
             }
             finally
             {
@@ -358,10 +358,10 @@ public class Java extends Task
      *
      * @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 @@ public class Java extends Task
             }
             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 @@ public class Java extends Task
             }
             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
         {
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java
index 9ff441be4..b8cd75ea0 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javac.java
@@ -10,8 +10,8 @@ package org.apache.tools.ant.taskdefs;
 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 @@ public class Javac extends MatchingTask
     }
 
     /**
-     * Throw a BuildException if compilation fails
+     * Throw a TaskException if compilation fails
      *
      * @param fail The new Failonerror value
      */
@@ -715,26 +715,26 @@ public class Javac extends MatchingTask
     /**
      * 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 @@ public class Javac extends MatchingTask
             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 @@ public class Javac extends MatchingTask
             {
                 if( failOnError )
                 {
-                    throw new BuildException( FAIL_MSG );
+                    throw new TaskException( FAIL_MSG );
                 }
                 else
                 {
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javadoc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javadoc.java
index 98adc71a3..d5a992bbd 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -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.io.PrintWriter;
 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 class Javadoc extends Task
     }
 
     public void setAdditionalparam( String add )
+        throws TaskException
     {
         cmd.createArgument().setLine( add );
     }
@@ -300,6 +301,7 @@ public class Javadoc extends Task
     }
 
     public void setLinkoffline( String src )
+        throws TaskException
     {
         if( !javadoc1 )
         {
@@ -309,14 +311,14 @@ public class Javadoc extends Task
                 "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 class Javadoc extends Task
     }
 
     public void setSourcefiles( String src )
+        throws TaskException
     {
         StringTokenizer tok = new StringTokenizer( src, "," );
         while( tok.hasMoreTokens() )
@@ -606,12 +609,12 @@ public class Javadoc extends Task
     }
 
     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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
         {
             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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
             {
                 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 @@ public class Javadoc extends Task
                         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 @@ public class Javadoc extends Task
             // 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 @@ public class Javadoc extends Task
                         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 @@ public class Javadoc extends Task
                         else
                         {
                             log( "Warning: No package list was found at " + packageListLocation,
-                                Project.MSG_VERBOSE );
+                                 Project.MSG_VERBOSE );
                         }
                     }
                     else
@@ -790,14 +793,14 @@ public class Javadoc extends Task
             // 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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
                 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 @@ public class Javadoc extends Task
                         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 @@ public class Javadoc extends Task
             }
             catch( IOException e )
             {
-                throw new BuildException( "Error creating temporary file", e );
+                throw new TaskException( "Error creating temporary file", e );
             }
             finally
             {
@@ -917,12 +920,12 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
                 err.close();
             }
             catch( IOException e )
-            {}
+            {
+            }
         }
     }
 
@@ -967,7 +971,7 @@ public class Javadoc extends Task
         // 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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
             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 @@ public class Javadoc extends Task
      */
     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 @@ public class Javadoc extends Task
 
         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 @@ public class Javadoc extends Task
         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 @@ public class Javadoc extends Task
         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 @@ public class Javadoc extends Task
 
             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 @@ public class Javadoc extends Task
 
                 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 @@ public class Javadoc extends Task
 
                     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 @@ public class Javadoc extends Task
         }
         catch( IOException ioex )
         {
-            throw new BuildException( "Error creating temporary file", ioex );
+            throw new TaskException( "Error creating temporary file", ioex );
         }
         finally
         {
@@ -1323,7 +1327,9 @@ public class Javadoc extends Task
         private Vector packages = new Vector( 3 );
         private Html title;
 
-        public GroupArgument() { }
+        public GroupArgument()
+        {
+        }
 
         public void setPackages( String src )
         {
@@ -1380,7 +1386,9 @@ public class Javadoc extends Task
         private String href;
         private File packagelistLoc;
 
-        public LinkArgument() { }
+        public LinkArgument()
+        {
+        }
 
         public void setHref( String hr )
         {
@@ -1428,7 +1436,6 @@ public class Javadoc extends Task
             super( Javadoc.this, level );
         }
 
-
         protected void logFlush()
         {
             if( queuedLine != null )
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogOutputStream.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogOutputStream.java
index f715beaaa..f3684dd40 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogOutputStream.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogOutputStream.java
@@ -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.
@@ -47,7 +47,6 @@ public class LogOutputStream extends OutputStream return level; } - /** * Writes all remaining * @@ -61,7 +60,6 @@ public class LogOutputStream extends OutputStream super.close(); } - /** * Write the data to the buffer and flush the buffer, if a line separator is * detected. @@ -72,7 +70,7 @@ public class LogOutputStream extends OutputStream public void write( int cc ) throws IOException { - final byte c = ( byte )cc; + final byte c = (byte)cc; if( ( c == '\n' ) || ( c == '\r' ) ) { if( !skip ) @@ -83,7 +81,6 @@ public class LogOutputStream extends OutputStream skip = ( c == '\r' ); } - /** * Converts the buffer to a string and sends it to processLine */ diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogStreamHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogStreamHandler.java index abb58ef52..42d371b7c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogStreamHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/LogStreamHandler.java @@ -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 class LogStreamHandler extends PumpStreamHandler 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 @@ public class LogStreamHandler extends PumpStreamHandler catch( IOException e ) { // plain impossible - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Manifest.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Manifest.java index fa0e3f61c..19fc3110b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Manifest.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Manifest.java @@ -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.io.UnsupportedEncodingException; 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task * 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task } 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 @@ public class Manifest extends Task { 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 @@ public class Manifest extends Task { 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 @@ public class Manifest extends Task return false; } - Manifest rhsManifest = ( Manifest )rhs; + Manifest rhsManifest = (Manifest)rhs; if( manifestVersion == null ) { if( rhsManifest.manifestVersion != null ) @@ -281,10 +282,10 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task /** * 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 @@ public class Manifest extends Task } 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 @@ public class Manifest extends Task f.close(); } catch( IOException e ) - {} + { + } } } } @@ -347,7 +349,7 @@ public class Manifest extends Task } catch( ManifestException m ) { - throw new BuildException( "Manifest is invalid", m ); + throw new TaskException( "Manifest is invalid", m ); } PrintWriter w = null; @@ -358,7 +360,8 @@ public class Manifest extends Task } catch( IOException e ) { - throw new BuildException( "Failed to write " + manifestFile e ); + throw new TaskException( "Failed to write " + manifestFile + e ); } finally { @@ -384,11 +387,11 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task } } - 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 @@ public class Manifest extends Task /** * Construct an empty attribute */ - public Attribute() { } + public Attribute() + { + } /** * Construct an attribute by parsing a line from the Manifest @@ -564,7 +569,7 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task } 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 @@ public class Manifest extends Task { 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task String check = addAttributeAndCheck( attribute ); if( check != null ) { - throw new BuildException( "Specify the section name using the \"name\" attribute of the
element rather " + - "than using a \"Name\" manifest attribute" ); + throw new TaskException( "Specify the section name using the \"name\" attribute of the
element rather " + + "than using a \"Name\" manifest attribute" ); } } @@ -784,16 +789,16 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task 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 @@ public class Manifest extends Task } // 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 @@ public class Manifest extends Task 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 ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ManifestException.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ManifestException.java index 813da555e..3ff9f756f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ManifestException.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ManifestException.java @@ -7,8 +7,6 @@ */ package org.apache.tools.ant.taskdefs; - - /** * Exception thrown indicating problems in a JAR Manifest * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/MatchingTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/MatchingTask.java index 375d11526..6ba88ca64 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/MatchingTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/MatchingTask.java @@ -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 @@ public abstract class MatchingTask extends Task * @return The DirectoryScanner value */ protected DirectoryScanner getDirectoryScanner( File baseDir ) + throws TaskException { fileset.setDir( baseDir ); fileset.setDefaultexcludes( useDefaultExcludes ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Mkdir.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Mkdir.java index f186760f1..0d10af461 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Mkdir.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Mkdir.java @@ -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 class Mkdir extends Task } 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 @@ public class Mkdir extends Task { 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() ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Move.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Move.java index 4d021bdf5..c71fa4c89 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Move.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Move.java @@ -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 @@ public class Move extends Copy 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 @@ public class Move extends Copy } 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy { 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy 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 @@ public class Move extends Copy * @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 @@ public class Move extends Copy { 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 ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Pack.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Pack.java index 2bd1d6ee2..8bf3531f2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Pack.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Pack.java @@ -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 abstract class Pack extends Task } public void execute() - throws BuildException + throws TaskException { validate(); log( "Building: " + zipFile.getAbsolutePath() ); @@ -64,30 +65,30 @@ public abstract class Pack extends Task { 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 ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Parallel.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Parallel.java index 942d7f1cd..5f8cf0938 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Parallel.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Parallel.java @@ -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.

* @@ -23,7 +23,7 @@ import org.apache.tools.ant.TaskContainer; * @author Conor MacNeill */ public class Parallel extends Task - implements TaskContainer + implements TaskContainer { /** @@ -31,17 +31,16 @@ public class Parallel extends Task */ private Vector nestedTasks = new Vector(); - /** * Add a nested task to execute parallel (asynchron).

* * * * @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 @@ public class Parallel extends Task * 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 @@ public class Parallel extends Task { try { - threads[i].join(); + threads[ i ].join(); } catch( InterruptedException ie ) { @@ -91,7 +90,7 @@ public class Parallel extends Task ; 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 @@ public class Parallel extends Task { 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 @@ public class Parallel extends Task 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() ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Patch.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Patch.java index f1edcac78..4a6e9709d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Patch.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Patch.java @@ -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 @@ public class Patch extends Task { 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 @@ public class Patch extends Task * patch's -p 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 @@ public class Patch extends Task } 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 @@ public class Patch extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java index e508b580a..d844183c7 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PathConvert.java @@ -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 @@ public class PathConvert extends Task 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 @@ public class PathConvert extends Task /** * 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 @@ public class PathConvert extends Task } 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 @@ public class PathConvert extends Task 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 @@ public class PathConvert extends Task 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 @@ public class PathConvert extends Task * * @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 @@ public class PathConvert extends Task { 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 diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ProcessDestroyer.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ProcessDestroyer.java index 590e86fd1..04d0f1b06 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ProcessDestroyer.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/ProcessDestroyer.java @@ -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 @@ import java.util.Vector; * @author Michael Newcomb */ class ProcessDestroyer - extends Thread + extends Thread { private Vector processes = new Vector(); @@ -83,7 +84,7 @@ class ProcessDestroyer Enumeration e = processes.elements(); while( e.hasMoreElements() ) { - ( ( Process )e.nextElement() ).destroy(); + ( (Process)e.nextElement() ).destroy(); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java index 6ec1b4fa7..31a7e773f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Property.java @@ -16,7 +16,6 @@ import java.util.Properties; 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; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PumpStreamHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PumpStreamHandler.java index ab5109052..b8c13478b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PumpStreamHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/PumpStreamHandler.java @@ -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 @@ public class PumpStreamHandler implements ExecuteStreamHandler 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 @@ public class PumpStreamHandler implements ExecuteStreamHandler 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() @@ -111,7 +114,6 @@ public class PumpStreamHandler implements ExecuteStreamHandler inputThread = createPump( is, os ); } - /** * Creates a stream pumper to copy the given input stream to the given * output stream. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java index ebe3fcc92..7c5cc8875 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Recorder.java @@ -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 @@ public class Recorder extends Task /** * 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 @@ public class Recorder extends Task * @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 @@ public class Recorder extends Task } 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 class Recorder extends Task public static class VerbosityLevelChoices extends EnumeratedAttribute { private final static String[] values = {"error", "warn", "info", - "verbose", "debug"}; + "verbose", "debug"}; public String[] getValues() { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/RecorderEntry.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/RecorderEntry.java index 4dad6229e..6d93689fd 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/RecorderEntry.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/RecorderEntry.java @@ -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 @@ public class RecorderEntry implements BuildLogger 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" ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java index 381d8ef91..3756b06d4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Replace.java @@ -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.Reader; 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 @@ public class Replace extends MatchingTask private int fileCount; private int replaceCount; - /** * Set the source files path when using matching tasks. * @@ -80,7 +80,6 @@ public class Replace extends MatchingTask this.encoding = encoding; } - /** * Set the source file. * @@ -133,7 +132,7 @@ public class Replace extends MatchingTask } public Properties getProperties( File propertyFile ) - throws BuildException + throws TaskException { Properties properties = new Properties(); @@ -144,12 +143,12 @@ public class Replace extends MatchingTask 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 @@ public class Replace extends MatchingTask /** * 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 @@ public class Replace extends MatchingTask 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 @@ public class Replace extends MatchingTask /** * 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 @@ public class Replace extends MatchingTask * 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 @@ public class Replace extends MatchingTask // 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 @@ public class Replace extends MatchingTask { break; } - tmpBuf.append( ( char )readChar ); + tmpBuf.append( (char)readChar ); totread++; } @@ -381,8 +380,8 @@ public class Replace extends MatchingTask } 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 @@ public class Replace extends MatchingTask reader.close(); } catch( IOException e ) - {} + { + } } if( writer != null ) { @@ -402,7 +402,8 @@ public class Replace extends MatchingTask writer.close(); } catch( IOException e ) - {} + { + } } if( temp != null ) { @@ -418,7 +419,7 @@ public class Replace extends MatchingTask 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 @@ public class Replace extends MatchingTask { if( property != null ) { - return ( String )properties.getProperty( property ); + return (String)properties.getProperty( property ); } else if( value != null ) { @@ -546,26 +547,26 @@ public class Replace extends MatchingTask } 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 @@ public class Replace extends MatchingTask 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 @@ public class Replace extends MatchingTask properties.getProperty( property ) == null ) { String message = "property \"" + property + "\" was not found in " + propertyFile.getPath(); - throw new BuildException( message ); + throw new TaskException( message ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java index 947e94329..932bcdbc4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Rmic.java @@ -681,7 +681,7 @@ public class Rmic extends MatchingTask { 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 ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java index 87c397bc2..6f80e8dc9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SQLExec.java @@ -30,6 +30,7 @@ import java.util.Enumeration; 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.EnumeratedAttribute; 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 diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SendEmail.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SendEmail.java index d69728485..cca459009 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SendEmail.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SendEmail.java @@ -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.io.PrintStream; 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 @@ public class SendEmail extends Task 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 @@ public class SendEmail extends Task * @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 @@ public class SendEmail extends Task /** * 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 @@ public class SendEmail extends Task } else { - throw new BuildException( "Attribute \"from\" is required." ); + throw new TaskException( "Attribute \"from\" is required." ); } if( toList != null ) @@ -309,7 +312,7 @@ public class SendEmail extends Task } else { - throw new BuildException( "Attribute \"toList\" is required." ); + throw new TaskException( "Attribute \"toList\" is required." ); } if( subject != null ) @@ -321,15 +324,15 @@ public class SendEmail extends Task { 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 @@ public class SendEmail extends Task 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 @@ public class SendEmail extends Task } 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 @@ public class SendEmail extends Task String err = "IO error sending mail " + ioe.toString(); if( failOnError ) { - throw new BuildException( err, ioe ); + throw new TaskException( err, ioe ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sequential.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sequential.java index 59fa575be..15f042962 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sequential.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sequential.java @@ -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.

* @@ -21,7 +21,7 @@ import org.apache.tools.ant.TaskContainer; * @author Thomas Christen chr@active.ch */ public class Sequential extends Task - implements TaskContainer + implements TaskContainer { /** @@ -46,14 +46,14 @@ public class Sequential extends Task /** * 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(); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SignJar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SignJar.java index 29ffddd1a..b21068d41 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SignJar.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/SignJar.java @@ -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 @@ public class SignJar extends Task 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 @@ public class SignJar extends Task // 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 @@ public class SignJar extends Task 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 @@ public class SignJar extends Task else { return jarFile.getEntry( SIG_START + alias.toUpperCase() + - SIG_END ) != null; + SIG_END ) != null; } } catch( IOException e ) @@ -209,7 +209,8 @@ public class SignJar extends Task jarFile.close(); } catch( IOException e ) - {} + { + } } } } @@ -245,21 +246,21 @@ public class SignJar extends Task } 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 @@ public class SignJar extends Task 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 ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sleep.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sleep.java index 6c1b9b734..2238b2c53 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sleep.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Sleep.java @@ -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 @@ public class Sleep extends Task */ private int milliseconds = 0; - /** * Creates new instance */ - public Sleep() { } - + public Sleep() + { + } /** * Sets the FailOnError attribute of the MimeMail object @@ -58,7 +59,6 @@ public class Sleep extends Task this.failOnError = failOnError; } - /** * Sets the Hours attribute of the Sleep object * @@ -69,7 +69,6 @@ public class Sleep extends Task this.hours = hours; } - /** * Sets the Milliseconds attribute of the Sleep object * @@ -80,7 +79,6 @@ public class Sleep extends Task this.milliseconds = milliseconds; } - /** * Sets the Minutes attribute of the Sleep object * @@ -91,7 +89,6 @@ public class Sleep extends Task this.minutes = minutes; } - /** * Sets the Seconds attribute of the Sleep object * @@ -102,7 +99,6 @@ public class Sleep extends Task this.seconds = seconds; } - /** * sleep for a period of time * @@ -119,29 +115,28 @@ public class Sleep extends Task } } - /** - * 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 @@ public class Sleep extends Task } } - /** * 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 @@ public class Sleep extends Task private long getSleepTime() { - return ( ( ( ( long )hours * 60 ) + minutes ) * 60 + seconds ) * 1000 + milliseconds; + return ( ( ( (long)hours * 60 ) + minutes ) * 60 + seconds ) * 1000 + milliseconds; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/StreamPumper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/StreamPumper.java index 8e8a8e9ef..1af5ffe86 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/StreamPumper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/StreamPumper.java @@ -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 @@ public class StreamPumper implements Runnable private InputStream is; private OutputStream os; - /** * Create a new stream pumper. * @@ -39,14 +39,13 @@ public class StreamPumper implements Runnable 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 @@ public class StreamPumper implements Runnable Thread.sleep( SLEEP ); } catch( InterruptedException e ) - {} + { + } } } catch( IOException e ) - {} + { + } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tar.java index cbcae1f7d..f50c8fb7e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tar.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tar.java @@ -13,7 +13,7 @@ import java.io.FileOutputStream; 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 class Tar extends MatchingTask } 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 @@ public class Tar extends MatchingTask 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 @@ public class Tar extends MatchingTask { 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 @@ public class Tar extends MatchingTask 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 @@ public class Tar extends MatchingTask } else if( longFileMode.isFailMode() ) { - throw new BuildException( + throw new TaskException( "Entry: " + vPath + " longer than " + TarConstants.NAMELEN + "characters." ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java index d53db1655..6339d5980 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Touch.java @@ -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.DateFormat; 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 @@ public class Touch extends Task /** * 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 @@ public class Touch extends Task /** * 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 @@ public class Touch extends Task 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 @@ public class Touch extends Task 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 @@ public class Touch extends Task // 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 @@ public class Touch extends Task 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 @@ public class Touch extends Task } 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 ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tstamp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tstamp.java index 5c97426a0..655b4919e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tstamp.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Tstamp.java @@ -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.NoSuchElementException; 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 class Tstamp extends Task } public void execute() - throws BuildException + throws TaskException { try { @@ -72,14 +73,14 @@ public class Tstamp extends Task 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 @@ public class Tstamp extends Task 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 class Tstamp extends Task 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 @@ public class Tstamp extends Task country = st.nextToken(); if( st.hasMoreElements() ) { - throw new BuildException( "bad locale format" ); + throw new TaskException( "bad locale format" ); } } } @@ -176,7 +177,7 @@ public class Tstamp extends Task } catch( NoSuchElementException e ) { - throw new BuildException( "bad locale format", e ); + throw new TaskException( "bad locale format", e ); } } @@ -209,12 +210,12 @@ public class Tstamp extends Task { 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; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Unpack.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Unpack.java index 98bbf8f86..cc449a245 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Unpack.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Unpack.java @@ -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 @@ public abstract class Unpack extends Task 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 @@ public abstract class Unpack extends Task 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 @@ public abstract class Unpack extends Task } 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 ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Untar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Untar.java index ea7539ffe..0f98af71b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Untar.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Untar.java @@ -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 @@ public class Untar extends Expand 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 @@ public class Untar extends Expand tis.close(); } catch( IOException e ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java index 43ae44064..6dc8399a2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/UpToDate.java @@ -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 @@ public class UpToDate extends MatchingTask implements Condition * 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 @@ public class UpToDate extends MatchingTask implements Condition { if( sourceFileSets.size() == 0 ) { - throw new BuildException( "At least one element must be set" ); + throw new TaskException( "At least one 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 @@ public class UpToDate extends MatchingTask implements Condition 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 @@ public class UpToDate extends MatchingTask implements Condition 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 ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/WaitFor.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/WaitFor.java index 9f87abb1d..a96faa7ef 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/WaitFor.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/WaitFor.java @@ -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 @@ public class WaitFor extends ConditionBase * 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 " ); + throw new TaskException( "You must not nest more than one condition into " ); } if( countConditions() < 1 ) { - throw new BuildException( "You must nest a condition into " ); + throw new TaskException( "You must nest a condition into " ); } - Condition c = ( Condition )getConditions().nextElement(); + Condition c = (Condition)getConditions().nextElement(); maxWaitMillis *= maxWaitMultiplier; checkEveryMillis *= checkEveryMultiplier; @@ -149,7 +150,7 @@ public class WaitFor extends ConditionBase private final static String[] units = { MILLISECOND, SECOND, MINUTE, HOUR, DAY, WEEK - }; + }; private Hashtable timeTable = new Hashtable(); @@ -166,7 +167,7 @@ public class WaitFor extends ConditionBase public long getMultiplier() { String key = getValue().toLowerCase(); - Long l = ( Long )timeTable.get( key ); + Long l = (Long)timeTable.get( key ); return l.longValue(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/War.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/War.java index 33dc1e83b..8e1649fa0 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/War.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/War.java @@ -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 @@ public class War extends Jar { 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 @@ public class War extends Jar } 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 @@ public class War extends Jar 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 { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/XSLTLiaison.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/XSLTLiaison.java index a4d01bd8e..4a64f3f54 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/XSLTLiaison.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/XSLTLiaison.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs; + import java.io.File; /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/XSLTProcess.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/XSLTProcess.java index 37d5d6c41..18332d0ef 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -10,8 +10,8 @@ package org.apache.tools.ant.taskdefs; 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger /** * 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger if( xslFile == null ) { - throw new BuildException( "no stylesheet specified" ); + throw new TaskException( "no stylesheet specified" ); } if( baseDir == null ) @@ -256,7 +256,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } else @@ -324,7 +324,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger e4.printStackTrace(); e3.printStackTrace(); e2.printStackTrace(); - throw new BuildException( "Error", e1 ); + throw new TaskException( "Error", e1 ); } } } @@ -338,10 +338,10 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger * 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger * @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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger 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 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger 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 class XSLTProcess extends MatchingTask implements XSLTLogger } 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; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java index 6317eb017..5bd0059de 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/Zip.java @@ -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.Stack; 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask 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 class Zip extends MatchingTask } 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 @@ public class Zip extends MatchingTask { 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 @@ public class Zip extends MatchingTask } 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 @@ public class Zip extends MatchingTask { 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 @@ public class Zip extends MatchingTask } } - throw new BuildException( msg, ioe ); + throw new TaskException( msg, ioe ); } finally { @@ -384,7 +385,7 @@ public class Zip extends MatchingTask if( !renamedFile.delete() ) { log( "Warning: unable to delete temporary file " + - renamedFile.getName(), Project.MSG_WARN ); + renamedFile.getName(), Project.MSG_WARN ); } } } @@ -400,7 +401,6 @@ public class Zip extends MatchingTask return addingNewFiles; } - /** * Check whether the archive is up-to-date; and handle behavior for empty * archives. @@ -409,10 +409,10 @@ public class Zip extends MatchingTask * @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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask { 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask // 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask // 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 @@ public class Zip extends MatchingTask } 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask while( !directories.isEmpty() ) { - String dir = ( String )directories.pop(); + String dir = (String)directories.pop(); File f = null; if( baseDir != null ) { @@ -633,9 +633,9 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask } 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 @@ public class Zip extends MatchingTask // 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 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask zOut.putNextEntry( ze ); - byte[] buffer = new byte[8 * 1024]; + byte[] buffer = new byte[ 8 * 1024 ]; int count = 0; do { @@ -837,7 +841,7 @@ public class Zip extends MatchingTask 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 @@ public class Zip extends MatchingTask { 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 ); @@ -860,7 +864,6 @@ public class Zip extends MatchingTask } } - /** * Possible behaviors when there are no matching files for the task. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java index f82338b01..a7a52a947 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapter.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.taskdefs.Javac; /** @@ -36,8 +37,8 @@ public interface CompilerAdapter * Executes the task. * * @return has the compilation been successful - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean execute() - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java index 5e0e91536..b030ff97d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; @@ -21,7 +22,9 @@ public class CompilerAdapterFactory /** * This is a singlton -- can't create instances!! */ - private CompilerAdapterFactory() { } + private CompilerAdapterFactory() + { + } /** * Based on the parameter passed in, this method creates the necessary @@ -45,11 +48,11 @@ public class CompilerAdapterFactory * classname of the compiler's adapter. * @param task a task to log through. * @return The Compiler value - * @throws BuildException if the compiler type could not be resolved into a + * @throws TaskException if the compiler type could not be resolved into a * compiler adapter. */ public static CompilerAdapter getCompiler( String compilerType, Task task ) - throws BuildException + throws TaskException { /* * If I've done things right, this should be the extent of the @@ -81,7 +84,7 @@ public class CompilerAdapterFactory catch( ClassNotFoundException cnfe ) { task.log( "Modern compiler is not available - using " - + "classic compiler", Project.MSG_WARN ); + + "classic compiler", Project.MSG_WARN ); return new Javac12(); } return new Javac13(); @@ -113,32 +116,32 @@ public class CompilerAdapterFactory * * @param className The fully qualified classname to be created. * @return Description of the Returned Value - * @throws BuildException This is the fit that is thrown if className isn't + * @throws TaskException This is the fit that is thrown if className isn't * an instance of CompilerAdapter. */ private static CompilerAdapter resolveClassName( String className ) - throws BuildException + throws TaskException { try { Class c = Class.forName( className ); Object o = c.newInstance(); - return ( CompilerAdapter )o; + return (CompilerAdapter)o; } catch( ClassNotFoundException cnfe ) { - throw new BuildException( className + " can\'t be found.", cnfe ); + throw new TaskException( className + " can\'t be found.", cnfe ); } catch( ClassCastException cce ) { - throw new BuildException( className + " isn\'t the classname of " - + "a compiler adapter.", cce ); + throw new TaskException( className + " isn\'t the classname of " + + "a compiler adapter.", cce ); } catch( Throwable t ) { // for all other possibilities - throw new BuildException( className + " caused an interesting " - + "exception.", t ); + throw new TaskException( className + " caused an interesting " + + "exception.", t ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 8396985a1..d8263ddf5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -6,18 +6,18 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; -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.taskdefs.Execute; import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; -import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.FileUtils; @@ -140,7 +140,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter if( !attributes.isForkedJavac() ) { attributes.log( "Since fork is false, ignoring memoryInitialSize setting.", - Project.MSG_WARN ); + Project.MSG_WARN ); } else { @@ -153,7 +153,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter if( !attributes.isForkedJavac() ) { attributes.log( "Since fork is false, ignoring memoryMaximumSize setting.", - Project.MSG_WARN ); + Project.MSG_WARN ); } else { @@ -229,8 +229,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter if( debug ) { if( useDebugLevel - && Project.getJavaVersion() != Project.JAVA_1_0 - && Project.getJavaVersion() != Project.JAVA_1_1 ) + && Project.getJavaVersion() != Project.JAVA_1_0 + && Project.getJavaVersion() != Project.JAVA_1_1 ) { String debugLevel = attributes.getDebugLevel(); @@ -271,7 +271,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter else { attributes.log( "depend attribute is not supported by the modern compiler", - Project.MSG_WARN ); + Project.MSG_WARN ); } } @@ -405,16 +405,16 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter out = new PrintWriter( new FileWriter( tmpFile ) ); for( int i = firstFileName; i < args.length; i++ ) { - out.println( args[i] ); + out.println( args[ i ] ); } out.flush(); - commandArray = new String[firstFileName + 1]; + commandArray = new String[ firstFileName + 1 ]; System.arraycopy( args, 0, commandArray, 0, firstFileName ); - commandArray[firstFileName] = "@" + tmpFile.getAbsolutePath(); + commandArray[ firstFileName ] = "@" + tmpFile.getAbsolutePath(); } catch( IOException e ) { - throw new BuildException( "Error creating temporary file", e ); + throw new TaskException( "Error creating temporary file", e ); } finally { @@ -425,7 +425,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter out.close(); } catch( Throwable t ) - {} + { + } } } } @@ -437,8 +438,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter try { Execute exe = new Execute( new LogStreamHandler( attributes, - Project.MSG_INFO, - Project.MSG_WARN ) ); + Project.MSG_INFO, + Project.MSG_WARN ) ); exe.setAntRun( project ); exe.setWorkingDirectory( project.getBaseDir() ); exe.setCommandline( commandArray ); @@ -447,8 +448,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter } catch( IOException e ) { - throw new BuildException( "Error running " + args[0] - + " compiler", e ); + throw new TaskException( "Error running " + args[ 0 ] + + " compiler", e ); } } finally @@ -469,7 +470,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter protected void logAndAddFilesToCompile( Commandline cmd ) { attributes.log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); StringBuffer niceSourceList = new StringBuffer( "File" ); if( compileList.length != 1 ) @@ -482,7 +483,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter for( int i = 0; i < compileList.length; i++ ) { - String arg = compileList[i].getAbsolutePath(); + String arg = compileList[ i ].getAbsolutePath(); cmd.createArgument().setValue( arg ); niceSourceList.append( " " + arg + lSep ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Gcj.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Gcj.java index ee0918e10..015b4dc9a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Gcj.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Gcj.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -24,11 +25,11 @@ public class Gcj extends DefaultCompilerAdapter * Performs a compile using the gcj compiler. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @author tora@debian.org */ public boolean execute() - throws BuildException + throws TaskException { Commandline cmd; attributes.log( "Using gcj compiler", Project.MSG_VERBOSE ); @@ -76,7 +77,7 @@ public class Gcj extends DefaultCompilerAdapter if( destDir.mkdirs() ) { - throw new BuildException( "Can't make output directories. Maybe permission is wrong. " ); + throw new TaskException( "Can't make output directories. Maybe permission is wrong. " ); } ; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac12.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac12.java index c5927bacd..11a91a862 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac12.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac12.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; + import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.Commandline; @@ -29,7 +30,7 @@ public class Javac12 extends DefaultCompilerAdapter { public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using classic compiler", Project.MSG_VERBOSE ); Commandline cmd = setupJavacCommand( true ); @@ -45,24 +46,24 @@ public class Javac12 extends DefaultCompilerAdapter // Call the compile() method Method compile = c.getMethod( "compile", new Class[]{String[].class} ); - Boolean ok = ( Boolean )compile.invoke( compiler, new Object[]{cmd.getArguments()} ); + Boolean ok = (Boolean)compile.invoke( compiler, new Object[]{cmd.getArguments()} ); return ok.booleanValue(); } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use classic compiler, as it is not available" + - " A common solution is to set the environment variable" + - " JAVA_HOME to your jdk directory." ); + throw new TaskException( "Cannot use classic compiler, as it is not available" + + " A common solution is to set the environment variable" + + " JAVA_HOME to your jdk directory." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting classic compiler: ", ex ); + throw new TaskException( "Error starting classic compiler: ", ex ); } } finally @@ -74,7 +75,7 @@ public class Javac12 extends DefaultCompilerAdapter catch( IOException e ) { // plain impossible - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac13.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac13.java index c0f5f4bc7..ab153015b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac13.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Javac13.java @@ -6,12 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; + import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - /** * The implementation of the javac compiler for JDK 1.3 This is primarily a * cut-and-paste from the original javac task before it was refactored. @@ -31,7 +31,7 @@ public class Javac13 extends DefaultCompilerAdapter private final static int MODERN_COMPILER_SUCCESS = 0; public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using modern compiler", Project.MSG_VERBOSE ); Commandline cmd = setupModernJavacCommand(); @@ -42,20 +42,20 @@ public class Javac13 extends DefaultCompilerAdapter Class c = Class.forName( "com.sun.tools.javac.Main" ); Object compiler = c.newInstance(); Method compile = c.getMethod( "compile", - new Class[]{( new String[]{} ).getClass()} ); - int result = ( ( Integer )compile.invoke + new Class[]{( new String[]{} ).getClass()} ); + int result = ( (Integer)compile.invoke ( compiler, new Object[]{cmd.getArguments()} ) ).intValue(); return ( result == MODERN_COMPILER_SUCCESS ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting modern compiler", ex ); + throw new TaskException( "Error starting modern compiler", ex ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java index 528b7cd43..365a8bf02 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; @@ -22,10 +23,10 @@ public class JavacExternal extends DefaultCompilerAdapter * Performs a compile using the Javac externally. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using external javac compiler", Project.MSG_VERBOSE ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jikes.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jikes.java index e6e869e60..d35e19944 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jikes.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jikes.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -32,11 +33,11 @@ public class Jikes extends DefaultCompilerAdapter * been successfully tested with jikes >1.10 * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @author skanthak@muehlheim.de */ public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using jikes compiler", Project.MSG_VERBOSE ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jvc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jvc.java index ccb0b0f2a..69ede663d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jvc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Jvc.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -25,7 +26,7 @@ public class Jvc extends DefaultCompilerAdapter { public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using jvc compiler", Project.MSG_VERBOSE ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Kjc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Kjc.java index 4aa6a8c5d..d0d3ca27f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Kjc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Kjc.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; + import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -22,7 +23,7 @@ public class Kjc extends DefaultCompilerAdapter { public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using kjc compiler", Project.MSG_VERBOSE ); Commandline cmd = setupKjcCommand(); @@ -33,26 +34,26 @@ public class Kjc extends DefaultCompilerAdapter // Call the compile() method Method compile = c.getMethod( "compile", - new Class[]{String[].class} ); - Boolean ok = ( Boolean )compile.invoke( null, - new Object[]{cmd.getArguments()} ); + new Class[]{String[].class} ); + Boolean ok = (Boolean)compile.invoke( null, + new Object[]{cmd.getArguments()} ); return ok.booleanValue(); } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use kjc compiler, as it is not available" + - " A common solution is to set the environment variable" + - " CLASSPATH to your kjc archive (kjc.jar)." ); + throw new TaskException( "Cannot use kjc compiler, as it is not available" + + " A common solution is to set the environment variable" + + " CLASSPATH to your kjc archive (kjc.jar)." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting kjc compiler: ", ex ); + throw new TaskException( "Error starting kjc compiler: ", ex ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Sj.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Sj.java index 3ab63f48b..590af2f2f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Sj.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/compilers/Sj.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; @@ -23,11 +24,11 @@ public class Sj extends DefaultCompilerAdapter * Performs a compile using the sj compiler from Symantec. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @author don@bea.com */ public boolean execute() - throws BuildException + throws TaskException { attributes.log( "Using symantec java compiler", Project.MSG_VERBOSE ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/And.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/And.java index 44b9810ac..7c99b98fa 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/And.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/And.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; + import java.util.Enumeration; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * <and> condition container.

@@ -22,12 +23,12 @@ public class And extends ConditionBase implements Condition { public boolean eval() - throws BuildException + throws TaskException { Enumeration enum = getConditions(); while( enum.hasMoreElements() ) { - Condition c = ( Condition )enum.nextElement(); + Condition c = (Condition)enum.nextElement(); if( !c.eval() ) { return false; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Condition.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Condition.java index fc589867c..b1cab7b2a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Condition.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Condition.java @@ -21,7 +21,7 @@ public interface Condition * Is this condition true? * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean eval() throws TaskException; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/ConditionBase.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/ConditionBase.java index a8a13820d..ceeb8af59 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/ConditionBase.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/ConditionBase.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; + import java.util.Enumeration; import java.util.NoSuchElementException; import java.util.Vector; +import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.ProjectComponent; import org.apache.tools.ant.taskdefs.Available; import org.apache.tools.ant.taskdefs.Checksum; import org.apache.tools.ant.taskdefs.UpToDate; -import org.apache.myrmidon.framework.Os; /** * Baseclass for the <condition> task as well as several conditions - @@ -201,7 +202,7 @@ public abstract class ConditionBase extends ProjectComponent if( o instanceof ProjectComponent ) { - ( ( ProjectComponent )o ).setProject( getProject() ); + ( (ProjectComponent)o ).setProject( getProject() ); } return o; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Equals.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Equals.java index 306f7928f..732e1c187 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Equals.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Equals.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Simple String comparison condition. @@ -30,11 +31,11 @@ public class Equals implements Condition } public boolean eval() - throws BuildException + throws TaskException { if( arg1 == null || arg2 == null ) { - throw new BuildException( "both arg1 and arg2 are required in equals" ); + throw new TaskException( "both arg1 and arg2 are required in equals" ); } return arg1.equals( arg2 ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java index b70aa228a..de3eaabd4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Http.java @@ -6,12 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; -import java.io.IOException; + import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; @@ -31,11 +31,11 @@ public class Http extends ProjectComponent implements Condition } public boolean eval() - throws BuildException + throws TaskException { if( spec == null ) { - throw new BuildException( "No url specified in HTTP task" ); + throw new TaskException( "No url specified in HTTP task" ); } log( "Checking for " + spec, Project.MSG_VERBOSE ); try @@ -46,7 +46,7 @@ public class Http extends ProjectComponent implements Condition URLConnection conn = url.openConnection(); if( conn instanceof HttpURLConnection ) { - HttpURLConnection http = ( HttpURLConnection )conn; + HttpURLConnection http = (HttpURLConnection)conn; int code = http.getResponseCode(); log( "Result code for " + spec + " was " + code, Project.MSG_VERBOSE ); if( code > 0 && code < 500 ) @@ -66,7 +66,7 @@ public class Http extends ProjectComponent implements Condition } catch( MalformedURLException e ) { - throw new BuildException( "Badly formed URL: " + spec, e ); + throw new TaskException( "Badly formed URL: " + spec, e ); } return true; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/IsSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/IsSet.java index e7a6a11be..a5a7f3ffe 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/IsSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/IsSet.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.ProjectComponent; /** @@ -25,11 +26,11 @@ public class IsSet extends ProjectComponent implements Condition } public boolean eval() - throws BuildException + throws TaskException { if( property == null ) { - throw new BuildException( "No property specified for isset condition" ); + throw new TaskException( "No property specified for isset condition" ); } return getProject().getProperty( property ) != null; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Not.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Not.java index 1af3b0bdb..b03c452a6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Not.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Not.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * <not> condition. Evaluates to true if the single condition nested into @@ -19,17 +20,17 @@ public class Not extends ConditionBase implements Condition { public boolean eval() - throws BuildException + throws TaskException { if( countConditions() > 1 ) { - throw new BuildException( "You must not nest more than one condition into " ); + throw new TaskException( "You must not nest more than one condition into " ); } if( countConditions() < 1 ) { - throw new BuildException( "You must nest a condition into " ); + throw new TaskException( "You must nest a condition into " ); } - return !( ( Condition )getConditions().nextElement() ).eval(); + return !( (Condition)getConditions().nextElement() ).eval(); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Or.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Or.java index 62ca4641c..1a9521ce5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Or.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Or.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; + import java.util.Enumeration; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * <or> condition container.

@@ -22,12 +23,12 @@ public class Or extends ConditionBase implements Condition { public boolean eval() - throws BuildException + throws TaskException { Enumeration enum = getConditions(); while( enum.hasMoreElements() ) { - Condition c = ( Condition )enum.nextElement(); + Condition c = (Condition)enum.nextElement(); if( c.eval() ) { return true; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java index b1e47526a..3ecef0857 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/condition/Socket.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.condition; + 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.ProjectComponent; @@ -33,15 +34,15 @@ public class Socket extends ProjectComponent implements Condition } public boolean eval() - throws BuildException + throws TaskException { if( server == null ) { - throw new BuildException( "No server specified in Socket task" ); + throw new TaskException( "No server specified in Socket task" ); } if( port == 0 ) { - throw new BuildException( "No port specified in Socket task" ); + throw new TaskException( "No port specified in Socket task" ); } log( "Checking for listener at " + server + ":" + port, Project.MSG_VERBOSE ); try diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java index 2508be19e..12eb748d2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ANTLR.java @@ -12,7 +12,7 @@ import java.io.File; import java.io.FileReader; import java.io.IOException; import java.net.URL; -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.taskdefs.Execute; @@ -110,7 +110,7 @@ public class ANTLR extends Task } public void execute() - throws BuildException + throws TaskException { validateAttributes(); @@ -127,7 +127,7 @@ public class ANTLR extends Task int err = run( commandline.getCommandline() ); if( err == 1 ) { - throw new BuildException( "ANTLR returned: " + err ); + throw new TaskException( "ANTLR returned: " + err ); } } else @@ -144,10 +144,10 @@ public class ANTLR extends Task * Adds the jars or directories containing Antlr this should make the forked * JVM work without having to specify it directly. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void init() - throws BuildException + throws TaskException { addClasspathEntry( "/antlr/Tool.class" ); } @@ -196,7 +196,7 @@ public class ANTLR extends Task } private File getGeneratedFile() - throws BuildException + throws TaskException { String generatedFileName = null; try @@ -216,11 +216,11 @@ public class ANTLR extends Task } catch( Exception e ) { - throw new BuildException( "Unable to determine generated class", e ); + throw new TaskException( "Unable to determine generated class", e ); } if( generatedFileName == null ) { - throw new BuildException( "Unable to determine generated class" ); + throw new TaskException( "Unable to determine generated class" ); } return new File( outputDirectory, generatedFileName + ".java" ); } @@ -230,10 +230,10 @@ public class ANTLR extends Task * * @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 { Execute exe = new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ), null ); @@ -249,16 +249,16 @@ public class ANTLR extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } private void validateAttributes() - throws BuildException + throws TaskException { if( target == null || !target.isFile() ) { - throw new BuildException( "Invalid target: " + target ); + throw new TaskException( "Invalid target: " + target ); } // if no output directory is specified, used the target's directory @@ -269,7 +269,7 @@ public class ANTLR extends Task } if( !outputDirectory.isDirectory() ) { - throw new BuildException( "Invalid output directory: " + outputDirectory ); + throw new TaskException( "Invalid output directory: " + outputDirectory ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java index 65510cf56..34364ae10 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Cab.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -13,17 +14,16 @@ import java.io.OutputStream; import java.io.PrintWriter; 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.tools.ant.taskdefs.ExecTask; import org.apache.tools.ant.taskdefs.MatchingTask; -import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.util.FileUtils; - /** * Create a CAB archive. * @@ -106,7 +106,7 @@ public class Cab extends MatchingTask } public void execute() - throws BuildException + throws TaskException { checkConfiguration(); @@ -144,7 +144,7 @@ public class Cab extends MatchingTask catch( IOException ex ) { String msg = "Problem creating " + cabFile + " " + ex.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } else @@ -178,7 +178,7 @@ public class Cab extends MatchingTask catch( IOException ioe ) { String msg = "Problem creating " + cabFile + " " + ioe.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } } @@ -189,10 +189,10 @@ public class Cab extends MatchingTask * traditional include parameters. * * @return The FileList value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected Vector getFileList() - throws BuildException + throws TaskException { Vector files = new Vector(); @@ -206,7 +206,7 @@ public class Cab extends MatchingTask // get files from filesets for( int i = 0; i < filesets.size(); i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); if( fs != null ) { appendFiles( files, fs.getDirectoryScanner( project ) ); @@ -248,7 +248,7 @@ public class Cab extends MatchingTask for( int i = 0; i < dsfiles.length; i++ ) { - files.addElement( dsfiles[i] ); + files.addElement( dsfiles[ i ] ); } } @@ -258,19 +258,19 @@ public class Cab extends MatchingTask * for side-effects to me... */ protected void checkConfiguration() - throws BuildException + throws TaskException { if( baseDir == null ) { - throw new BuildException( "basedir attribute must be set!" ); + throw new TaskException( "basedir attribute must be set!" ); } if( !baseDir.exists() ) { - throw new BuildException( "basedir does not exist!" ); + throw new TaskException( "basedir does not exist!" ); } if( cabFile == null ) { - throw new BuildException( "cabfile attribute must be set!" ); + throw new TaskException( "cabfile attribute must be set!" ); } } @@ -281,6 +281,7 @@ public class Cab extends MatchingTask * @return Description of the Returned Value */ protected Commandline createCommand( File listFile ) + throws TaskException { Commandline command = new Commandline(); command.setExecutable( "cabarc" ); @@ -310,12 +311,12 @@ public class Cab extends MatchingTask * appears in the logs to be the same task as this one. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected ExecTask createExec() - throws BuildException + throws TaskException { - ExecTask exec = ( ExecTask )project.createTask( "exec" ); + ExecTask exec = (ExecTask)project.createTask( "exec" ); exec.setOwningTarget( this.getOwningTarget() ); exec.setTaskName( this.getTaskName() ); exec.setDescription( this.getDescription() ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java index 8f60da24c..7d6980d65 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/IContract.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -13,8 +14,8 @@ import java.io.IOException; import java.io.PrintStream; import java.util.Date; import java.util.Properties; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; @@ -682,10 +683,10 @@ public class IContract extends MatchingTask /** * Executes the task * - * @exception BuildException if the instrumentation fails + * @exception TaskException if the instrumentation fails */ public void execute() - throws BuildException + throws TaskException { preconditions(); scan(); @@ -720,7 +721,7 @@ public class IContract extends MatchingTask // Prepare the directories for iContract. iContract will make them if they // don't exist, but for some reason I don't know, it will complain about the REP files // afterwards - Mkdir mkdir = ( Mkdir )project.createTask( "mkdir" ); + Mkdir mkdir = (Mkdir)project.createTask( "mkdir" ); mkdir.setDir( instrumentDir ); mkdir.execute(); mkdir.setDir( buildDir ); @@ -737,25 +738,25 @@ public class IContract extends MatchingTask classpathHelper.modify( baseClasspath ); // Create the classpath required to compile the sourcefiles BEFORE instrumentation - Path beforeInstrumentationClasspath = ( ( Path )baseClasspath.clone() ); + Path beforeInstrumentationClasspath = ( (Path)baseClasspath.clone() ); beforeInstrumentationClasspath.append( new Path( getProject(), srcDir.getAbsolutePath() ) ); // Create the classpath required to compile the sourcefiles AFTER instrumentation - Path afterInstrumentationClasspath = ( ( Path )baseClasspath.clone() ); + Path afterInstrumentationClasspath = ( (Path)baseClasspath.clone() ); afterInstrumentationClasspath.append( new Path( getProject(), instrumentDir.getAbsolutePath() ) ); afterInstrumentationClasspath.append( new Path( getProject(), repositoryDir.getAbsolutePath() ) ); afterInstrumentationClasspath.append( new Path( getProject(), srcDir.getAbsolutePath() ) ); afterInstrumentationClasspath.append( new Path( getProject(), buildDir.getAbsolutePath() ) ); // Create the classpath required to automatically compile the repository files - Path repositoryClasspath = ( ( Path )baseClasspath.clone() ); + Path repositoryClasspath = ( (Path)baseClasspath.clone() ); repositoryClasspath.append( new Path( getProject(), instrumentDir.getAbsolutePath() ) ); repositoryClasspath.append( new Path( getProject(), srcDir.getAbsolutePath() ) ); repositoryClasspath.append( new Path( getProject(), repositoryDir.getAbsolutePath() ) ); repositoryClasspath.append( new Path( getProject(), buildDir.getAbsolutePath() ) ); // Create the classpath required for iContract itself - Path iContractClasspath = ( ( Path )baseClasspath.clone() ); + Path iContractClasspath = ( (Path)baseClasspath.clone() ); iContractClasspath.append( new Path( getProject(), System.getProperty( "java.home" ) + File.separator + ".." + File.separator + "lib" + File.separator + "tools.jar" ) ); iContractClasspath.append( new Path( getProject(), srcDir.getAbsolutePath() ) ); iContractClasspath.append( new Path( getProject(), repositoryDir.getAbsolutePath() ) ); @@ -763,7 +764,7 @@ public class IContract extends MatchingTask iContractClasspath.append( new Path( getProject(), buildDir.getAbsolutePath() ) ); // Create a forked java process - Java iContract = ( Java )project.createTask( "java" ); + Java iContract = (Java)project.createTask( "java" ); iContract.setTaskName( getTaskName() ); iContract.setFork( true ); iContract.setClassname( "com.reliablesystems.iContract.Tool" ); @@ -784,7 +785,7 @@ public class IContract extends MatchingTask args.append( "@" ).append( targets.getAbsolutePath() ); iContract.createArg().setLine( args.toString() ); -//System.out.println( "JAVA -classpath " + iContractClasspath + " com.reliablesystems.iContract.Tool " + args.toString() ); + //System.out.println( "JAVA -classpath " + iContractClasspath + " com.reliablesystems.iContract.Tool " + args.toString() ); // update iControlProperties if it's set. if( updateIcontrol ) @@ -825,7 +826,7 @@ public class IContract extends MatchingTask log( classpath.toString() ); log( "If you don't have the iContract jar, go get it at http://www.reliable-systems.com/tools/" ); } - throw new BuildException( "iContract instrumentation failed. Code=" + result ); + throw new TaskException( "iContract instrumentation failed. Code=" + result ); } } @@ -835,7 +836,6 @@ public class IContract extends MatchingTask } } - /** * Creates the -m option based on the values of controlFile, pre, post and * invariant. @@ -890,34 +890,34 @@ public class IContract extends MatchingTask /** * Checks that the required attributes are set. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void preconditions() - throws BuildException + throws TaskException { 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 \"" + srcDir.getPath() + "\" does not exist!"); + throw new TaskException( "srcdir \"" + srcDir.getPath() + "\" does not exist!" ); } if( instrumentDir == null ) { - throw new BuildException( "instrumentdir attribute must be set!"); + throw new TaskException( "instrumentdir attribute must be set!" ); } if( repositoryDir == null ) { - throw new BuildException( "repositorydir attribute must be set!" ); + throw new TaskException( "repositorydir attribute must be set!" ); } if( updateIcontrol == true && classDir == null ) { - throw new BuildException( "classdir attribute must be specified when updateicontrol=true!" ); + throw new TaskException( "classdir attribute must be specified when updateicontrol=true!" ); } if( updateIcontrol == true && controlFile == null ) { - throw new BuildException( "controlfile attribute must be specified when updateicontrol=true!" ); + throw new TaskException( "controlfile attribute must be specified when updateicontrol=true!" ); } } @@ -929,10 +929,10 @@ public class IContract extends MatchingTask * Also creates a temporary file with a list of the source files, that will * be deleted upon exit. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void scan() - throws BuildException + throws TaskException { long now = ( new Date() ).getTime(); @@ -965,20 +965,20 @@ public class IContract extends MatchingTask } for( int i = 0; i < files.length; i++ ) { - File srcFile = new File( srcDir, files[i] ); - if( files[i].endsWith( ".java" ) ) + File srcFile = new File( srcDir, files[ i ] ); + if( files[ i ].endsWith( ".java" ) ) { // print the target, while we're at here. (Only if generatetarget=true). if( targetPrinter != null ) { targetPrinter.println( srcFile.getAbsolutePath() ); } - File classFile = new File( buildDir, files[i].substring( 0, files[i].indexOf( ".java" ) ) + ".class" ); + File classFile = new File( buildDir, files[ i ].substring( 0, files[ i ].indexOf( ".java" ) ) + ".class" ); if( srcFile.lastModified() > now ) { log( "Warning: file modified in the future: " + - files[i], Project.MSG_WARN ); + files[ i ], Project.MSG_WARN ); } if( !classFile.exists() || srcFile.lastModified() > classFile.lastModified() ) @@ -996,7 +996,7 @@ public class IContract extends MatchingTask } catch( IOException e ) { - throw new BuildException( "Could not create target file:" + e.getMessage() ); + throw new TaskException( "Could not create target file:" + e.getMessage() ); } // also, check controlFile timestamp @@ -1012,8 +1012,8 @@ public class IContract extends MatchingTask files = ds.getIncludedFiles(); for( int i = 0; i < files.length; i++ ) { - File srcFile = new File( srcDir, files[i] ); - if( files[i].endsWith( ".class" ) ) + File srcFile = new File( srcDir, files[ i ] ); + if( files[ i ].endsWith( ".class" ) ) { if( controlFileTime > srcFile.lastModified() ) { @@ -1031,7 +1031,7 @@ public class IContract extends MatchingTask } catch( Throwable t ) { - throw new BuildException( "Got an interesting exception:" + t.getMessage() ); + throw new TaskException( "Got an interesting exception:" + t.getMessage() ); } } @@ -1053,7 +1053,9 @@ public class IContract extends MatchingTask } // dummy implementation. Never called - public void setJavac( Javac javac ) { } + public void setJavac( Javac javac ) + { + } public boolean execute() { @@ -1082,9 +1084,13 @@ public class IContract extends MatchingTask */ private class IContractPresenceDetector implements BuildListener { - public void buildFinished( BuildEvent event ) { } + public void buildFinished( BuildEvent event ) + { + } - public void buildStarted( BuildEvent event ) { } + public void buildStarted( BuildEvent event ) + { + } public void messageLogged( BuildEvent event ) { @@ -1094,12 +1100,20 @@ public class IContract extends MatchingTask } } - public void targetFinished( BuildEvent event ) { } + public void targetFinished( BuildEvent event ) + { + } - public void targetStarted( BuildEvent event ) { } + public void targetStarted( BuildEvent event ) + { + } - public void taskFinished( BuildEvent event ) { } + public void taskFinished( BuildEvent event ) + { + } - public void taskStarted( BuildEvent event ) { } + public void taskStarted( BuildEvent event ) + { + } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java index cdd5faaaf..7d0f030f9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Javah.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional; + import java.io.File; 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.ant.types.Commandline; @@ -229,32 +230,32 @@ public class Javah extends Task /** * 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( ( cls == null ) && ( classes.size() == 0 ) ) { - throw new BuildException( "class attribute must be set!" ); + throw new TaskException( "class attribute must be set!" ); } if( ( cls != null ) && ( classes.size() > 0 ) ) { - throw new BuildException( "set class attribute or class element, not both." ); + throw new TaskException( "set class attribute or class element, not both." ); } if( destDir != null ) { if( !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" ); } if( outputFile != null ) { - throw new BuildException( "destdir and outputFile are mutually exclusive"); + throw new TaskException( "destdir and outputFile are mutually exclusive" ); } } @@ -290,7 +291,7 @@ public class Javah extends Task { int n = 0; log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); StringBuffer niceClassList = new StringBuffer(); if( cls != null ) @@ -308,7 +309,7 @@ public class Javah extends Task Enumeration enum = classes.elements(); while( enum.hasMoreElements() ) { - ClassArgument arg = ( ClassArgument )enum.nextElement(); + ClassArgument arg = (ClassArgument)enum.nextElement(); String aClass = arg.getName(); cmd.createArgument().setValue( aClass ); niceClassList.append( " " + aClass + lSep ); @@ -381,7 +382,7 @@ public class Javah extends Task { if( !old ) { - throw new BuildException( "stubs only available in old mode." ); + throw new TaskException( "stubs only available in old mode." ); } cmd.createArgument().setValue( "-stubs" ); } @@ -402,11 +403,11 @@ public class Javah extends Task * Peforms a compile using the classic compiler that shipped with JDK 1.1 * and 1.2. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void doClassicCompile() - throws BuildException + throws TaskException { Commandline cmd = setupJavahCommand(); @@ -416,7 +417,7 @@ public class Javah extends Task * sun.tools.javac.Main compiler = * new sun.tools.javac.Main(new LogOutputStream(this, Project.MSG_WARN), "javac"); * if (!compiler.compile(cmd.getArguments())) { - * throw new BuildException("Compile failed"); + * throw new TaskException("Compile failed"); * } */ try @@ -429,20 +430,20 @@ public class Javah extends Task com.sun.tools.javah.Main main = new com.sun.tools.javah.Main( cmd.getArguments() ); main.run(); } - //catch (ClassNotFoundException ex) { - // throw new BuildException("Cannot use javah because it is not available"+ - // " A common solution is to set the environment variable"+ - // " JAVA_HOME to your jdk directory.", location); - //} + //catch (ClassNotFoundException ex) { + // throw new TaskException("Cannot use javah because it is not available"+ + // " A common solution is to set the environment variable"+ + // " JAVA_HOME to your jdk directory.", location); + //} catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting javah: ", ex ); + throw new TaskException( "Error starting javah: ", ex ); } } } @@ -451,7 +452,9 @@ public class Javah extends Task { private String name; - public ClassArgument() { } + public ClassArgument() + { + } public void setName( String name ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ManifestFile.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ManifestFile.java index 29c3680f4..218859ac7 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ManifestFile.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ManifestFile.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -17,10 +18,9 @@ import java.util.Enumeration; import java.util.ListIterator; 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.Task; - /** * Task for creating a manifest file for a jar archiv. use:

  *   
@@ -86,10 +86,10 @@ public class ManifestFile extends Task
     /**
      * execute task
      *
-     * @exception BuildException : Failure in building
+     * @exception TaskException : Failure in building
      */
     public void execute()
-        throws BuildException
+        throws TaskException
     {
         checkParameters();
         if( isUpdate( currentMethod ) )
@@ -111,7 +111,6 @@ public class ManifestFile extends Task
         return method.equals( REPLACEALL_.toUpperCase() );
     }
 
-
     private boolean isUpdate( String method )
     {
         return method.equals( UPDATE_.toUpperCase() );
@@ -125,7 +124,6 @@ public class ManifestFile extends Task
         entry.addTo( container );
     }
 
-
     private StringBuffer buildBuffer()
     {
         StringBuffer buffer = new StringBuffer();
@@ -134,10 +132,10 @@ public class ManifestFile extends Task
 
         while( iterator.hasNext() )
         {
-            Entry entry = ( Entry )iterator.next();
+            Entry entry = (Entry)iterator.next();
 
-            String key = ( String )entry.getKey();
-            String value = ( String )entry.getValue();
+            String key = (String)entry.getKey();
+            String value = (String)entry.getValue();
             String entry_string = key + keyValueSeparator + value;
 
             buffer.append( entry_string + this.newLine );
@@ -157,33 +155,33 @@ public class ManifestFile extends Task
     }
 
     private void checkParameters()
-        throws BuildException
+        throws TaskException
     {
         if( !checkParam( manifestFile ) )
         {
-            throw new BuildException( "file token must not be null." );
+            throw new TaskException( "file token must not be null." );
         }
     }
 
     /**
      * adding entries to a container
      *
-     * @exception BuildException
+     * @exception TaskException
      */
     private void executeOperation()
-        throws BuildException
+        throws TaskException
     {
         Enumeration enum = entries.elements();
 
         while( enum.hasMoreElements() )
         {
-            Entry entry = ( Entry )enum.nextElement();
+            Entry entry = (Entry)enum.nextElement();
             entry.addTo( container );
         }
     }
 
     private void readFile()
-        throws BuildException
+        throws TaskException
     {
 
         if( manifestFile.exists() )
@@ -207,32 +205,31 @@ public class ManifestFile extends Task
                             stop = true;
                         }
                         else
-                            buffer.append( ( char )c );
+                            buffer.append( (char)c );
                     }
                     fis.close();
                     StringTokenizer lineTokens = getLineTokens( buffer );
                     while( lineTokens.hasMoreElements() )
                     {
-                        String currentLine = ( String )lineTokens.nextElement();
+                        String currentLine = (String)lineTokens.nextElement();
                         addLine( currentLine );
                     }
                 }
                 catch( FileNotFoundException fnfe )
                 {
-                    throw new BuildException( "File not found exception " + fnfe.toString() );
+                    throw new TaskException( "File not found exception " + fnfe.toString() );
                 }
                 catch( IOException ioe )
                 {
-                    throw new BuildException( "Unknown input/output exception " + ioe.toString() );
+                    throw new TaskException( "Unknown input/output exception " + ioe.toString() );
                 }
             }
         }
 
     }
 
-
     private void writeFile()
-        throws BuildException
+        throws TaskException
     {
         try
         {
@@ -248,7 +245,7 @@ public class ManifestFile extends Task
 
                 for( int i = 0; i < size; i++ )
                 {
-                    fos.write( ( char )buffer.charAt( i ) );
+                    fos.write( (char)buffer.charAt( i ) );
                 }
 
                 fos.flush();
@@ -256,13 +253,13 @@ public class ManifestFile extends Task
             }
             else
             {
-                throw new BuildException( "Can't create manifest file" );
+                throw new TaskException( "Can't create manifest file" );
             }
 
         }
         catch( IOException ioe )
         {
-            throw new BuildException( "An input/ouput error occured" + ioe.toString() );
+            throw new TaskException( "An input/ouput error occured" + ioe.toString() );
         }
     }
 
@@ -275,7 +272,9 @@ public class ManifestFile extends Task
         private String val = null;
         private String key = null;
 
-        public Entry() { }
+        public Entry()
+        {
+        }
 
         public void setValue( String value )
         {
@@ -298,8 +297,8 @@ public class ManifestFile extends Task
 
             try
             {
-                Entry e1 = ( Entry )o1;
-                Entry e2 = ( Entry )o2;
+                Entry e1 = (Entry)o1;
+                Entry e2 = (Entry)o2;
 
                 String key_1 = e1.getKey();
                 String key_2 = e2.getKey();
@@ -313,21 +312,19 @@ public class ManifestFile extends Task
             return result;
         }
 
-
         public boolean equals( Object obj )
         {
             Entry ent = new Entry();
             boolean result = false;
-            int res = ent.compare( this, ( Entry )obj );
+            int res = ent.compare( this, (Entry)obj );
             if( res == 0 )
                 result = true;
 
             return result;
         }
 
-
         protected void addTo( EntryContainer container )
-            throws BuildException
+            throws TaskException
         {
             checkFormat();
             split();
@@ -335,12 +332,12 @@ public class ManifestFile extends Task
         }
 
         private void checkFormat()
-            throws BuildException
+            throws TaskException
         {
 
             if( value == null )
             {
-                throw new BuildException( "no argument for value" );
+                throw new TaskException( "no argument for value" );
             }
 
             StringTokenizer st = new StringTokenizer( value, ManifestFile.keyValueSeparator );
@@ -348,15 +345,15 @@ public class ManifestFile extends Task
 
             if( size < 2 )
             {
-                throw new BuildException( "value has not the format of a manifest entry" );
+                throw new TaskException( "value has not the format of a manifest entry" );
             }
         }
 
         private void split()
         {
             StringTokenizer st = new StringTokenizer( value, ManifestFile.keyValueSeparator );
-            key = ( String )st.nextElement();
-            val = ( String )st.nextElement();
+            key = (String)st.nextElement();
+            val = (String)st.nextElement();
         }
 
     }
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
index 413aec28c..0e343ceec 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
@@ -6,8 +6,9 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
-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;
@@ -34,7 +35,6 @@ public class Native2Ascii extends MatchingTask
 
     private Mapper mapper;
 
-
     /**
      * Set the destination dirctory to place converted files into.
      *
@@ -93,21 +93,21 @@ public class Native2Ascii extends MatchingTask
      * 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( mapper != null )
         {
-            throw new BuildException( "Cannot define more than one mapper" );
+            throw new TaskException( "Cannot define more than one mapper" );
         }
         mapper = new Mapper( project );
         return mapper;
     }
 
     public void execute()
-        throws BuildException
+        throws TaskException
     {
 
         Commandline baseCmd = null;// the common portion of our cmd line
@@ -123,7 +123,7 @@ public class Native2Ascii extends MatchingTask
         // Require destDir
         if( destDir == null )
         {
-            throw new BuildException( "The dest attribute must be set." );
+            throw new TaskException( "The dest attribute must be set." );
         }
 
         // if src and dest dirs are the same, require the extension
@@ -131,8 +131,8 @@ public class Native2Ascii extends MatchingTask
         // include a file with the same extension, but ....
         if( srcDir.equals( destDir ) && extension == null && mapper == null )
         {
-            throw new BuildException( "The ext attribute or a mapper must be set if"
-                 + " src and dest dirs are the same." );
+            throw new TaskException( "The ext attribute or a mapper must be set if"
+                                     + " src and dest dirs are the same." );
         }
 
         FileNameMapper m = null;
@@ -162,11 +162,11 @@ public class Native2Ascii extends MatchingTask
             return;
         }
         String message = "Converting " + count + " file"
-             + ( count != 1 ? "s" : "" ) + " from ";
+            + ( count != 1 ? "s" : "" ) + " from ";
         log( message + srcDir + " to " + destDir );
         for( int i = 0; i < files.length; i++ )
         {
-            convert( files[i], m.mapFileName( files[i] )[0] );
+            convert( files[ i ], m.mapFileName( files[ i ] )[ 0 ] );
         }
     }
 
@@ -175,10 +175,10 @@ public class Native2Ascii extends MatchingTask
      *
      * @param srcName Description of Parameter
      * @param destName Description of Parameter
-     * @exception BuildException Description of Exception
+     * @exception TaskException Description of Exception
      */
     private void convert( String srcName, String destName )
-        throws BuildException
+        throws TaskException
     {
 
         Commandline cmd = new Commandline();// Command line to run
@@ -207,8 +207,8 @@ public class Native2Ascii extends MatchingTask
         // Make sure we're not about to clobber something
         if( srcFile.equals( destFile ) )
         {
-            throw new BuildException( "file " + srcFile
-                 + " would overwrite its self" );
+            throw new TaskException( "file " + srcFile
+                                     + " would overwrite its self" );
         }
 
         // Make intermediate directories if needed
@@ -220,26 +220,30 @@ public class Native2Ascii extends MatchingTask
 
             if( ( !parentFile.exists() ) && ( !parentFile.mkdirs() ) )
             {
-                throw new BuildException( "cannot create parent directory "
-                     + parentName );
+                throw new TaskException( "cannot create parent directory "
+                                         + parentName );
             }
         }
 
         log( "converting " + srcName, Project.MSG_VERBOSE );
         sun.tools.native2ascii.Main n2a
-             = new sun.tools.native2ascii.Main();
+            = new sun.tools.native2ascii.Main();
         if( !n2a.convert( cmd.getArguments() ) )
         {
-            throw new BuildException( "conversion failed" );
+            throw new TaskException( "conversion failed" );
         }
     }
 
     private class ExtMapper implements FileNameMapper
     {
 
-        public void setFrom( String s ) { }
+        public void setFrom( String s )
+        {
+        }
 
-        public void setTo( String s ) { }
+        public void setTo( String s )
+        {
+        }
 
         public String[] mapFileName( String fileName )
         {
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
index a33bd080b..f203cb0ea 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
@@ -6,6 +6,7 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -16,11 +17,11 @@ import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.Vector;
 import netrexx.lang.Rexx;
-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;
 import org.apache.tools.ant.taskdefs.MatchingTask;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Task to compile NetRexx source files. This task can take the following
@@ -113,7 +114,6 @@ public class NetRexxC extends MatchingTask
     private boolean time;
     private boolean utf8;
 
-
     /**
      * Set whether literals are treated as binary, rather than NetRexx types
      *
@@ -263,7 +263,6 @@ public class NetRexxC extends MatchingTask
         this.java = java;
     }
 
-
     /**
      * Sets whether the generated java source file should be kept after
      * compilation. The generated files will have an extension of .java.keep,
@@ -392,7 +391,6 @@ public class NetRexxC extends MatchingTask
         this.strictprops = strictprops;
     }
 
-
     /**
      * Whether the compiler should force catching of exceptions by explicitly
      * named types
@@ -438,15 +436,15 @@ public class NetRexxC extends MatchingTask
     public void setTrace( String trace )
     {
         if( trace.equalsIgnoreCase( "trace" )
-             || trace.equalsIgnoreCase( "trace1" )
-             || trace.equalsIgnoreCase( "trace2" )
-             || trace.equalsIgnoreCase( "notrace" ) )
+            || trace.equalsIgnoreCase( "trace1" )
+            || trace.equalsIgnoreCase( "trace2" )
+            || trace.equalsIgnoreCase( "notrace" ) )
         {
             this.trace = trace;
         }
         else
         {
-            throw new BuildException( "Unknown trace value specified: '" + trace + "'" );
+            throw new TaskException( "Unknown trace value specified: '" + trace + "'" );
         }
     }
 
@@ -475,16 +473,16 @@ public class NetRexxC extends MatchingTask
     /**
      * Executes the task, i.e. does the actual compiler call
      *
-     * @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 || destDir == null )
         {
-            throw new BuildException( "srcDir and destDir attributes must be set!" );
+            throw new TaskException( "srcDir and destDir attributes must be set!" );
         }
 
         // scan source and dest dirs to build up both copy lists and
@@ -515,6 +513,7 @@ public class NetRexxC extends MatchingTask
      * @return The CompileClasspath value
      */
     private String getCompileClasspath()
+        throws TaskException
     {
         StringBuffer classpath = new StringBuffer();
 
@@ -567,7 +566,7 @@ public class NetRexxC extends MatchingTask
         options.addElement( "-" + trace );
         options.addElement( utf8 ? "-utf8" : "-noutf8" );
         options.addElement( "-" + verbose );
-        String[] results = new String[options.size()];
+        String[] results = new String[ options.size() ];
         options.copyInto( results );
         return results;
     }
@@ -582,9 +581,10 @@ public class NetRexxC extends MatchingTask
      * @param source - source classpath to get file objects.
      */
     private void addExistingToClasspath( StringBuffer target, String source )
+        throws TaskException
     {
         StringTokenizer tok = new StringTokenizer( source,
-            System.getProperty( "path.separator" ), false );
+                                                   System.getProperty( "path.separator" ), false );
         while( tok.hasMoreTokens() )
         {
             File f = resolveFile( tok.nextToken() );
@@ -597,7 +597,7 @@ public class NetRexxC extends MatchingTask
             else
             {
                 log( "Dropping from classpath: " +
-                    f.getAbsolutePath(), Project.MSG_VERBOSE );
+                     f.getAbsolutePath(), Project.MSG_VERBOSE );
             }
         }
 
@@ -616,8 +616,8 @@ public class NetRexxC extends MatchingTask
             Enumeration enum = filecopyList.keys();
             while( enum.hasMoreElements() )
             {
-                String fromFile = ( String )enum.nextElement();
-                String toFile = ( String )filecopyList.get( fromFile );
+                String fromFile = (String)enum.nextElement();
+                String toFile = (String)filecopyList.get( fromFile );
                 try
                 {
                     FileUtils.newFileUtils().copyFile( fromFile, toFile );
@@ -625,8 +625,8 @@ public class NetRexxC extends MatchingTask
                 catch( IOException ioe )
                 {
                     String msg = "Failed to copy " + fromFile + " to " + toFile
-                         + " due to " + ioe.getMessage();
-                    throw new BuildException( msg, ioe );
+                        + " due to " + ioe.getMessage();
+                    throw new TaskException( msg, ioe );
                 }
             }
         }
@@ -635,10 +635,10 @@ public class NetRexxC extends MatchingTask
     /**
      * Peforms a copmile using the NetRexx 1.1.x compiler
      *
-     * @exception BuildException Description of Exception
+     * @exception TaskException Description of Exception
      */
     private void doNetRexxCompile()
-        throws BuildException
+        throws TaskException
     {
         log( "Using NetRexx compiler", Project.MSG_VERBOSE );
         String classpath = getCompileClasspath();
@@ -648,30 +648,30 @@ public class NetRexxC extends MatchingTask
         // create an array of strings for input to the compiler: one array
         // comes from the compile options, the other from the compileList
         String[] compileOptionsArray = getCompileOptionsAsArray();
-        String[] fileListArray = new String[compileList.size()];
+        String[] fileListArray = new String[ compileList.size() ];
         Enumeration e = compileList.elements();
         int j = 0;
         while( e.hasMoreElements() )
         {
-            fileListArray[j] = ( String )e.nextElement();
+            fileListArray[ j ] = (String)e.nextElement();
             j++;
         }
         // create a single array of arguments for the compiler
-        String compileArgs[] = new String[compileOptionsArray.length + fileListArray.length];
+        String compileArgs[] = new String[ compileOptionsArray.length + fileListArray.length ];
         for( int i = 0; i < compileOptionsArray.length; i++ )
         {
-            compileArgs[i] = compileOptionsArray[i];
+            compileArgs[ i ] = compileOptionsArray[ i ];
         }
         for( int i = 0; i < fileListArray.length; i++ )
         {
-            compileArgs[i + compileOptionsArray.length] = fileListArray[i];
+            compileArgs[ i + compileOptionsArray.length ] = fileListArray[ i ];
         }
 
         // print nice output about what we are doing for the log
         compileOptions.append( "Compilation args: " );
         for( int i = 0; i < compileOptionsArray.length; i++ )
         {
-            compileOptions.append( compileOptionsArray[i] );
+            compileOptions.append( compileOptionsArray[ i ] );
             compileOptions.append( " " );
         }
         log( compileOptions.toString(), Project.MSG_VERBOSE );
@@ -704,7 +704,7 @@ public class NetRexxC extends MatchingTask
             {// 1 is warnings from real NetRexxC
                 log( out.toString(), Project.MSG_ERR );
                 String msg = "Compile failed, messages should have been provided.";
-                throw new BuildException( msg );
+                throw new TaskException( msg );
             }
             else if( rc == 1 )
             {
@@ -736,9 +736,9 @@ public class NetRexxC extends MatchingTask
     {
         for( int i = 0; i < files.length; i++ )
         {
-            File srcFile = new File( srcDir, files[i] );
-            File destFile = new File( destDir, files[i] );
-            String filename = files[i];
+            File srcFile = new File( srcDir, files[ i ] );
+            File destFile = new File( destDir, files[ i ] );
+            String filename = files[ i ];
             // if it's a non source file, copy it if a later date than the
             // dest
             // if it's a source file, see if the destination class file
@@ -747,7 +747,7 @@ public class NetRexxC extends MatchingTask
             {
                 File classFile =
                     new File( destDir,
-                    filename.substring( 0, filename.lastIndexOf( '.' ) ) + ".class" );
+                              filename.substring( 0, filename.lastIndexOf( '.' ) ) + ".class" );
 
                 if( !compile || srcFile.lastModified() > classFile.lastModified() )
                 {
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/PropertyFile.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
index c185769d7..61a8f6d3b 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
@@ -6,6 +6,7 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.BufferedInputStream;
 import java.io.BufferedOutputStream;
 import java.io.File;
@@ -25,7 +26,7 @@ import java.util.Enumeration;
 import java.util.GregorianCalendar;
 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.Task;
 import org.apache.tools.ant.types.EnumeratedAttribute;
 
@@ -178,7 +179,7 @@ public class PropertyFile extends Task
      * Methods
      */
     public void execute()
-        throws BuildException
+        throws TaskException
     {
         checkParameters();
         readFile();
@@ -200,26 +201,26 @@ public class PropertyFile extends Task
     }
 
     private void checkParameters()
-        throws BuildException
+        throws TaskException
     {
         if( !checkParam( m_propertyfile ) )
         {
-            throw new BuildException( "file token must not be null." );
+            throw new TaskException( "file token must not be null." );
         }
     }
 
     private void executeOperation()
-        throws BuildException
+        throws TaskException
     {
-        for( Enumeration e = entries.elements(); e.hasMoreElements();  )
+        for( Enumeration e = entries.elements(); e.hasMoreElements(); )
         {
-            Entry entry = ( Entry )e.nextElement();
+            Entry entry = (Entry)e.nextElement();
             entry.executeOn( m_properties );
         }
     }
 
     private void readFile()
-        throws BuildException
+        throws TaskException
     {
         // Create the PropertyFile
         m_properties = new Properties();
@@ -246,7 +247,7 @@ public class PropertyFile extends Task
             else
             {
                 log( "Creating new property file: " +
-                    m_propertyfile.getAbsolutePath() );
+                     m_propertyfile.getAbsolutePath() );
                 FileOutputStream out = null;
                 try
                 {
@@ -264,12 +265,12 @@ public class PropertyFile extends Task
         }
         catch( IOException ioe )
         {
-            throw new BuildException( ioe.toString() );
+            throw new TaskException( ioe.toString() );
         }
     }
 
     private void writeFile()
-        throws BuildException
+        throws TaskException
     {
         BufferedOutputStream bos = null;
         try
@@ -279,10 +280,10 @@ public class PropertyFile extends Task
             // Properties.store is not available in JDK 1.1
             Method m =
                 Properties.class.getMethod( "store",
-                new Class[]{
-                OutputStream.class,
-                String.class}
-                 );
+                                            new Class[]{
+                                                OutputStream.class,
+                                                String.class}
+                );
             m.invoke( m_properties, new Object[]{bos, m_comment} );
 
         }
@@ -293,16 +294,16 @@ public class PropertyFile extends Task
         catch( InvocationTargetException ite )
         {
             Throwable t = ite.getTargetException();
-            throw new BuildException( "Error", t );
+            throw new TaskException( "Error", t );
         }
         catch( IllegalAccessException iae )
         {
             // impossible
-            throw new BuildException( "Error", iae );
+            throw new TaskException( "Error", iae );
         }
         catch( IOException ioe )
         {
-            throw new BuildException( "Error", ioe );
+            throw new TaskException( "Error", ioe );
         }
         finally
         {
@@ -313,7 +314,8 @@ public class PropertyFile extends Task
                     bos.close();
                 }
                 catch( IOException ioex )
-                {}
+                {
+                }
             }
         }
     }
@@ -385,7 +387,7 @@ public class PropertyFile extends Task
         }
 
         protected void executeOn( Properties props )
-            throws BuildException
+            throws TaskException
         {
             checkParameters();
 
@@ -394,19 +396,19 @@ public class PropertyFile extends Task
             {
                 if( m_type == Type.INTEGER_TYPE )
                 {
-                    executeInteger( ( String )props.get( m_key ) );
+                    executeInteger( (String)props.get( m_key ) );
                 }
                 else if( m_type == Type.DATE_TYPE )
                 {
-                    executeDate( ( String )props.get( m_key ) );
+                    executeDate( (String)props.get( m_key ) );
                 }
                 else if( m_type == Type.STRING_TYPE )
                 {
-                    executeString( ( String )props.get( m_key ) );
+                    executeString( (String)props.get( m_key ) );
                 }
                 else
                 {
-                    throw new BuildException( "Unknown operation type: " + m_type + "" );
+                    throw new TaskException( "Unknown operation type: " + m_type + "" );
                 }
             }
             catch( NullPointerException npe )
@@ -423,28 +425,28 @@ public class PropertyFile extends Task
         /**
          * Check if parameter combinations can be supported
          *
-         * @exception BuildException Description of Exception
+         * @exception TaskException Description of Exception
          */
         private void checkParameters()
-            throws BuildException
+            throws TaskException
         {
             if( m_type == Type.STRING_TYPE &&
                 m_operation == Operation.DECREMENT_OPER )
             {
-                throw new BuildException( "- is not suported for string properties (key:" + m_key + ")" );
+                throw new TaskException( "- is not suported for string properties (key:" + m_key + ")" );
             }
             if( m_value == null && m_default == null )
             {
-                throw new BuildException( "value and/or default must be specified (key:" + m_key + ")" );
+                throw new TaskException( "value and/or default must be specified (key:" + m_key + ")" );
             }
             if( m_key == null )
             {
-                throw new BuildException( "key is mandatory" );
+                throw new TaskException( "key is mandatory" );
             }
             if( m_type == Type.STRING_TYPE &&
                 m_pattern != null )
             {
-                throw new BuildException( "pattern is not suported for string properties (key:" + m_key + ")" );
+                throw new TaskException( "pattern is not suported for string properties (key:" + m_key + ")" );
             }
         }
 
@@ -454,10 +456,10 @@ public class PropertyFile extends Task
          * @param oldValue the current value read from the property file or
          *      null if the key was not contained in
          *      the property file.
-         * @exception BuildException Description of Exception
+         * @exception TaskException Description of Exception
          */
         private void executeDate( String oldValue )
-            throws BuildException
+            throws TaskException
         {
             GregorianCalendar value = new GregorianCalendar();
             GregorianCalendar newValue = new GregorianCalendar();
@@ -577,23 +579,22 @@ public class PropertyFile extends Task
             }
         }
 
-
         /**
          * Handle operations for type int.
          *
          * @param oldValue the current value read from the property file or
          *      null if the key was not contained in
          *      the property file.
-         * @exception BuildException Description of Exception
+         * @exception TaskException Description of Exception
          */
         private void executeInteger( String oldValue )
-            throws BuildException
+            throws TaskException
         {
             int value = 0;
             int newValue = 0;
 
             DecimalFormat fmt = ( m_pattern != null ) ? new DecimalFormat( m_pattern )
-                 : new DecimalFormat();
+                : new DecimalFormat();
 
             if( oldValue != null )
             {
@@ -674,10 +675,10 @@ public class PropertyFile extends Task
          * @param oldValue the current value read from the property file or
          *      null if the key was not contained in
          *      the property file.
-         * @exception BuildException Description of Exception
+         * @exception TaskException Description of Exception
          */
         private void executeString( String oldValue )
-            throws BuildException
+            throws TaskException
         {
             String value = "";
             String newValue = "";
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
index ece6ed56e..969c125ac 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
@@ -6,6 +6,7 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
@@ -14,9 +15,8 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.io.LineNumberReader;
 import java.io.PrintWriter;
-import java.util.Random;
 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;
@@ -117,18 +117,20 @@ public class ReplaceRegExp extends Task
     }
 
     public void setMatch( String match )
+        throws TaskException
     {
         if( regex != null )
-            throw new BuildException( "Only one regular expression is allowed" );
+            throw new TaskException( "Only one regular expression is allowed" );
 
         regex = new RegularExpression();
         regex.setPattern( match );
     }
 
     public void setReplace( String replace )
+        throws TaskException
     {
         if( subs != null )
-            throw new BuildException( "Only one substitution expression is allowed" );
+            throw new TaskException( "Only one substitution expression is allowed" );
 
         subs = new Substitution();
         subs.setExpression( replace );
@@ -140,33 +142,35 @@ public class ReplaceRegExp extends Task
     }
 
     public RegularExpression createRegularExpression()
+        throws TaskException
     {
         if( regex != null )
-            throw new BuildException( "Only one regular expression is allowed." );
+            throw new TaskException( "Only one regular expression is allowed." );
 
         regex = new RegularExpression();
         return regex;
     }
 
     public Substitution createSubstitution()
+        throws TaskException
     {
         if( subs != null )
-            throw new BuildException( "Only one substitution expression is allowed" );
+            throw new TaskException( "Only one substitution expression is allowed" );
 
         subs = new Substitution();
         return subs;
     }
 
     public void execute()
-        throws BuildException
+        throws TaskException
     {
         if( regex == null )
-            throw new BuildException( "No expression to match." );
+            throw new TaskException( "No expression to match." );
         if( subs == null )
-            throw new BuildException( "Nothing to replace expression with." );
+            throw new TaskException( "Nothing to replace expression with." );
 
         if( file != null && filesets.size() > 0 )
-            throw new BuildException( "You cannot supply the 'file' attribute and filesets at the same time." );
+            throw new TaskException( "You cannot supply the 'file' attribute and filesets at the same time." );
 
         int options = 0;
 
@@ -191,25 +195,25 @@ public class ReplaceRegExp extends Task
             catch( IOException e )
             {
                 log( "An error occurred processing file: '" + file.getAbsolutePath() + "': " + e.toString(),
-                    Project.MSG_ERR );
+                     Project.MSG_ERR );
             }
         }
         else if( file != null )
         {
             log( "The following file is missing: '" + file.getAbsolutePath() + "'",
-                Project.MSG_ERR );
+                 Project.MSG_ERR );
         }
 
         int sz = filesets.size();
         for( int i = 0; i < sz; i++ )
         {
-            FileSet fs = ( FileSet )( filesets.elementAt( i ) );
+            FileSet fs = (FileSet)( filesets.elementAt( i ) );
             DirectoryScanner ds = fs.getDirectoryScanner( getProject() );
 
             String files[] = ds.getIncludedFiles();
             for( int j = 0; j < files.length; j++ )
             {
-                File f = new File( files[j] );
+                File f = new File( files[ j ] );
                 if( f.exists() )
                 {
                     try
@@ -219,19 +223,18 @@ public class ReplaceRegExp extends Task
                     catch( Exception e )
                     {
                         log( "An error occurred processing file: '" + f.getAbsolutePath() + "': " + e.toString(),
-                            Project.MSG_ERR );
+                             Project.MSG_ERR );
                     }
                 }
                 else
                 {
                     log( "The following file is missing: '" + file.getAbsolutePath() + "'",
-                        Project.MSG_ERR );
+                         Project.MSG_ERR );
                 }
             }
         }
     }
 
-
     protected String doReplace( RegularExpression r,
                                 Substitution s,
                                 String input,
@@ -276,11 +279,11 @@ public class ReplaceRegExp extends Task
             boolean changes = false;
 
             log( "Replacing pattern '" + regex.getPattern( project ) + "' with '" + subs.getExpression( project ) +
-                "' in '" + f.getPath() + "'" +
-                ( byline ? " by line" : "" ) +
-                ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) +
-                ".",
-                Project.MSG_WARN );
+                 "' in '" + f.getPath() + "'" +
+                 ( byline ? " by line" : "" ) +
+                 ( flags.length() > 0 ? " with flags: '" + flags + "'" : "" ) +
+                 ".",
+                 Project.MSG_WARN );
 
             if( byline )
             {
@@ -299,8 +302,8 @@ public class ReplaceRegExp extends Task
             }
             else
             {
-                int flen = ( int )( f.length() );
-                char tmpBuf[] = new char[flen];
+                int flen = (int)( f.length() );
+                char tmpBuf[] = new char[ flen ];
                 int numread = 0;
                 int totread = 0;
                 while( numread != -1 && totread < flen )
@@ -342,7 +345,8 @@ public class ReplaceRegExp extends Task
                     r.close();
             }
             catch( Exception e )
-            {}
+            {
+            }
             ;
 
             try
@@ -351,7 +355,8 @@ public class ReplaceRegExp extends Task
                     r.close();
             }
             catch( Exception e )
-            {}
+            {
+            }
             ;
         }
     }
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Rpm.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Rpm.java
index a681c349f..0496befd0 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Rpm.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Rpm.java
@@ -6,13 +6,14 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
-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.taskdefs.Execute;
@@ -102,7 +103,7 @@ public class Rpm extends Task
     {
         if( ( sf == null ) || ( sf.trim().equals( "" ) ) )
         {
-            throw new BuildException( "You must specify a spec file" );
+            throw new TaskException( "You must specify a spec file" );
         }
         this.specFile = sf;
     }
@@ -113,7 +114,7 @@ public class Rpm extends Task
     }
 
     public void execute()
-        throws BuildException
+        throws TaskException
     {
 
         Commandline toExecute = new Commandline();
@@ -148,7 +149,7 @@ public class Rpm extends Task
         if( error == null && output == null )
         {
             streamhandler = new LogStreamHandler( this, Project.MSG_INFO,
-                Project.MSG_WARN );
+                                                  Project.MSG_WARN );
         }
         else
         {
@@ -160,7 +161,7 @@ public class Rpm extends Task
                 }
                 catch( IOException e )
                 {
-                    throw new BuildException( "Error", e );
+                    throw new TaskException( "Error", e );
                 }
             }
             else
@@ -175,7 +176,7 @@ public class Rpm extends Task
                 }
                 catch( IOException e )
                 {
-                    throw new BuildException( "Error", e );
+                    throw new TaskException( "Error", e );
                 }
             }
             else
@@ -200,7 +201,7 @@ public class Rpm extends Task
         }
         catch( IOException e )
         {
-            throw new BuildException( "Error", e );
+            throw new TaskException( "Error", e );
         }
         finally
         {
@@ -211,7 +212,8 @@ public class Rpm extends Task
                     outputstream.close();
                 }
                 catch( IOException e )
-                {}
+                {
+                }
             }
             if( error != null )
             {
@@ -220,7 +222,8 @@ public class Rpm extends Task
                     errorstream.close();
                 }
                 catch( IOException e )
-                {}
+                {
+                }
             }
         }
     }
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Script.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Script.java
index 294ea0ba8..76bdf4376 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Script.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/Script.java
@@ -6,6 +6,7 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import com.ibm.bsf.BSFException;
 import com.ibm.bsf.BSFManager;
 import java.io.File;
@@ -13,7 +14,7 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Hashtable;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
 import org.apache.tools.ant.Task;
 
 /**
@@ -46,10 +47,10 @@ public class Script extends Task
     {
         File file = new File( fileName );
         if( !file.exists() )
-            throw new BuildException( "file " + fileName + " not found." );
+            throw new TaskException( "file " + fileName + " not found." );
 
-        int count = ( int )file.length();
-        byte data[] = new byte[count];
+        int count = (int)file.length();
+        byte data[] = new byte[ count ];
 
         try
         {
@@ -59,7 +60,7 @@ public class Script extends Task
         }
         catch( IOException e )
         {
-            throw new BuildException( "Error", e );
+            throw new TaskException( "Error", e );
         }
 
         script += new String( data );
@@ -78,10 +79,10 @@ public class Script extends Task
     /**
      * Do 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
     {
         try
         {
@@ -96,9 +97,9 @@ public class Script extends Task
 
             BSFManager manager = new BSFManager();
 
-            for( Enumeration e = beans.keys(); e.hasMoreElements();  )
+            for( Enumeration e = beans.keys(); e.hasMoreElements(); )
             {
-                String key = ( String )e.nextElement();
+                String key = (String)e.nextElement();
                 Object value = beans.get( key );
                 manager.declareBean( key, value, value.getClass() );
             }
@@ -112,16 +113,16 @@ public class Script extends Task
             Throwable te = be.getTargetException();
             if( te != null )
             {
-                if( te instanceof BuildException )
+                if( te instanceof TaskException )
                 {
-                    throw ( BuildException )te;
+                    throw (TaskException)te;
                 }
                 else
                 {
                     t = te;
                 }
             }
-            throw new BuildException( "Error", t );
+            throw new TaskException( "Error", t );
         }
     }
 
@@ -132,9 +133,9 @@ public class Script extends Task
      */
     private void addBeans( Hashtable dictionary )
     {
-        for( Enumeration e = dictionary.keys(); e.hasMoreElements();  )
+        for( Enumeration e = dictionary.keys(); e.hasMoreElements(); )
         {
-            String key = ( String )e.nextElement();
+            String key = (String)e.nextElement();
 
             boolean isValid = key.length() > 0 &&
                 Character.isJavaIdentifierStart( key.charAt( 0 ) );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/StyleBook.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/StyleBook.java
index 0f37fc687..3ece9cc52 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/StyleBook.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/StyleBook.java
@@ -6,8 +6,9 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
-import org.apache.tools.ant.BuildException;
+import org.apache.myrmidon.api.TaskException;
 import org.apache.tools.ant.taskdefs.Java;
 
 /**
@@ -18,7 +19,7 @@ import org.apache.tools.ant.taskdefs.Java;
  *      Börger
  */
 public class StyleBook
-     extends Java
+    extends Java
 {
     protected File m_book;
     protected String m_loaderConfig;
@@ -53,22 +54,22 @@ public class StyleBook
     }
 
     public void execute()
-        throws BuildException
+        throws TaskException
     {
 
         if( null == m_targetDirectory )
         {
-            throw new BuildException( "TargetDirectory attribute not set." );
+            throw new TaskException( "TargetDirectory attribute not set." );
         }
 
         if( null == m_skinDirectory )
         {
-            throw new BuildException( "SkinDirectory attribute not set." );
+            throw new TaskException( "SkinDirectory attribute not set." );
         }
 
         if( null == m_book )
         {
-            throw new BuildException( "book attribute not set." );
+            throw new TaskException( "book attribute not set." );
         }
 
         createArg().setValue( "targetDirectory=" + m_targetDirectory );
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
index e608bfcd2..ddcbdc34f 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
@@ -6,13 +6,13 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import javax.xml.transform.ErrorListener;
 import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Source;
 import javax.xml.transform.Templates;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerException;
@@ -73,7 +73,7 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
         transformer.setOutputProperty( OutputKeys.METHOD, type );
     }
 
-//------------------- IMPORTANT
+    //------------------- IMPORTANT
     // 1) Don't use the StreamSource(File) ctor. It won't work with
     // xalan prior to 2.2 because of systemid bugs.
 
@@ -141,7 +141,8 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
             try
             {
                 if( fis != null )
@@ -150,7 +151,8 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
             try
             {
                 if( fos != null )
@@ -159,7 +161,8 @@ public class TraXLiaison implements XSLTLiaison, ErrorListener, XSLTLoggerAware
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
         }
     }
 
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
index 3798629fc..beab0e881 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
@@ -6,11 +6,12 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional;
+
 import java.io.File;
 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.ant.taskdefs.XSLTLiaison;
 import org.apache.xalan.xslt.XSLTInputSource;
 import org.apache.xalan.xslt.XSLTProcessor;
@@ -39,7 +40,7 @@ public class XalanLiaison implements XSLTLiaison
         throws Exception
     {
         if( !type.equals( "xml" ) )
-            throw new BuildException( "Unsupported output type: " + type );
+            throw new TaskException( "Unsupported output type: " + type );
     }
 
     public void setStylesheet( File stylesheet )
@@ -86,7 +87,8 @@ public class XalanLiaison implements XSLTLiaison
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
             try
             {
                 if( fis != null )
@@ -95,7 +97,8 @@ public class XalanLiaison implements XSLTLiaison
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
             try
             {
                 if( fos != null )
@@ -104,7 +107,8 @@ public class XalanLiaison implements XSLTLiaison
                 }
             }
             catch( IOException ignored )
-            {}
+            {
+            }
         }
     }
 }//-- XalanLiaison
diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
index 3105ead43..5aa07739f 100644
--- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
+++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheck.java
@@ -6,8 +6,9 @@
  * the LICENSE file.
  */
 package org.apache.tools.ant.taskdefs.optional.ccm;
+
 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.types.Commandline;
 
@@ -88,7 +89,6 @@ public class CCMCheck extends Continuus
         return _file;
     }
 
-
     /**
      * Get the value of task.
      *
@@ -99,17 +99,16 @@ public class CCMCheck extends Continuus
         return _task;
     }
 
-
     /**
      * Executes the task. 

* * Builds a command line to execute ccm and then calls Exec's run method to * execute the command line.

* - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -127,11 +126,10 @@ public class CCMCheck extends Continuus if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java index ed7d1d1f1..5d4112f95 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckin.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ccm; + import java.util.Date; /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java index 35f9391e7..0ec54a977 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMCreateTask.java @@ -6,17 +6,17 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ccm; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.types.Commandline; - /** * Task allows to create new ccm task and set it as the default * @@ -108,7 +108,9 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler * @exception IOException Description of Exception */ public void setProcessInputStream( OutputStream param1 ) - throws IOException { } + throws IOException + { + } /** * read the output stream to retrieve the new task number. @@ -138,12 +140,12 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler { log( "error procession stream , null pointer exception", Project.MSG_ERR ); npe.printStackTrace(); - throw new BuildException( npe.getClass().getName() ); + throw new TaskException( npe.getClass().getName() ); }// end of catch catch( Exception e ) { log( "error procession stream " + e.getMessage(), Project.MSG_ERR ); - throw new BuildException( e.getMessage() ); + throw new TaskException( e.getMessage() ); }// end of try-catch } @@ -188,7 +190,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler this.task = v; } - /** * Get the value of comment. * @@ -199,7 +200,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return comment; } - /** * Get the value of platform. * @@ -210,7 +210,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return platform; } - /** * Get the value of release. * @@ -221,7 +220,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return release; } - /** * Get the value of resolver. * @@ -242,7 +240,6 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return subSystem; } - /** * Get the value of task. * @@ -253,17 +250,16 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler return task; } - /** * Executes the task.

* * Builds a command line to execute ccm and then calls Exec's run method to * execute the command line.

* - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -280,7 +276,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } //create task ok, set this task as the default one @@ -295,7 +291,7 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler if( result != 0 ) { String msg = "Failed executing: " + commandLine2.toString(); - throw new BuildException( msg); + throw new TaskException( msg ); } } @@ -307,12 +303,15 @@ public class CCMCreateTask extends Continuus implements ExecuteStreamHandler * @exception IOException Description of Exception */ public void start() - throws IOException { } + throws IOException + { + } /** */ - public void stop() { } - + public void stop() + { + } /** * Check the command line options. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java index 388599fba..f5d12753c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/CCMReconfigure.java @@ -6,11 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ccm; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - /** * Task allows to reconfigure a project, recurcively or not * @@ -84,7 +84,6 @@ public class CCMReconfigure extends Continuus return project; } - /** * Get the value of recurse. * @@ -95,7 +94,6 @@ public class CCMReconfigure extends Continuus return recurse; } - /** * Get the value of verbose. * @@ -106,17 +104,16 @@ public class CCMReconfigure extends Continuus return verbose; } - /** * Executes the task.

* * Builds a command line to execute ccm and then calls Exec's run method to * execute the command line.

* - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -133,11 +130,10 @@ public class CCMReconfigure extends Continuus if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java index ad7cdb5b5..654b19ad9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ccm/Continuus.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ccm; -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.taskdefs.Execute; @@ -14,7 +15,6 @@ import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; - /** * A base class for creating tasks for executing commands on Continuus 5.1

* @@ -58,7 +58,6 @@ public abstract class Continuus extends Task private String _ccmDir = ""; private String _ccmAction = ""; - /** * Set the directory where the ccm executable is located * @@ -107,7 +106,6 @@ public abstract class Continuus extends Task return toReturn; } - protected int run( Commandline cmd, ExecuteStreamHandler handler ) { try @@ -120,7 +118,7 @@ public abstract class Continuus extends Task } catch( java.io.IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java index 891d53a45..969ea23d8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckin.java @@ -6,12 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - - /** * Task to perform Checkin command to ClearCase.

* @@ -194,7 +193,6 @@ public class CCCheckin extends ClearCase private boolean m_Keep = false; private boolean m_Identical = true; - /** * Set comment string * @@ -321,10 +319,10 @@ public class CCCheckin extends ClearCase * Builds a command line to execute cleartool and then calls Exec's run * method to execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -348,11 +346,10 @@ public class CCCheckin extends ClearCase if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } - /** * Get the 'comment' command * @@ -393,7 +390,6 @@ public class CCCheckin extends ClearCase } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java index 123c1d040..a3977bba6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCCheckout.java @@ -6,12 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - - /** * Task to perform Checkout command to ClearCase.

* @@ -408,10 +407,10 @@ public class CCCheckout extends ClearCase * Builds a command line to execute cleartool and then calls Exec's run * method to execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -435,7 +434,7 @@ public class CCCheckout extends ClearCase if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -459,7 +458,6 @@ public class CCCheckout extends ClearCase } } - /** * Get the 'comment' command * @@ -520,7 +518,6 @@ public class CCCheckout extends ClearCase } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java index 96b994bc4..693bd5975 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCUnCheckout.java @@ -6,12 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - - /** * Task to perform UnCheckout command to ClearCase.

* @@ -112,10 +111,10 @@ public class CCUnCheckout extends ClearCase * Builds a command line to execute cleartool and then calls Exec's run * method to execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -139,11 +138,10 @@ public class CCUnCheckout extends ClearCase if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } - /** * Check the command line options. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java index 9d9e5f1de..3cdb5f7e9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/CCUpdate.java @@ -6,12 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; - - /** * Task to perform an Update command to ClearCase.

* @@ -321,10 +320,10 @@ public class CCUpdate extends ClearCase * Builds a command line to execute cleartool and then calls Exec's run * method to execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); Project aProj = getProject(); @@ -352,7 +351,7 @@ public class CCUpdate extends ClearCase if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java index 9f003d69f..941519ab8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/clearcase/ClearCase.java @@ -6,14 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.clearcase; -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.taskdefs.Execute; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; - /** * A base class for creating tasks for executing commands on ClearCase.

* @@ -102,7 +102,6 @@ public abstract class ClearCase extends Task return toReturn; } - protected int run( Commandline cmd ) { try @@ -116,7 +115,7 @@ public abstract class ClearCase extends Task } catch( java.io.IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java index f0479ae8c..aa239a0e1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/ClassFile.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend; + import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; @@ -40,7 +41,6 @@ public class ClassFile */ private ConstantPool constantPool; - /** * Get the classes which this class references. * @@ -57,7 +57,7 @@ public class ClassFile if( entry != null && entry.getTag() == ConstantPoolEntry.CONSTANT_Class ) { - ClassCPInfo classEntry = ( ClassCPInfo )entry; + ClassCPInfo classEntry = (ClassCPInfo)entry; if( !classEntry.getClassName().equals( className ) ) { @@ -112,7 +112,7 @@ public class ClassFile int accessFlags = classStream.readUnsignedShort(); int thisClassIndex = classStream.readUnsignedShort(); int superClassIndex = classStream.readUnsignedShort(); - className = ( ( ClassCPInfo )constantPool.getEntry( thisClassIndex ) ).getClassName(); + className = ( (ClassCPInfo)constantPool.getEntry( thisClassIndex ) ).getClassName(); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java index de4ad9499..2dfd222af 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/ClassFileIterator.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.taskdefs.optional.depend; - public interface ClassFileIterator { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java index e003411d4..174481fa1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/DirectoryIterator.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend; + import java.io.File; import java.io.FileInputStream; import java.io.IOException; @@ -101,7 +102,7 @@ public class DirectoryIterator implements ClassFileIterator { if( currentEnum.hasMoreElements() ) { - File element = ( File )currentEnum.nextElement(); + File element = (File)currentEnum.nextElement(); if( element.isDirectory() ) { @@ -141,7 +142,7 @@ public class DirectoryIterator implements ClassFileIterator } else { - currentEnum = ( Enumeration )enumStack.pop(); + currentEnum = (Enumeration)enumStack.pop(); } } } @@ -174,7 +175,7 @@ public class DirectoryIterator implements ClassFileIterator for( int i = 0; i < length; ++i ) { - files.addElement( new File( directory, filesInDir[i] ) ); + files.addElement( new File( directory, filesInDir[ i ] ) ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java index 1715255bf..cb831d9dc 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/JarFileIterator.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -78,7 +79,7 @@ public class JarFileIterator implements ClassFileIterator private byte[] getEntryBytes( InputStream stream ) throws IOException { - byte[] buffer = new byte[8192]; + byte[] buffer = new byte[ 8192 ]; ByteArrayOutputStream baos = new ByteArrayOutputStream( 2048 ); int n; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java index 919486a22..209c200d1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ClassCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * The constant pool entry which stores class information. * @@ -70,7 +70,7 @@ public class ClassCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - className = ( ( Utf8CPInfo )constantPool.getEntry( index ) ).getValue(); + className = ( (Utf8CPInfo)constantPool.getEntry( index ) ).getValue(); super.resolve( constantPool ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java index f8ba55828..305677313 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantCPInfo.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; - /** * A Constant Pool entry which represents a constant value. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java index ee3131ec3..ab9f2023b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPool.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; import java.util.Enumeration; @@ -67,7 +68,7 @@ public class ConstantPool if( element instanceof ClassCPInfo ) { - ClassCPInfo classinfo = ( ClassCPInfo )element; + ClassCPInfo classinfo = (ClassCPInfo)element; if( classinfo.getClassName().equals( className ) ) { @@ -96,7 +97,7 @@ public class ConstantPool if( element instanceof ConstantCPInfo ) { - ConstantCPInfo constantEntry = ( ConstantCPInfo )element; + ConstantCPInfo constantEntry = (ConstantCPInfo)element; if( constantEntry.getValue().equals( constantValue ) ) { @@ -108,7 +109,6 @@ public class ConstantPool return index; } - /** * Get an constant pool entry at a particular index. * @@ -117,7 +117,7 @@ public class ConstantPool */ public ConstantPoolEntry getEntry( int index ) { - return ( ConstantPoolEntry )entries.elementAt( index ); + return (ConstantPoolEntry)entries.elementAt( index ); } /** @@ -140,10 +140,10 @@ public class ConstantPool if( element instanceof FieldRefCPInfo ) { - FieldRefCPInfo fieldRefEntry = ( FieldRefCPInfo )element; + FieldRefCPInfo fieldRefEntry = (FieldRefCPInfo)element; if( fieldRefEntry.getFieldClassName().equals( fieldClassName ) && fieldRefEntry.getFieldName().equals( fieldName ) - && fieldRefEntry.getFieldType().equals( fieldType ) ) + && fieldRefEntry.getFieldType().equals( fieldType ) ) { index = i; } @@ -175,11 +175,11 @@ public class ConstantPool if( element instanceof InterfaceMethodRefCPInfo ) { - InterfaceMethodRefCPInfo interfaceMethodRefEntry = ( InterfaceMethodRefCPInfo )element; + InterfaceMethodRefCPInfo interfaceMethodRefEntry = (InterfaceMethodRefCPInfo)element; if( interfaceMethodRefEntry.getInterfaceMethodClassName().equals( interfaceMethodClassName ) - && interfaceMethodRefEntry.getInterfaceMethodName().equals( interfaceMethodName ) - && interfaceMethodRefEntry.getInterfaceMethodType().equals( interfaceMethodType ) ) + && interfaceMethodRefEntry.getInterfaceMethodName().equals( interfaceMethodName ) + && interfaceMethodRefEntry.getInterfaceMethodType().equals( interfaceMethodType ) ) { index = i; } @@ -209,10 +209,10 @@ public class ConstantPool if( element instanceof MethodRefCPInfo ) { - MethodRefCPInfo methodRefEntry = ( MethodRefCPInfo )element; + MethodRefCPInfo methodRefEntry = (MethodRefCPInfo)element; if( methodRefEntry.getMethodClassName().equals( methodClassName ) - && methodRefEntry.getMethodName().equals( methodName ) && methodRefEntry.getMethodType().equals( methodType ) ) + && methodRefEntry.getMethodName().equals( methodName ) && methodRefEntry.getMethodType().equals( methodType ) ) { index = i; } @@ -240,7 +240,7 @@ public class ConstantPool if( element instanceof NameAndTypeCPInfo ) { - NameAndTypeCPInfo nameAndTypeEntry = ( NameAndTypeCPInfo )element; + NameAndTypeCPInfo nameAndTypeEntry = (NameAndTypeCPInfo)element; if( nameAndTypeEntry.getName().equals( name ) && nameAndTypeEntry.getType().equals( type ) ) { @@ -262,7 +262,7 @@ public class ConstantPool public int getUTF8Entry( String value ) { int index = -1; - Integer indexInteger = ( Integer )utf8Indexes.get( value ); + Integer indexInteger = (Integer)utf8Indexes.get( value ); if( indexInteger != null ) { @@ -294,7 +294,7 @@ public class ConstantPool if( entry instanceof Utf8CPInfo ) { - Utf8CPInfo utf8Info = ( Utf8CPInfo )entry; + Utf8CPInfo utf8Info = (Utf8CPInfo)entry; utf8Indexes.put( utf8Info.getValue(), new Integer( index ) ); } @@ -314,7 +314,7 @@ public class ConstantPool { int numEntries = classStream.readUnsignedShort(); - for( int i = 1; i < numEntries; ) + for( int i = 1; i < numEntries; ) { ConstantPoolEntry nextEntry = ConstantPoolEntry.readEntry( classStream ); @@ -331,9 +331,9 @@ public class ConstantPool */ public void resolve() { - for( Enumeration i = entries.elements(); i.hasMoreElements(); ) + for( Enumeration i = entries.elements(); i.hasMoreElements(); ) { - ConstantPoolEntry poolInfo = ( ConstantPoolEntry )i.nextElement(); + ConstantPoolEntry poolInfo = (ConstantPoolEntry)i.nextElement(); if( poolInfo != null && !poolInfo.isResolved() ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java index 7e1a89c31..5ab7c7d90 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * An entry in the constant pool. This class contains a represenation of the * constant pool entries. It is an abstract base class for all the different @@ -126,55 +126,55 @@ public abstract class ConstantPoolEntry ConstantPoolEntry cpInfo = null; int cpTag = cpStream.readUnsignedByte(); - switch ( cpTag ) + switch( cpTag ) { - case CONSTANT_Utf8: - cpInfo = new Utf8CPInfo(); + case CONSTANT_Utf8: + cpInfo = new Utf8CPInfo(); - break; - case CONSTANT_Integer: - cpInfo = new IntegerCPInfo(); + break; + case CONSTANT_Integer: + cpInfo = new IntegerCPInfo(); - break; - case CONSTANT_Float: - cpInfo = new FloatCPInfo(); + break; + case CONSTANT_Float: + cpInfo = new FloatCPInfo(); - break; - case CONSTANT_Long: - cpInfo = new LongCPInfo(); + break; + case CONSTANT_Long: + cpInfo = new LongCPInfo(); - break; - case CONSTANT_Double: - cpInfo = new DoubleCPInfo(); + break; + case CONSTANT_Double: + cpInfo = new DoubleCPInfo(); - break; - case CONSTANT_Class: - cpInfo = new ClassCPInfo(); + break; + case CONSTANT_Class: + cpInfo = new ClassCPInfo(); - break; - case CONSTANT_String: - cpInfo = new StringCPInfo(); + break; + case CONSTANT_String: + cpInfo = new StringCPInfo(); - break; - case CONSTANT_FieldRef: - cpInfo = new FieldRefCPInfo(); + break; + case CONSTANT_FieldRef: + cpInfo = new FieldRefCPInfo(); - break; - case CONSTANT_MethodRef: - cpInfo = new MethodRefCPInfo(); + break; + case CONSTANT_MethodRef: + cpInfo = new MethodRefCPInfo(); - break; - case CONSTANT_InterfaceMethodRef: - cpInfo = new InterfaceMethodRefCPInfo(); + break; + case CONSTANT_InterfaceMethodRef: + cpInfo = new InterfaceMethodRefCPInfo(); - break; - case CONSTANT_NameAndType: - cpInfo = new NameAndTypeCPInfo(); + break; + case CONSTANT_NameAndType: + cpInfo = new NameAndTypeCPInfo(); - break; - default: - throw new ClassFormatError( "Invalid Constant Pool entry Type " + cpTag ); + break; + default: + throw new ClassFormatError( "Invalid Constant Pool entry Type " + cpTag ); } cpInfo.read( cpStream ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java index 94122a060..b649e3073 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * The constant pool entry subclass used to represent double constant values. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java index bf56aee85..e4d400fe0 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A FieldRef CP Info * @@ -70,13 +70,13 @@ public class FieldRefCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - ClassCPInfo fieldClass = ( ClassCPInfo )constantPool.getEntry( classIndex ); + ClassCPInfo fieldClass = (ClassCPInfo)constantPool.getEntry( classIndex ); fieldClass.resolve( constantPool ); fieldClassName = fieldClass.getClassName(); - NameAndTypeCPInfo nt = ( NameAndTypeCPInfo )constantPool.getEntry( nameAndTypeIndex ); + NameAndTypeCPInfo nt = (NameAndTypeCPInfo)constantPool.getEntry( nameAndTypeIndex ); nt.resolve( constantPool ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java index affdeefc1..d4778e697 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FloatCPInfo.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java index ce7acbc52..5dd108a68 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/IntegerCPInfo.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java index bc2077fed..81acfb7f3 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InterfaceMethodRefCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A InterfaceMethodRef CP Info * @@ -70,13 +70,13 @@ public class InterfaceMethodRefCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - ClassCPInfo interfaceMethodClass = ( ClassCPInfo )constantPool.getEntry( classIndex ); + ClassCPInfo interfaceMethodClass = (ClassCPInfo)constantPool.getEntry( classIndex ); interfaceMethodClass.resolve( constantPool ); interfaceMethodClassName = interfaceMethodClass.getClassName(); - NameAndTypeCPInfo nt = ( NameAndTypeCPInfo )constantPool.getEntry( nameAndTypeIndex ); + NameAndTypeCPInfo nt = (NameAndTypeCPInfo)constantPool.getEntry( nameAndTypeIndex ); nt.resolve( constantPool ); @@ -98,7 +98,7 @@ public class InterfaceMethodRefCPInfo extends ConstantPoolEntry if( isResolved() ) { value = "InterfaceMethod : Class = " + interfaceMethodClassName + ", name = " + interfaceMethodName + ", type = " - + interfaceMethodType; + + interfaceMethodType; } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java index 12f981faf..8c3a97c30 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/LongCPInfo.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java index a284adcf9..4c85ddb75 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A MethodRef CP Info * @@ -70,13 +70,13 @@ public class MethodRefCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - ClassCPInfo methodClass = ( ClassCPInfo )constantPool.getEntry( classIndex ); + ClassCPInfo methodClass = (ClassCPInfo)constantPool.getEntry( classIndex ); methodClass.resolve( constantPool ); methodClassName = methodClass.getClassName(); - NameAndTypeCPInfo nt = ( NameAndTypeCPInfo )constantPool.getEntry( nameAndTypeIndex ); + NameAndTypeCPInfo nt = (NameAndTypeCPInfo)constantPool.getEntry( nameAndTypeIndex ); nt.resolve( constantPool ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java index 8b769629b..e5a5d9f56 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/NameAndTypeCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A NameAndType CP Info * @@ -65,8 +65,8 @@ public class NameAndTypeCPInfo extends ConstantPoolEntry */ public void resolve( ConstantPool constantPool ) { - name = ( ( Utf8CPInfo )constantPool.getEntry( nameIndex ) ).getValue(); - type = ( ( Utf8CPInfo )constantPool.getEntry( descriptorIndex ) ).getValue(); + name = ( (Utf8CPInfo)constantPool.getEntry( nameIndex ) ).getValue(); + type = ( (Utf8CPInfo)constantPool.getEntry( descriptorIndex ) ).getValue(); super.resolve( constantPool ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java index f65ad291b..9f50ec681 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A String Constant Pool Entry. The String info contains an index into the * constant pool where a UTF8 string is stored. @@ -54,7 +54,7 @@ public class StringCPInfo extends ConstantCPInfo */ public void resolve( ConstantPool constantPool ) { - setValue( ( ( Utf8CPInfo )constantPool.getEntry( index ) ).getValue() ); + setValue( ( (Utf8CPInfo)constantPool.getEntry( index ) ).getValue() ); super.resolve( constantPool ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java index dc42d1984..203f5807c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/depend/constantpool/Utf8CPInfo.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.depend.constantpool; + import java.io.DataInputStream; import java.io.IOException; - /** * A UTF8 Constant Pool Entry. * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java index fabadd12b..305d521ab 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java @@ -6,15 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.dotnet; -import java.io.File;// ==================================================================== -// imports -// ==================================================================== -import org.apache.tools.ant.BuildException; + +import java.io.File; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.types.Path; - // ==================================================================== + /** * This task compiles CSharp source into executables or modules. The task will * only work on win2K until other platforms support csc.exe or an equivalent. @@ -95,7 +94,7 @@ import org.apache.tools.ant.types.Path; */ public class CSharp - extends org.apache.tools.ant.taskdefs.MatchingTask + extends org.apache.tools.ant.taskdefs.MatchingTask { /** @@ -449,11 +448,11 @@ public class CSharp * define the target * * @param targetType The new TargetType value - * @exception BuildException if target is not one of + * @exception TaskException if target is not one of * exe|library|module|winexe */ public void setTargetType( String targetType ) - throws BuildException + throws TaskException { targetType = targetType.toLowerCase(); if( targetType.equals( "exe" ) || targetType.equals( "library" ) || @@ -462,7 +461,7 @@ public class CSharp _targetType = targetType; } else - throw new BuildException( "targetType " + targetType + " is not a valid type" ); + throw new TaskException( "targetType " + targetType + " is not a valid type" ); } /** @@ -643,10 +642,10 @@ public class CSharp /** * do the work by building the command line and then calling it * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { if( _srcDir == null ) _srcDir = resolveFile( "." ); @@ -686,7 +685,7 @@ public class CSharp //add to the command for( int i = 0; i < dependencies.length; i++ ) { - String targetFile = dependencies[i]; + String targetFile = dependencies[ i ]; targetFile = baseDir + File.separator + targetFile; command.addArgument( targetFile ); } @@ -723,7 +722,6 @@ public class CSharp return "/debug" + ( _debug ? "+" : "-" ); } - /** * get default reference list * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java index c5e94ca64..1625cd28d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java @@ -5,15 +5,13 @@ * version 1.1, a copy of which has been included with this distribution in * the LICENSE file. */ -package org.apache.tools.ant.taskdefs.optional.dotnet;// ==================================================================== -// imports -// ==================================================================== +package org.apache.tools.ant.taskdefs.optional.dotnet; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; - /** * Task to assemble .net 'Intermediate Language' files. The task will only work * on win2K until other platforms support csc.exe or an equivalent. ilasm.exe @@ -39,7 +37,7 @@ import org.apache.tools.ant.Project; */ public class Ilasm - extends org.apache.tools.ant.taskdefs.MatchingTask + extends org.apache.tools.ant.taskdefs.MatchingTask { /** @@ -181,7 +179,6 @@ public class Ilasm _outputFile = params; } - /** * Sets the Owner attribute * @@ -217,12 +214,12 @@ public class Ilasm * define the target * * @param targetType one of exe|library| - * @exception BuildException if target is not one of + * @exception TaskException if target is not one of * exe|library|module|winexe */ public void setTargetType( String targetType ) - throws BuildException + throws TaskException { targetType = targetType.toLowerCase(); if( targetType.equals( "exe" ) || targetType.equals( "library" ) ) @@ -230,7 +227,7 @@ public class Ilasm _targetType = targetType; } else - throw new BuildException( "targetType " + targetType + " is not a valid type" ); + throw new TaskException( "targetType " + targetType + " is not a valid type" ); } /** @@ -299,15 +296,14 @@ public class Ilasm _extraOptions = null; } - /** * This is the execution entry point. Build a list of files and call ilasm * on each of them. * - * @throws BuildException if the assembly failed and FailOnError is true + * @throws TaskException if the assembly failed and FailOnError is true */ public void execute() - throws BuildException + throws TaskException { if( _srcDir == null ) _srcDir = resolveFile( "." ); @@ -320,22 +316,21 @@ public class Ilasm //add to the command for( int i = 0; i < dependencies.length; i++ ) { - String targetFile = dependencies[i]; + String targetFile = dependencies[ i ]; targetFile = baseDir + File.separator + targetFile; executeOneFile( targetFile ); } }// end execute - /** * do the work for one file by building the command line then calling it * * @param targetFile name of the the file to assemble - * @throws BuildException if the assembly failed and FailOnError is true + * @throws TaskException if the assembly failed and FailOnError is true */ public void executeOneFile( String targetFile ) - throws BuildException + throws TaskException { NetCommand command = new NetCommand( this, exe_title, exe_name ); command.setFailOnError( getFailFailOnError() ); @@ -444,8 +439,7 @@ public class Ilasm return null; if( _targetType.equals( "exe" ) ) return "/exe"; - else - if( _targetType.equals( "library" ) ) + else if( _targetType.equals( "library" ) ) return "/dll"; else return null; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java index 74ed0e33e..0cd68c4de 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.dotnet;// imports + 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.taskdefs.Execute; @@ -16,7 +17,6 @@ import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; - /** * This is a helper class to spawn net commands out. In its initial form it * contains no .net specifics, just contains all the command line/exe @@ -133,12 +133,12 @@ public class NetCommand /** * Run the command using the given Execute instance. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @throws an exception of something goes wrong and the failOnError flag is * true */ public void runCommand() - throws BuildException + throws TaskException { int err = -1;// assume the worst try @@ -158,7 +158,7 @@ public class NetCommand { if( _failOnError ) { - throw new BuildException( _title + " returned: " + err ); + throw new TaskException( _title + " returned: " + err ); } else { @@ -168,11 +168,10 @@ public class NetCommand } catch( IOException e ) { - throw new BuildException( _title + " failed: " + e, e ); + throw new TaskException( _title + " failed: " + e, e ); } } - /** * error text log * @@ -201,7 +200,7 @@ public class NetCommand // default directory to the project's base directory File dir = _owner.getProject().getBaseDir(); ExecuteStreamHandler handler = new LogStreamHandler( _owner, - Project.MSG_INFO, Project.MSG_WARN ); + Project.MSG_INFO, Project.MSG_WARN ); _exe = new Execute( handler, null ); _exe.setAntRun( _owner.getProject() ); _exe.setWorkingDirectory( dir ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java index 5f37ba9c4..378c5d1ce 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -15,7 +16,7 @@ import java.io.OutputStream; import java.util.Hashtable; import java.util.Iterator; 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.taskdefs.Execute; import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; @@ -23,7 +24,6 @@ import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; - /** * BorlandDeploymentTool is dedicated to the Borland Application Server 4.5 and * 4.5.1 This task generates and compiles the stubs and skeletons for all ejb @@ -60,13 +60,13 @@ import org.apache.tools.ant.types.Path; public class BorlandDeploymentTool extends GenericDeploymentTool implements ExecuteStreamHandler { public final static String PUBLICID_BORLAND_EJB - = "-//Inprise Corporation//DTD Enterprise JavaBeans 1.1//EN"; + = "-//Inprise Corporation//DTD Enterprise JavaBeans 1.1//EN"; protected final static String DEFAULT_BAS45_EJB11_DTD_LOCATION - = "/com/inprise/j2ee/xml/dtds/ejb-jar.dtd"; + = "/com/inprise/j2ee/xml/dtds/ejb-jar.dtd"; protected final static String DEFAULT_BAS_DTD_LOCATION - = "/com/inprise/j2ee/xml/dtds/ejb-inprise.dtd"; + = "/com/inprise/j2ee/xml/dtds/ejb-inprise.dtd"; protected final static String BAS_DD = "ejb-inprise.xml"; @@ -130,7 +130,6 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec this.java2iiopdebug = debug; } - /** * setter used to store whether the task will include the generate client * task. (see : BorlandGenerateClient task) @@ -158,7 +157,9 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec } public void setProcessInputStream( OutputStream param1 ) - throws IOException { } + throws IOException + { + } /** * @param is @@ -188,11 +189,10 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec catch( Exception e ) { String msg = "Exception while parsing java2iiop output. Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } - /** * Setter used to store the suffix for the generated borland jar file. * @@ -213,7 +213,6 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec this.verify = verify; } - /** * sets some additional args to send to verify command * @@ -227,10 +226,13 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec // implementation of org.apache.tools.ant.taskdefs.ExecuteStreamHandler interface public void start() - throws IOException { } - - public void stop() { } + throws IOException + { + } + public void stop() + { + } protected DescriptorHandler getBorlandDescriptorHandler( final File srcDir ) { @@ -245,7 +247,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String fileNameWithMETA = currentText; //trim the META_INF\ off of the file name String fileName = fileNameWithMETA.substring( META_DIR.length(), - fileNameWithMETA.length() ); + fileNameWithMETA.length() ); File descriptorFile = new File( srcDir, fileName ); ejbFiles.put( fileNameWithMETA, descriptorFile ); @@ -253,11 +255,11 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec } }; handler.registerDTD( PUBLICID_BORLAND_EJB, - borlandDTD == null ? DEFAULT_BAS_DTD_LOCATION : borlandDTD ); + borlandDTD == null ? DEFAULT_BAS_DTD_LOCATION : borlandDTD ); - for( Iterator i = getConfig().dtdLocations.iterator(); i.hasNext(); ) + for( Iterator i = getConfig().dtdLocations.iterator(); i.hasNext(); ) { - EjbJar.DTDLocation dtdLocation = ( EjbJar.DTDLocation )i.next(); + EjbJar.DTDLocation dtdLocation = (EjbJar.DTDLocation)i.next(); handler.registerDTD( dtdLocation.getPublicId(), dtdLocation.getLocation() ); } return handler; @@ -281,7 +283,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec else { log( "Unable to locate borland deployment descriptor. It was expected to be in " + - borlandDD.getPath(), Project.MSG_WARN ); + borlandDD.getPath(), Project.MSG_WARN ); return; } } @@ -295,17 +297,17 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec * @param jarFile Description of Parameter * @param files Description of Parameter * @param publicId Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void writeJar( String baseName, File jarFile, Hashtable files, String publicId ) - throws BuildException + throws TaskException { //build the home classes list. Vector homes = new Vector(); Iterator it = files.keySet().iterator(); while( it.hasNext() ) { - String clazz = ( String )it.next(); + String clazz = (String)it.next(); if( clazz.endsWith( "Home.class" ) ) { //remove .class extension @@ -396,13 +398,13 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec if( result != 0 ) { String msg = "Failed executing java2iiop (ret code is " + result + ")"; - throw new BuildException( msg ); + throw new TaskException( msg ); } } catch( java.io.IOException e ) { log( "java2iiop exception :" + e.getMessage(), Project.MSG_ERR ); - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } @@ -415,7 +417,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec private void generateClient( File sourceJar ) { getTask().getProject().addTaskDefinition( "internal_bas_generateclient", - org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class ); + org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient.class ); org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient gentask = null; log( "generate client for " + sourceJar, Project.MSG_INFO ); @@ -424,7 +426,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String args = verifyArgs; args += " " + sourceJar.getPath(); - gentask = ( BorlandGenerateClient )getTask().getProject().createTask( "internal_bas_generateclient" ); + gentask = (BorlandGenerateClient)getTask().getProject().createTask( "internal_bas_generateclient" ); gentask.setEjbjar( sourceJar ); gentask.setDebug( java2iiopdebug ); Path classpath = getCombinedClasspath(); @@ -439,7 +441,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec { //TO DO : delete the file if it is not a valid file. String msg = "Exception while calling " + VERIFY + " Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } @@ -487,7 +489,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec String args = verifyArgs; args += " " + sourceJar.getPath(); - javaTask = ( Java )getTask().getProject().createTask( "java" ); + javaTask = (Java)getTask().getProject().createTask( "java" ); javaTask.setTaskName( "verify" ); javaTask.setClassname( VERIFY ); Commandline.Argument arguments = javaTask.createArg(); @@ -506,7 +508,7 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exec { //TO DO : delete the file if it is not a valid file. String msg = "Exception while calling " + VERIFY + " Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java index 1dab7dd20..52abf8e41 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/BorlandGenerateClient.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + 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; import org.apache.tools.ant.taskdefs.ExecTask; @@ -15,7 +16,6 @@ import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; - /** * BorlandGenerateClient is dedicated to the Borland Application Server 4.5 This * task generates the client jar using as input the ejb jar file. Two mode are @@ -100,20 +100,19 @@ public class BorlandGenerateClient extends Task return this.classpath.createPath(); } - /** * Do the work. The work is actually done by creating a separate JVM to run * a java task. * - * @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( ejbjarfile == null || ejbjarfile.isDirectory() ) { - throw new BuildException( "invalid ejb jar file." ); + throw new TaskException( "invalid ejb jar file." ); }// end of if () if( clientjarfile == null || @@ -149,17 +148,17 @@ public class BorlandGenerateClient extends Task /** * launch the generate client using system api * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void executeFork() - throws BuildException + throws TaskException { try { log( "mode : fork" ); org.apache.tools.ant.taskdefs.ExecTask execTask = null; - execTask = ( ExecTask )getProject().createTask( "exec" ); + execTask = (ExecTask)getProject().createTask( "exec" ); execTask.setDir( new File( "." ) ); execTask.setExecutable( "iastool" ); @@ -186,7 +185,7 @@ public class BorlandGenerateClient extends Task { // Have to catch this because of the semantics of calling main() String msg = "Exception while calling generateclient Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } @@ -194,17 +193,17 @@ public class BorlandGenerateClient extends Task /** * launch the generate client using java api * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void executeJava() - throws BuildException + throws TaskException { try { log( "mode : java" ); org.apache.tools.ant.taskdefs.Java execTask = null; - execTask = ( Java )getProject().createTask( "java" ); + execTask = (Java)getProject().createTask( "java" ); execTask.setDir( new File( "." ) ); execTask.setClassname( "com.inprise.server.commandline.EJBUtilities" ); @@ -238,7 +237,7 @@ public class BorlandGenerateClient extends Task { // Have to catch this because of the semantics of calling main() String msg = "Exception while calling generateclient Details: " + e.toString(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java index 25218e180..0d54b678c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreator.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; @@ -86,22 +87,22 @@ public class DDCreator extends MatchingTask * interfaces to be available in the classpath, this also avoids having to * start ant with the class path of the project it is building. * - * @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( descriptorDirectory == null || !descriptorDirectory.isDirectory() ) { - throw new BuildException( "descriptors directory " + descriptorDirectory.getPath() + - " is not valid" ); + throw new TaskException( "descriptors directory " + descriptorDirectory.getPath() + + " is not valid" ); } if( generatedFilesDirectory == null || !generatedFilesDirectory.isDirectory() ) { - throw new BuildException( "dest directory " + generatedFilesDirectory.getPath() + - " is not valid" ); + throw new TaskException( "dest directory " + generatedFilesDirectory.getPath() + + " is not valid" ); } String args = descriptorDirectory + " " + generatedFilesDirectory; @@ -113,12 +114,12 @@ public class DDCreator extends MatchingTask for( int i = 0; i < files.length; ++i ) { - args += " " + files[i]; + args += " " + files[ i ]; } String systemClassPath = System.getProperty( "java.class.path" ); String execClassPath = project.translatePath( systemClassPath + ":" + classpath ); - Java ddCreatorTask = ( Java )project.createTask( "java" ); + Java ddCreatorTask = (Java)project.createTask( "java" ); ddCreatorTask.setTaskName( getTaskName() ); ddCreatorTask.setFork( true ); ddCreatorTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper" ); @@ -127,7 +128,7 @@ public class DDCreator extends MatchingTask ddCreatorTask.setClasspath( new Path( project, execClassPath ) ); if( ddCreatorTask.executeJava() != 0 ) { - throw new BuildException( "Execution of ddcreator helper failed" ); + throw new TaskException( "Execution of ddcreator helper failed" ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreatorHelper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreatorHelper.java index f59a3288c..904bc278c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreatorHelper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DDCreatorHelper.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.FileInputStream; import java.io.ObjectInputStream; @@ -48,13 +49,13 @@ public class DDCreatorHelper private DDCreatorHelper( String[] args ) { int index = 0; - descriptorDirectory = new File( args[index++] ); - generatedFilesDirectory = new File( args[index++] ); + descriptorDirectory = new File( args[ index++ ] ); + generatedFilesDirectory = new File( args[ index++ ] ); - descriptors = new String[args.length - index]; + descriptors = new String[ args.length - index ]; for( int i = 0; index < args.length; ++i ) { - descriptors[i] = args[index++]; + descriptors[ i ] = args[ index++ ]; } } @@ -85,7 +86,7 @@ public class DDCreatorHelper { for( int i = 0; i < descriptors.length; ++i ) { - String descriptorName = descriptors[i]; + String descriptorName = descriptors[ i ]; File descriptorFile = new File( descriptorDirectory, descriptorName ); int extIndex = descriptorName.lastIndexOf( "." ); @@ -102,13 +103,13 @@ public class DDCreatorHelper // do we need to regenerate the file if( !serFile.exists() || serFile.lastModified() < descriptorFile.lastModified() - || regenerateSerializedFile( serFile ) ) + || regenerateSerializedFile( serFile ) ) { String[] args = {"-noexit", - "-d", serFile.getParent(), - "-outputfile", serFile.getName(), - descriptorFile.getPath()}; + "-d", serFile.getParent(), + "-outputfile", serFile.getName(), + descriptorFile.getPath()}; try { weblogic.ejb.utils.DDCreator.main( args ); @@ -117,8 +118,8 @@ public class DDCreatorHelper { // there was an exception - run with no exit to get proper error String[] newArgs = {"-d", generatedFilesDirectory.getPath(), - "-outputfile", serFile.getName(), - descriptorFile.getPath()}; + "-outputfile", serFile.getName(), + descriptorFile.getPath()}; weblogic.ejb.utils.DDCreator.main( newArgs ); } } @@ -141,7 +142,7 @@ public class DDCreatorHelper FileInputStream fis = new FileInputStream( serFile ); ObjectInputStream ois = new ObjectInputStream( fis ); - DeploymentDescriptor dd = ( DeploymentDescriptor )ois.readObject(); + DeploymentDescriptor dd = (DeploymentDescriptor)ois.readObject(); fis.close(); // Since the descriptor read properly, everything should be o.k. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java index 4f0a226cc..594939eca 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -164,7 +165,6 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase currentText += new String( ch, start, length ); } - /** * SAX parser call-back method that is invoked when an element is exited. * Used to blank out (set to the empty string, not nullify) the name of the @@ -255,7 +255,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { this.publicId = publicId; - File dtdFile = ( File )fileDTDs.get( publicId ); + File dtdFile = (File)fileDTDs.get( publicId ); if( dtdFile != null ) { try @@ -269,7 +269,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } } - String dtdResourceName = ( String )resourceDTDs.get( publicId ); + String dtdResourceName = (String)resourceDTDs.get( publicId ); if( dtdResourceName != null ) { InputStream is = this.getClass().getResourceAsStream( dtdResourceName ); @@ -280,7 +280,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } } - URL dtdUrl = ( URL )urlDTDs.get( publicId ); + URL dtdUrl = (URL)urlDTDs.get( publicId ); if( dtdUrl != null ) { try @@ -296,7 +296,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } owningTask.log( "Could not resolve ( publicId: " + publicId + ", systemId: " + systemId + ") to a local entity", - Project.MSG_INFO ); + Project.MSG_INFO ); return null; } @@ -315,7 +315,6 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase inEJBRef = false; } - /** * SAX parser call-back method that is invoked when a new element is entered * into. Used to store the context (attribute name) in the currentAttribute @@ -356,7 +355,6 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase } } - protected void processElement() { if( inEJBRef || diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java index 147faed55..72328b94b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EJBDeploymentTool.java @@ -6,11 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import javax.xml.parsers.SAXParser; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; - public interface EJBDeploymentTool { /** @@ -20,18 +20,18 @@ public interface EJBDeploymentTool * @param descriptorFilename the name of the deployment descriptor * @param saxParser a SAX parser which can be used to parse the deployment * descriptor. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void processDescriptor( String descriptorFilename, SAXParser saxParser ) - throws BuildException; + throws TaskException; /** * Called to validate that the tool parameters have been configured. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void validateConfigured() - throws BuildException; + throws TaskException; /** * Set the task which owns this tool diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java index df7aa90bb..be80ac4e5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbJar.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb;// Standard java imports + import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import javax.xml.parsers.ParserConfigurationException;// XML imports +import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory;// Apache/Ant imports -import org.apache.tools.ant.BuildException; +import javax.xml.parsers.SAXParserFactory; +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; @@ -94,8 +95,8 @@ public class EjbJar extends MatchingTask } else if( !config.namingScheme.getValue().equals( NamingScheme.BASEJARNAME ) ) { - throw new BuildException( "The basejarname attribute is not compatible with the " + - config.namingScheme.getValue() + " naming scheme" ); + throw new TaskException( "The basejarname attribute is not compatible with the " + + config.namingScheme.getValue() + " naming scheme" ); } } @@ -137,7 +138,6 @@ public class EjbJar extends MatchingTask config.descriptorDir = inDir; } - /** * Set the destination directory. The EJB jar files will be written into * this directory. The jar files that exist in this directory are also used @@ -183,7 +183,6 @@ public class EjbJar extends MatchingTask this.genericJarSuffix = inString; } - /** * Set the Manifest file to use when jarring. As of EJB 1.1, manifest files * are no longer used to configure the EJB. However, they still have a vital @@ -212,8 +211,8 @@ public class EjbJar extends MatchingTask if( !config.namingScheme.getValue().equals( NamingScheme.BASEJARNAME ) && config.baseJarName != null ) { - throw new BuildException( "The basejarname attribute is not compatible with the " + - config.namingScheme.getValue() + " naming scheme" ); + throw new TaskException( "The basejarname attribute is not compatible with the " + + config.namingScheme.getValue() + " naming scheme" ); } } @@ -368,12 +367,12 @@ public class EjbJar extends MatchingTask * configured and then each descriptor found is passed to all the deployment * tool elements for processing. * - * @exception BuildException thrown whenever a problem is encountered that + * @exception TaskException thrown whenever a problem is encountered that * cannot be recovered from, to signal to ant that a major problem * occurred within this task. */ public void execute() - throws BuildException + throws TaskException { validateConfig(); @@ -386,9 +385,9 @@ public class EjbJar extends MatchingTask deploymentTools.add( genericTool ); } - for( Iterator i = deploymentTools.iterator(); i.hasNext(); ) + for( Iterator i = deploymentTools.iterator(); i.hasNext(); ) { - EJBDeploymentTool tool = ( EJBDeploymentTool )i.next(); + EJBDeploymentTool tool = (EJBDeploymentTool)i.next(); tool.configure( config ); tool.validateConfigured(); } @@ -405,32 +404,32 @@ public class EjbJar extends MatchingTask String[] files = ds.getIncludedFiles(); log( files.length + " deployment descriptors located.", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); // Loop through the files. Each file represents one deployment // descriptor, and hence one bean in our model. for( int index = 0; index < files.length; ++index ) { // process the deployment descriptor in each tool - for( Iterator i = deploymentTools.iterator(); i.hasNext(); ) + for( Iterator i = deploymentTools.iterator(); i.hasNext(); ) { - EJBDeploymentTool tool = ( EJBDeploymentTool )i.next(); - tool.processDescriptor( files[index], saxParser ); + EJBDeploymentTool tool = (EJBDeploymentTool)i.next(); + tool.processDescriptor( files[ index ], saxParser ); } } } catch( SAXException se ) { String msg = "SAXException while creating parser." - + " Details: " - + se.getMessage(); - throw new BuildException( msg, se ); + + " Details: " + + se.getMessage(); + throw new TaskException( msg, se ); } catch( ParserConfigurationException pce ) { String msg = "ParserConfigurationException while creating parser. " - + "Details: " + pce.getMessage(); - throw new BuildException( msg, pce ); + + "Details: " + pce.getMessage(); + throw new TaskException( msg, pce ); } } @@ -438,7 +437,7 @@ public class EjbJar extends MatchingTask { if( config.srcDir == null ) { - throw new BuildException( "The srcDir attribute must be specified" ); + throw new TaskException( "The srcDir attribute must be specified" ); } if( config.descriptorDir == null ) @@ -454,8 +453,8 @@ public class EjbJar extends MatchingTask else if( config.namingScheme.getValue().equals( NamingScheme.BASEJARNAME ) && config.baseJarName == null ) { - throw new BuildException( "The basejarname attribute must be specified " + - "with the basejarname naming scheme" ); + throw new TaskException( "The basejarname attribute must be specified " + + "with the basejarname naming scheme" ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java index 0041c3756..43f44ff22 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/Ejbc.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; @@ -132,40 +133,40 @@ public class Ejbc extends MatchingTask * avoids having to start ant with the class path of the project it is * building. * - * @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( descriptorDirectory == null || !descriptorDirectory.isDirectory() ) { - throw new BuildException( "descriptors directory " + descriptorDirectory.getPath() + - " is not valid" ); + throw new TaskException( "descriptors directory " + descriptorDirectory.getPath() + + " is not valid" ); } if( generatedFilesDirectory == null || !generatedFilesDirectory.isDirectory() ) { - throw new BuildException( "dest directory " + generatedFilesDirectory.getPath() + - " is not valid" ); + throw new TaskException( "dest directory " + generatedFilesDirectory.getPath() + + " is not valid" ); } if( sourceDirectory == null || !sourceDirectory.isDirectory() ) { - throw new BuildException( "src directory " + sourceDirectory.getPath() + - " is not valid" ); + throw new TaskException( "src directory " + sourceDirectory.getPath() + + " is not valid" ); } String systemClassPath = System.getProperty( "java.class.path" ); String execClassPath = project.translatePath( systemClassPath + ":" + classpath + - ":" + generatedFilesDirectory ); + ":" + generatedFilesDirectory ); // get all the files in the descriptor directory DirectoryScanner ds = super.getDirectoryScanner( descriptorDirectory ); String[] files = ds.getIncludedFiles(); - Java helperTask = ( Java )project.createTask( "java" ); + Java helperTask = (Java)project.createTask( "java" ); helperTask.setTaskName( getTaskName() ); helperTask.setFork( true ); helperTask.setClassname( "org.apache.tools.ant.taskdefs.optional.ejb.EjbcHelper" ); @@ -178,7 +179,7 @@ public class Ejbc extends MatchingTask for( int i = 0; i < files.length; ++i ) { - args += " " + files[i]; + args += " " + files[ i ]; } Commandline.Argument arguments = helperTask.createArg(); @@ -186,7 +187,7 @@ public class Ejbc extends MatchingTask helperTask.setClasspath( new Path( project, execClassPath ) ); if( helperTask.executeJava() != 0 ) { - throw new BuildException( "Execution of ejbc helper failed" ); + throw new TaskException( "Execution of ejbc helper failed" ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java index 73b2ed414..fc4cf1b01 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/EjbcHelper.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; @@ -16,7 +17,6 @@ import java.util.Vector; import javax.ejb.deployment.DeploymentDescriptor; import javax.ejb.deployment.EntityDescriptor; - /** * A helper class which performs the actual work of the ejbc task. This class is * run with a classpath which includes the weblogic tools and the home and @@ -72,16 +72,16 @@ public class EjbcHelper private EjbcHelper( String[] args ) { int index = 0; - descriptorDirectory = new File( args[index++] ); - generatedFilesDirectory = new File( args[index++] ); - sourceDirectory = new File( args[index++] ); - manifestFile = new File( args[index++] ); - keepGenerated = Boolean.valueOf( args[index++] ).booleanValue(); + descriptorDirectory = new File( args[ index++ ] ); + generatedFilesDirectory = new File( args[ index++ ] ); + sourceDirectory = new File( args[ index++ ] ); + manifestFile = new File( args[ index++ ] ); + keepGenerated = Boolean.valueOf( args[ index++ ] ).booleanValue(); - descriptors = new String[args.length - index]; + descriptors = new String[ args.length - index ]; for( int i = 0; index < args.length; ++i ) { - descriptors[i] = args[index++]; + descriptors[ i ] = args[ index++ ]; } } @@ -113,7 +113,7 @@ public class EjbcHelper v.addElement( generatedFilesDirectory.getPath() ); v.addElement( descriptorFile.getPath() ); - String[] args = new String[v.size()]; + String[] args = new String[ v.size() ]; v.copyInto( args ); return args; } @@ -142,7 +142,7 @@ public class EjbcHelper { fis = new FileInputStream( descriptorFile ); ObjectInputStream ois = new ObjectInputStream( fis ); - DeploymentDescriptor dd = ( DeploymentDescriptor )ois.readObject(); + DeploymentDescriptor dd = (DeploymentDescriptor)ois.readObject(); fis.close(); String homeInterfacePath = dd.getHomeInterfaceClassName().replace( '.', '/' ) + ".java"; @@ -150,7 +150,7 @@ public class EjbcHelper String primaryKeyClassPath = null; if( dd instanceof EntityDescriptor ) { - primaryKeyClassPath = ( ( EntityDescriptor )dd ).getPrimaryKeyClassName().replace( '.', '/' ) + ".java"; + primaryKeyClassPath = ( (EntityDescriptor)dd ).getPrimaryKeyClassName().replace( '.', '/' ) + ".java"; ; } @@ -167,11 +167,11 @@ public class EjbcHelper // of the above or the .ser file itself. String beanClassBase = dd.getEnterpriseBeanClassName().replace( '.', '/' ); File ejbImplentationClass - = new File( generatedFilesDirectory, beanClassBase + "EOImpl.class" ); + = new File( generatedFilesDirectory, beanClassBase + "EOImpl.class" ); File homeImplementationClass - = new File( generatedFilesDirectory, beanClassBase + "HomeImpl.class" ); + = new File( generatedFilesDirectory, beanClassBase + "HomeImpl.class" ); File beanStubClass - = new File( generatedFilesDirectory, beanClassBase + "EOImpl_WLStub.class" ); + = new File( generatedFilesDirectory, beanClassBase + "EOImpl_WLStub.class" ); // if the implementation classes don;t exist regenerate if( !ejbImplentationClass.exists() || !homeImplementationClass.exists() || @@ -234,7 +234,7 @@ public class EjbcHelper String manifest = "Manifest-Version: 1.0\n\n"; for( int i = 0; i < descriptors.length; ++i ) { - String descriptorName = descriptors[i]; + String descriptorName = descriptors[ i ]; File descriptorFile = new File( descriptorDirectory, descriptorName ); if( isRegenRequired( descriptorFile ) ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java index e152ef97e..91961f7dd 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java @@ -27,7 +27,6 @@ import org.apache.bcel.*; import org.apache.bcel.classfile.*; 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.Location; import org.apache.tools.ant.Project; @@ -279,7 +278,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool + "'. This probably indicates badly-formed XML." + " Details: " + se.getMessage(); - throw new BuildException( msg, se ); + throw new TaskException( msg, se ); } catch( IOException ioe ) { @@ -288,23 +287,23 @@ public class GenericDeploymentTool implements EJBDeploymentTool + "'. This probably indicates that the descriptor" + " doesn't exist. Details: " + ioe.getMessage(); - throw new BuildException( msg, ioe ); + throw new TaskException( msg, ioe ); } } /** * Called to validate that the tool parameters have been configured. * - * @throws BuildException If the Deployment Tool's configuration isn't valid + * @throws TaskException If the Deployment Tool's configuration isn't valid */ public void validateConfigured() - throws BuildException + throws TaskException { if( ( destDir == null ) || ( !destDir.isDirectory() ) ) { String msg = "A valid destination directory must be specified " + "using the \"destdir\" attribute."; - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -499,12 +498,12 @@ public class GenericDeploymentTool implements EJBDeploymentTool * @param logicalFilename A String representing the name, including all * relevant path information, that should be stored for the entry being * added. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void addFileToJar( JarOutputStream jStream, File inputFile, String logicalFilename ) - throws BuildException + throws TaskException { FileInputStream iStream = null; try @@ -593,10 +592,10 @@ public class GenericDeploymentTool implements EJBDeploymentTool * * @param checkEntries files, that are extracted from the deployment * descriptor - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkAndAddDependants( Hashtable checkEntries ) - throws BuildException + throws TaskException { Dependencies visitor = new Dependencies(); Set set = new TreeSet(); @@ -659,22 +658,22 @@ public class GenericDeploymentTool implements EJBDeploymentTool * This method is called as the first step in the processDescriptor method * to allow vendor-specific subclasses to validate the task configuration * prior to processing the descriptor. If the configuration is invalid, a - * BuildException should be thrown. + * TaskException should be thrown. * * @param descriptorFileName String representing the file name of an EJB * descriptor to be processed * @param saxParser SAXParser which may be used to parse the XML descriptor - * @exception BuildException Description of Exception - * @thows BuildException Thrown if the configuration is invalid + * @exception TaskException Description of Exception + * @thows TaskException Thrown if the configuration is invalid */ protected void checkConfiguration( String descriptorFileName, SAXParser saxParser ) - throws BuildException + throws TaskException { /* * For the GenericDeploymentTool, do nothing. Vendor specific - * subclasses should throw a BuildException if the configuration is + * subclasses should throw a TaskException if the configuration is * invalid for their server. */ } @@ -816,11 +815,11 @@ public class GenericDeploymentTool implements EJBDeploymentTool * @param jarfile Description of Parameter * @param files Description of Parameter * @param publicId Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void writeJar( String baseName, File jarfile, Hashtable files, String publicId ) - throws BuildException + throws TaskException { JarOutputStream jarStream = null; @@ -856,7 +855,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool in = new FileInputStream( config.manifest ); if( in == null ) { - throw new BuildException( "Could not find manifest file: " + config.manifest ); + throw new TaskException( "Could not find manifest file: " + config.manifest ); } } else @@ -865,7 +864,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool in = this.getClass().getResourceAsStream( defaultManifest ); if( in == null ) { - throw new BuildException( "Could not find default manifest: " + defaultManifest ); + throw new TaskException( "Could not find default manifest: " + defaultManifest ); } } @@ -873,7 +872,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool } catch( IOException e ) { - throw new BuildException( "Unable to read manifest", e ); + throw new TaskException( "Unable to read manifest", e ); } finally { @@ -933,7 +932,7 @@ public class GenericDeploymentTool implements EJBDeploymentTool + jarfile.toString() + "'. Details: " + ioe.getMessage(); - throw new BuildException( msg, ioe ); + throw new TaskException( msg, ioe ); } finally { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java index 8c647dc47..5ac9306c1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.IOException; import java.util.Hashtable; import javax.xml.parsers.SAXParser; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.xml.sax.SAXException; @@ -122,7 +123,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool log( "Since a generic JAR file is not created during processing, the " + "iPlanet Deployment Tool does not support the " + "\"genericjarsuffix\" attribute. It will be ignored.", - Project.MSG_WARN ); + Project.MSG_WARN ); } /** @@ -194,7 +195,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool protected void addVendorFiles( Hashtable ejbFiles, String ddPrefix ) { ejbFiles.put( META_DIR + IAS_DD, new File( getConfig().descriptorDir, - getIasDescriptorName() ) ); + getIasDescriptorName() ) ); } /** @@ -203,11 +204,11 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool * @param descriptorFileName String representing the file name of an EJB * descriptor to be processed * @param saxParser SAXParser which may be used to parse the XML descriptor - * @throws BuildException If the user selections are invalid. + * @throws TaskException If the user selections are invalid. */ protected void checkConfiguration( String descriptorFileName, SAXParser saxParser ) - throws BuildException + throws TaskException { int startOfName = descriptorFileName.lastIndexOf( File.separatorChar ) + 1; @@ -215,26 +216,26 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool if( stdXml.equals( EJB_DD ) && ( getConfig().baseJarName == null ) ) { String msg = "No name specified for the completed JAR file. The EJB" - + " descriptor should be prepended with the JAR " - + "name or it should be specified using the " - + "attribute \"basejarname\" in the \"ejbjar\" task."; - throw new BuildException( msg ); + + " descriptor should be prepended with the JAR " + + "name or it should be specified using the " + + "attribute \"basejarname\" in the \"ejbjar\" task."; + throw new TaskException( msg ); } File iasDescriptor = new File( getConfig().descriptorDir, - getIasDescriptorName() ); + getIasDescriptorName() ); if( ( !iasDescriptor.exists() ) || ( !iasDescriptor.isFile() ) ) { String msg = "The iAS-specific EJB descriptor (" - + iasDescriptor + ") was not found."; - throw new BuildException( msg ); + + iasDescriptor + ") was not found."; + throw new TaskException( msg ); } if( ( iashome != null ) && ( !iashome.isDirectory() ) ) { String msg = "If \"iashome\" is specified, it must be a valid " - + "directory (it was set to " + iashome + ")."; - throw new BuildException( msg ); + + "directory (it was set to " + iashome + ")."; + throw new TaskException( msg ); } } @@ -264,9 +265,9 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool */ IPlanetEjbc ejbc = new IPlanetEjbc( new File( getConfig().descriptorDir, - descriptorFileName ), + descriptorFileName ), new File( getConfig().descriptorDir, - getIasDescriptorName() ), + getIasDescriptorName() ), getConfig().srcDir, getCombinedClasspath().toString(), saxParser ); @@ -286,8 +287,8 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool } catch( IPlanetEjbc.EjbcException e ) { - throw new BuildException( "An error has occurred while trying to " - + "execute the iAS ejbc utility", e ); + throw new TaskException( "An error has occurred while trying to " + + "execute the iAS ejbc utility", e ); } displayName = ejbc.getDisplayName(); @@ -306,16 +307,16 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool for( int i = 0; i < cmpDescriptors.length; i++ ) { - int endOfCmp = cmpDescriptors[i].lastIndexOf( '/' ); - String cmpDescriptor = cmpDescriptors[i].substring( endOfCmp + 1 ); + int endOfCmp = cmpDescriptors[ i ].lastIndexOf( '/' ); + String cmpDescriptor = cmpDescriptors[ i ].substring( endOfCmp + 1 ); File cmpFile = new File( baseDir, relativePath + cmpDescriptor ); if( !cmpFile.exists() ) { - throw new BuildException( "The CMP descriptor file (" - + cmpFile + ") could not be found." ); + throw new TaskException( "The CMP descriptor file (" + + cmpFile + ") could not be found." ); } - files.put( cmpDescriptors[i], cmpFile ); + files.put( cmpDescriptors[ i ], cmpFile ); } } @@ -398,7 +399,7 @@ public class IPlanetDeploymentTool extends GenericDeploymentTool } basename = descriptorName.substring( startOfFileName + 1, - endOfBaseName + 1 ); + endOfBaseName + 1 ); remainder = descriptorName.substring( endOfBaseName + 1 ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java index 8c3b18d60..ec84225a6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -145,13 +146,13 @@ public class IPlanetEjbc if( classpath != null ) { StringTokenizer st = new StringTokenizer( classpath, - File.pathSeparator ); + File.pathSeparator ); while( st.hasMoreTokens() ) { elements.add( st.nextToken() ); } classpathElements - = ( String[] )elements.toArray( new String[elements.size()] ); + = (String[])elements.toArray( new String[ elements.size() ] ); } } @@ -179,24 +180,24 @@ public class IPlanetEjbc return; } - stdDescriptor = new File( args[args.length - 2] ); - iasDescriptor = new File( args[args.length - 1] ); + stdDescriptor = new File( args[ args.length - 2 ] ); + iasDescriptor = new File( args[ args.length - 1 ] ); for( int i = 0; i < args.length - 2; i++ ) { - if( args[i].equals( "-classpath" ) ) + if( args[ i ].equals( "-classpath" ) ) { - classpath = args[++i]; + classpath = args[ ++i ]; } - else if( args[i].equals( "-d" ) ) + else if( args[ i ].equals( "-d" ) ) { - destDirectory = new File( args[++i] ); + destDirectory = new File( args[ ++i ] ); } - else if( args[i].equals( "-debug" ) ) + else if( args[ i ].equals( "-debug" ) ) { debug = true; } - else if( args[i].equals( "-keepsource" ) ) + else if( args[ i ].equals( "-keepsource" ) ) { retainSource = true; } @@ -248,7 +249,7 @@ public class IPlanetEjbc * Build and populate an instance of the ejbc utility */ ejbc = new IPlanetEjbc( stdDescriptor, iasDescriptor, destDirectory, - classpath, parser ); + classpath, parser ); ejbc.setDebugOutput( debug ); ejbc.setRetainSource( retainSource ); @@ -262,19 +263,19 @@ public class IPlanetEjbc catch( IOException e ) { System.out.println( "An IOException has occurred while reading the " - + "XML descriptors (" + e.getMessage() + ")." ); + + "XML descriptors (" + e.getMessage() + ")." ); return; } catch( SAXException e ) { System.out.println( "A SAXException has occurred while reading the " - + "XML descriptors (" + e.getMessage() + ")." ); + + "XML descriptors (" + e.getMessage() + ")." ); return; } catch( IPlanetEjbc.EjbcException e ) { System.out.println( "An error has occurred while executing the ejbc " - + "utility (" + e.getMessage() + ")." ); + + "utility (" + e.getMessage() + ")." ); return; } } @@ -353,11 +354,11 @@ public class IPlanetEjbc for( int i = 0; i < ejbs.length; i++ ) { - List descriptors = ( List )ejbs[i].getCmpDescriptors(); + List descriptors = (List)ejbs[ i ].getCmpDescriptors(); returnList.addAll( descriptors ); } - return ( String[] )returnList.toArray( new String[returnList.size()] ); + return (String[])returnList.toArray( new String[ returnList.size() ] ); } /** @@ -407,12 +408,12 @@ public class IPlanetEjbc for( int i = 0; i < ejbs.length; i++ ) { log( "EJBInfo..." ); - log( ejbs[i].toString() ); + log( ejbs[ i ].toString() ); } for( int i = 0; i < ejbs.length; i++ ) { - EjbInfo ejb = ejbs[i]; + EjbInfo ejb = ejbs[ i ]; ejb.checkConfiguration( destDirectory );// Throws EjbcException @@ -588,7 +589,7 @@ public class IPlanetEjbc /* * Convert the List into an Array and return it */ - return ( String[] )arguments.toArray( new String[arguments.size()] ); + return (String[])arguments.toArray( new String[ arguments.size() ] ); } /** @@ -605,7 +606,7 @@ public class IPlanetEjbc StringBuffer args = new StringBuffer(); for( int i = 0; i < arguments.length; i++ ) { - args.append( arguments[i] ).append( " " ); + args.append( arguments[ i ] ).append( " " ); } /* @@ -619,7 +620,7 @@ public class IPlanetEjbc else { command = iasHomeDir.toString() + File.separator + "bin" - + File.separator; + + File.separator; } command += "ejbc "; @@ -745,7 +746,7 @@ public class IPlanetEjbc public File getClassFile( File directory ) { String pathToFile = qualifiedName.replace( '.', File.separatorChar ) - + ".class"; + + ".class"; return new File( directory, pathToFile ); } @@ -805,7 +806,6 @@ public class IPlanetEjbc } }// End of EjbcHandler inner class - /** * This inner class represents an EJB that will be compiled using ejbc. * @@ -1005,13 +1005,13 @@ public class IPlanetEjbc public String toString() { String s = "EJB name: " + name - + "\n\r home: " + home - + "\n\r remote: " + remote - + "\n\r impl: " + implementation - + "\n\r beantype: " + beantype - + "\n\r cmp: " + cmp - + "\n\r iiop: " + iiop - + "\n\r hasession: " + hasession; + + "\n\r home: " + home + + "\n\r remote: " + remote + + "\n\r impl: " + implementation + + "\n\r beantype: " + beantype + + "\n\r cmp: " + cmp + + "\n\r iiop: " + iiop + + "\n\r hasession: " + hasession; Iterator i = cmpDescriptors.iterator(); while( i.hasNext() ) @@ -1040,40 +1040,40 @@ public class IPlanetEjbc if( home == null ) { throw new EjbcException( "A home interface was not found " - + "for the " + name + " EJB." ); + + "for the " + name + " EJB." ); } if( remote == null ) { throw new EjbcException( "A remote interface was not found " - + "for the " + name + " EJB." ); + + "for the " + name + " EJB." ); } if( implementation == null ) { throw new EjbcException( "An EJB implementation class was not " - + "found for the " + name + " EJB." ); + + "found for the " + name + " EJB." ); } if( ( !beantype.equals( ENTITY_BEAN ) ) - && ( !beantype.equals( STATELESS_SESSION ) ) - && ( !beantype.equals( STATEFUL_SESSION ) ) ) + && ( !beantype.equals( STATELESS_SESSION ) ) + && ( !beantype.equals( STATEFUL_SESSION ) ) ) { throw new EjbcException( "The beantype found (" + beantype + ") " - + "isn't valid in the " + name + " EJB." ); + + "isn't valid in the " + name + " EJB." ); } if( cmp && ( !beantype.equals( ENTITY_BEAN ) ) ) { System.out.println( "CMP stubs and skeletons may not be generated" - + " for a Session Bean -- the \"cmp\" attribute will be" - + " ignoredfor the " + name + " EJB." ); + + " for a Session Bean -- the \"cmp\" attribute will be" + + " ignoredfor the " + name + " EJB." ); } if( hasession && ( !beantype.equals( STATEFUL_SESSION ) ) ) { System.out.println( "Highly available stubs and skeletons may " - + "only be generated for a Stateful Session Bean -- the " - + "\"hasession\" attribute will be ignored for the " - + name + " EJB." ); + + "only be generated for a Stateful Session Bean -- the " + + "\"hasession\" attribute will be ignored for the " + + name + " EJB." ); } /* @@ -1082,20 +1082,20 @@ public class IPlanetEjbc if( !remote.getClassFile( buildDir ).exists() ) { throw new EjbcException( "The remote interface " - + remote.getQualifiedClassName() + " could not be " - + "found." ); + + remote.getQualifiedClassName() + " could not be " + + "found." ); } if( !home.getClassFile( buildDir ).exists() ) { throw new EjbcException( "The home interface " - + home.getQualifiedClassName() + " could not be " - + "found." ); + + home.getQualifiedClassName() + " could not be " + + "found." ); } if( !implementation.getClassFile( buildDir ).exists() ) { throw new EjbcException( "The EJB implementation class " - + implementation.getQualifiedClassName() + " could " - + "not be found." ); + + implementation.getQualifiedClassName() + " could " + + "not be found." ); } } @@ -1111,7 +1111,7 @@ public class IPlanetEjbc */ private String[] classesToGenerate() { - String[] classnames = ( iiop ) ? new String[15] : new String[9]; + String[] classnames = ( iiop ) ? new String[ 15 ] : new String[ 9 ]; final String remotePkg = remote.getPackageName() + "."; final String remoteClass = remote.getClassName(); @@ -1123,30 +1123,30 @@ public class IPlanetEjbc String fullPath; - classnames[index++] = implPkg + "ejb_fac_" + implFullClass; - classnames[index++] = implPkg + "ejb_home_" + implFullClass; - classnames[index++] = implPkg + "ejb_skel_" + implFullClass; - classnames[index++] = remotePkg + "ejb_kcp_skel_" + remoteClass; - classnames[index++] = homePkg + "ejb_kcp_skel_" + homeClass; - classnames[index++] = remotePkg + "ejb_kcp_stub_" + remoteClass; - classnames[index++] = homePkg + "ejb_kcp_stub_" + homeClass; - classnames[index++] = remotePkg + "ejb_stub_" + remoteClass; - classnames[index++] = homePkg + "ejb_stub_" + homeClass; + classnames[ index++ ] = implPkg + "ejb_fac_" + implFullClass; + classnames[ index++ ] = implPkg + "ejb_home_" + implFullClass; + classnames[ index++ ] = implPkg + "ejb_skel_" + implFullClass; + classnames[ index++ ] = remotePkg + "ejb_kcp_skel_" + remoteClass; + classnames[ index++ ] = homePkg + "ejb_kcp_skel_" + homeClass; + classnames[ index++ ] = remotePkg + "ejb_kcp_stub_" + remoteClass; + classnames[ index++ ] = homePkg + "ejb_kcp_stub_" + homeClass; + classnames[ index++ ] = remotePkg + "ejb_stub_" + remoteClass; + classnames[ index++ ] = homePkg + "ejb_stub_" + homeClass; if( !iiop ) { return classnames; } - classnames[index++] = remotePkg + "_" + remoteClass + "_Stub"; - classnames[index++] = homePkg + "_" + homeClass + "_Stub"; - classnames[index++] = remotePkg + "_ejb_RmiCorbaBridge_" - + remoteClass + "_Tie"; - classnames[index++] = homePkg + "_ejb_RmiCorbaBridge_" + homeClass - + "_Tie"; - classnames[index++] = remotePkg + "ejb_RmiCorbaBridge_" - + remoteClass; - classnames[index++] = homePkg + "ejb_RmiCorbaBridge_" + homeClass; + classnames[ index++ ] = remotePkg + "_" + remoteClass + "_Stub"; + classnames[ index++ ] = homePkg + "_" + homeClass + "_Stub"; + classnames[ index++ ] = remotePkg + "_ejb_RmiCorbaBridge_" + + remoteClass + "_Tie"; + classnames[ index++ ] = homePkg + "_ejb_RmiCorbaBridge_" + homeClass + + "_Tie"; + classnames[ index++ ] = remotePkg + "ejb_RmiCorbaBridge_" + + remoteClass; + classnames[ index++ ] = homePkg + "ejb_RmiCorbaBridge_" + homeClass; return classnames; } @@ -1161,7 +1161,7 @@ public class IPlanetEjbc * @return The modification timestamp for the "oldest" EJB stub or * skeleton. If one of the classes cannot be found, -1 * is returned. - * @throws BuildException If the canonical path of the destination + * @throws TaskException If the canonical path of the destination * directory cannot be found. */ private long destClassesModified( File destDir ) @@ -1178,7 +1178,7 @@ public class IPlanetEjbc { String pathToClass = - classnames[i].replace( '.', File.separatorChar ) + ".class"; + classnames[ i ].replace( '.', File.separatorChar ) + ".class"; File classFile = new File( destDir, pathToClass ); /* @@ -1210,7 +1210,7 @@ public class IPlanetEjbc * * @param buildDir Description of Parameter * @return The modification timestamp for the "oldest" EJB source class. - * @throws BuildException If one of the EJB source classes cannot be + * @throws TaskException If one of the EJB source classes cannot be * found on the classpath. */ private long sourceClassesModified( File buildDir ) @@ -1229,8 +1229,8 @@ public class IPlanetEjbc if( modified == -1 ) { System.out.println( "The class " - + remote.getQualifiedClassName() + " couldn't " - + "be found on the classpath" ); + + remote.getQualifiedClassName() + " couldn't " + + "be found on the classpath" ); return -1; } latestModified = modified; @@ -1243,8 +1243,8 @@ public class IPlanetEjbc if( modified == -1 ) { System.out.println( "The class " - + home.getQualifiedClassName() + " couldn't be " - + "found on the classpath" ); + + home.getQualifiedClassName() + " couldn't be " + + "found on the classpath" ); return -1; } latestModified = Math.max( latestModified, modified ); @@ -1264,8 +1264,8 @@ public class IPlanetEjbc if( modified == -1 ) { System.out.println( "The class " - + implementation.getQualifiedClassName() - + " couldn't be found on the classpath" ); + + implementation.getQualifiedClassName() + + " couldn't be found on the classpath" ); return -1; } @@ -1286,7 +1286,6 @@ public class IPlanetEjbc }// End of EjbcException inner class - /** * This inner class is an XML document handler that can be used to parse EJB * descriptors (both the standard EJB descriptor as well as the iAS-specific @@ -1358,7 +1357,7 @@ public class IPlanetEjbc */ public EjbInfo[] getEjbs() { - return ( EjbInfo[] )ejbs.values().toArray( new EjbInfo[ejbs.size()] ); + return (EjbInfo[])ejbs.values().toArray( new EjbInfo[ ejbs.size() ] ); } /** @@ -1471,15 +1470,15 @@ public class IPlanetEjbc /* * Search the resource Map and (if not found) file Map */ - String location = ( String )resourceDtds.get( publicId ); + String location = (String)resourceDtds.get( publicId ); if( location != null ) { inputStream - = ClassLoader.getSystemResource( location ).openStream(); + = ClassLoader.getSystemResource( location ).openStream(); } else { - location = ( String )fileDtds.get( publicId ); + location = (String)fileDtds.get( publicId ); if( location != null ) { inputStream = new FileInputStream( location ); @@ -1555,7 +1554,7 @@ public class IPlanetEjbc if( currentLoc.equals( base + "\\ejb-name" ) ) { - currentEjb = ( EjbInfo )ejbs.get( value ); + currentEjb = (EjbInfo)ejbs.get( value ); if( currentEjb == null ) { currentEjb = new EjbInfo( value ); @@ -1571,7 +1570,7 @@ public class IPlanetEjbc currentEjb.setHasession( value ); } else if( currentLoc.equals( base + "\\persistence-manager" - + "\\properties-file-location" ) ) + + "\\properties-file-location" ) ) { currentEjb.addCmpDescriptor( value ); } @@ -1598,7 +1597,7 @@ public class IPlanetEjbc if( currentLoc.equals( base + "\\ejb-name" ) ) { - currentEjb = ( EjbInfo )ejbs.get( value ); + currentEjb = (EjbInfo)ejbs.get( value ); if( currentEjb == null ) { currentEjb = new EjbInfo( value ); @@ -1628,7 +1627,6 @@ public class IPlanetEjbc } }// End of Classname inner class - /** * Thread class used to redirect output from an InputStream to * the JRE standard output. This class may be used to redirect output from diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java index bc6ba5c99..57397d596 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbcTask.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Path; import org.xml.sax.SAXException; @@ -183,10 +184,10 @@ public class IPlanetEjbcTask extends Task /** * Does the work. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { checkConfiguration(); @@ -213,10 +214,10 @@ public class IPlanetEjbcTask extends Task * Returns a SAXParser that may be used to process the XML descriptors. * * @return Parser which may be used to process the EJB descriptors. - * @throws BuildException If the parser cannot be created or configured. + * @throws TaskException If the parser cannot be created or configured. */ private SAXParser getParser() - throws BuildException + throws TaskException { SAXParser saxParser = null; @@ -229,12 +230,12 @@ public class IPlanetEjbcTask extends Task catch( SAXException e ) { String msg = "Unable to create a SAXParser: " + e.getMessage(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } catch( ParserConfigurationException e ) { String msg = "Unable to create a SAXParser: " + e.getMessage(); - throw new BuildException( msg, e ); + throw new TaskException( msg, e ); } return saxParser; @@ -243,56 +244,56 @@ public class IPlanetEjbcTask extends Task /** * Verifies that the user selections are valid. * - * @throws BuildException If the user selections are invalid. + * @throws TaskException If the user selections are invalid. */ private void checkConfiguration() - throws BuildException + throws TaskException { if( ejbdescriptor == null ) { String msg = "The standard EJB descriptor must be specified using " - + "the \"ejbdescriptor\" attribute."; - throw new BuildException( msg ); + + "the \"ejbdescriptor\" attribute."; + throw new TaskException( msg ); } if( ( !ejbdescriptor.exists() ) || ( !ejbdescriptor.isFile() ) ) { String msg = "The standard EJB descriptor (" + ejbdescriptor - + ") was not found or isn't a file."; - throw new BuildException( msg ); + + ") was not found or isn't a file."; + throw new TaskException( msg ); } if( iasdescriptor == null ) { String msg = "The iAS-speific XML descriptor must be specified using" - + " the \"iasdescriptor\" attribute."; - throw new BuildException( msg ); + + " the \"iasdescriptor\" attribute."; + throw new TaskException( msg ); } if( ( !iasdescriptor.exists() ) || ( !iasdescriptor.isFile() ) ) { String msg = "The iAS-specific XML descriptor (" + iasdescriptor - + ") was not found or isn't a file."; - throw new BuildException( msg ); + + ") was not found or isn't a file."; + throw new TaskException( msg ); } if( dest == null ) { String msg = "The destination directory must be specified using " - + "the \"dest\" attribute."; - throw new BuildException( msg ); + + "the \"dest\" attribute."; + throw new TaskException( msg ); } if( ( !dest.exists() ) || ( !dest.isDirectory() ) ) { String msg = "The destination directory (" + dest + ") was not " - + "found or isn't a directory."; - throw new BuildException( msg ); + + "found or isn't a directory."; + throw new TaskException( msg ); } if( ( iashome != null ) && ( !iashome.isDirectory() ) ) { String msg = "If \"iashome\" is specified, it must be a valid " - + "directory (it was set to " + iashome + ")."; - throw new BuildException( msg ); + + "directory (it was set to " + iashome + ")."; + throw new TaskException( msg ); } } @@ -301,17 +302,17 @@ public class IPlanetEjbcTask extends Task * * @param saxParser SAXParser that may be used to process the EJB * descriptors - * @throws BuildException If there is an error reading or parsing the XML + * @throws TaskException If there is an error reading or parsing the XML * descriptors */ private void executeEjbc( SAXParser saxParser ) - throws BuildException + throws TaskException { IPlanetEjbc ejbc = new IPlanetEjbc( ejbdescriptor, - iasdescriptor, - dest, - getClasspath().toString(), - saxParser ); + iasdescriptor, + dest, + getClasspath().toString(), + saxParser ); ejbc.setRetainSource( keepgenerated ); ejbc.setDebugOutput( debug ); if( iashome != null ) @@ -326,20 +327,20 @@ public class IPlanetEjbcTask extends Task catch( IOException e ) { String msg = "An IOException occurred while trying to read the XML " - + "descriptor file: " + e.getMessage(); - throw new BuildException( msg, e ); + + "descriptor file: " + e.getMessage(); + throw new TaskException( msg, e ); } catch( SAXException e ) { String msg = "A SAXException occurred while trying to read the XML " - + "descriptor file: " + e.getMessage(); - throw new BuildException( msg, e ); + + "descriptor file: " + e.getMessage(); + throw new TaskException( msg, e ); } catch( IPlanetEjbc.EjbcException e ) { String msg = "An exception occurred while trying to run the ejbc " - + "utility: " + e.getMessage(); - throw new BuildException( msg, e ); + + "utility: " + e.getMessage(); + throw new TaskException( msg, e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java index a5a7d70f0..23442f760 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/InnerClassFilenameFilter.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.io.FilenameFilter; @@ -26,7 +27,7 @@ public class InnerClassFilenameFilter implements FilenameFilter public boolean accept( File Dir, String filename ) { if( ( filename.lastIndexOf( "." ) != filename.lastIndexOf( ".class" ) ) - || ( filename.indexOf( baseClassName + "$" ) != 0 ) ) + || ( filename.indexOf( baseClassName + "$" ) != 0 ) ) { return false; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java index 06fd4ad05..6170185d0 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/JbossDeploymentTool.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.util.Hashtable; import org.apache.tools.ant.Project; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java index 227763d2d..7a239fd92 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; @@ -109,7 +110,6 @@ public class WLRun extends Task this.beaHome = beaHome; } - /** * Set the classpath to be used for this execution. * @@ -171,7 +171,6 @@ public class WLRun extends Task this.pkPassword = pkpassword; } - /** * Set the management password of the server * @@ -213,7 +212,6 @@ public class WLRun extends Task this.managementUsername = username; } - public void setWeblogicMainClass( String c ) { weblogicMainClass = c; @@ -266,19 +264,19 @@ public class WLRun extends Task * avoids having to start ant with the class path of the project it is * building. * - * @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( weblogicSystemHome == null ) { - throw new BuildException( "weblogic home must be set" ); + throw new TaskException( "weblogic home must be set" ); } if( !weblogicSystemHome.isDirectory() ) { - throw new BuildException( "weblogic home directory " + weblogicSystemHome.getPath() + - " is not valid" ); + throw new TaskException( "weblogic home directory " + weblogicSystemHome.getPath() + + " is not valid" ); } if( beaHome != null ) @@ -292,6 +290,7 @@ public class WLRun extends Task } private void executeWLS() + throws TaskException { File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL51_POLICY_FILE ); File propertiesFile = null; @@ -307,13 +306,13 @@ public class WLRun extends Task propertiesFile = resolveFile( weblogicPropertiesFile ); if( !propertiesFile.exists() ) { - throw new BuildException( "Properties file " + weblogicPropertiesFile + - " not found in weblogic home " + weblogicSystemHome + - " or as absolute file" ); + throw new TaskException( "Properties file " + weblogicPropertiesFile + + " not found in weblogic home " + weblogicSystemHome + + " or as absolute file" ); } } - Java weblogicServer = ( Java )project.createTask( "java" ); + Java weblogicServer = (Java)project.createTask( "java" ); weblogicServer.setTaskName( getTaskName() ); weblogicServer.setFork( true ); weblogicServer.setClassname( weblogicMainClass ); @@ -339,7 +338,7 @@ public class WLRun extends Task } if( weblogicServer.executeJava() != 0 ) { - throw new BuildException( "Execution of weblogic server failed" ); + throw new TaskException( "Execution of weblogic server failed" ); } } @@ -348,22 +347,22 @@ public class WLRun extends Task File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL60_POLICY_FILE ); if( !beaHome.isDirectory() ) { - throw new BuildException( "BEA home " + beaHome.getPath() + - " is not valid" ); + throw new TaskException( "BEA home " + beaHome.getPath() + + " is not valid" ); } File configFile = new File( weblogicSystemHome, "config/" + weblogicDomainName + "/config.xml" ); if( !configFile.exists() ) { - throw new BuildException( "Server config file " + configFile + " not found." ); + throw new TaskException( "Server config file " + configFile + " not found." ); } if( managementPassword == null ) { - throw new BuildException( "You must supply a management password to start the server" ); + throw new TaskException( "You must supply a management password to start the server" ); } - Java weblogicServer = ( Java )project.createTask( "java" ); + Java weblogicServer = (Java)project.createTask( "java" ); weblogicServer.setTaskName( getTaskName() ); weblogicServer.setFork( true ); weblogicServer.setDir( weblogicSystemHome ); @@ -395,7 +394,7 @@ public class WLRun extends Task if( weblogicServer.executeJava() != 0 ) { - throw new BuildException( "Execution of weblogic server failed" ); + throw new TaskException( "Execution of weblogic server failed" ); } } @@ -416,8 +415,8 @@ public class WLRun extends Task // If we still can't find it, complain if( !securityPolicyFile.exists() ) { - throw new BuildException( "Security policy " + securityPolicy + - " was not found." ); + throw new TaskException( "Security policy " + securityPolicy + + " was not found." ); } return securityPolicyFile; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java index 076e057ed..f8c8d1b9b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WLStop.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; @@ -70,7 +71,6 @@ public class WLStop extends Task this.classpath = path; } - /** * Set the delay (in seconds) before shutting down the server. * @@ -130,22 +130,22 @@ public class WLStop extends Task * the weblogic admin task This approach allows the classpath of the helper * task to be set. * - * @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( username == null || password == null ) { - throw new BuildException( "weblogic username and password must both be set" ); + throw new TaskException( "weblogic username and password must both be set" ); } if( serverURL == null ) { - throw new BuildException( "The url of the weblogic server must be provided." ); + throw new TaskException( "The url of the weblogic server must be provided." ); } - Java weblogicAdmin = ( Java )project.createTask( "java" ); + Java weblogicAdmin = (Java)project.createTask( "java" ); weblogicAdmin.setFork( true ); weblogicAdmin.setClassname( "weblogic.Admin" ); String args; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java index 2a6ab0e07..5cd1f56b0 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicDeploymentTool.java @@ -23,9 +23,9 @@ import javax.xml.parsers.SAXParserFactory; import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.Project; -import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.util.FileUtils; import org.xml.sax.InputSource; public class WeblogicDeploymentTool extends GenericDeploymentTool diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java index 3fab8bd54..9918e3058 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ejb/WeblogicTOPLinkDeploymentTool.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ejb; + import java.io.File; import java.util.Hashtable; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool @@ -46,15 +47,15 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool /** * Called to validate that the tool parameters have been configured. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void validateConfigured() - throws BuildException + throws TaskException { super.validateConfigured(); if( toplinkDescriptor == null ) { - throw new BuildException( "The toplinkdescriptor attribute must be specified" ); + throw new TaskException( "The toplinkdescriptor attribute must be specified" ); } } @@ -64,12 +65,12 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool if( toplinkDTD != null ) { handler.registerDTD( "-//The Object People, Inc.//DTD TOPLink for WebLogic CMP 2.5.1//EN", - toplinkDTD ); + toplinkDTD ); } else { handler.registerDTD( "-//The Object People, Inc.//DTD TOPLink for WebLogic CMP 2.5.1//EN", - TL_DTD_LOC ); + TL_DTD_LOC ); } return handler; } @@ -93,12 +94,12 @@ public class WeblogicTOPLinkDeploymentTool extends WeblogicDeploymentTool if( toplinkDD.exists() ) { ejbFiles.put( META_DIR + toplinkDescriptor, - toplinkDD ); + toplinkDD ); } else { log( "Unable to locate toplink deployment descriptor. It was expected to be in " + - toplinkDD.getPath(), Project.MSG_WARN ); + toplinkDD.getPath(), Project.MSG_WARN ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java index a84e8a330..82f7c7377 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java @@ -18,7 +18,7 @@ import java.io.OutputStreamWriter; import java.util.Hashtable; 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.taskdefs.MatchingTask; @@ -234,35 +234,35 @@ public class Translate extends MatchingTask /** * Check attributes values, load resource map and translate * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { if( bundle == null ) { - throw new BuildException( "The bundle attribute must be set." ); + throw new TaskException( "The bundle attribute must be set." ); } if( startToken == null ) { - throw new BuildException( "The starttoken attribute must be set." ); + throw new TaskException( "The starttoken attribute must be set." ); } if( startToken.length() != 1 ) { - throw new BuildException( + throw new TaskException( "The starttoken attribute must be a single character." ); } if( endToken == null ) { - throw new BuildException( "The endtoken attribute must be set." ); + throw new TaskException( "The endtoken attribute must be set." ); } if( endToken.length() != 1 ) { - throw new BuildException( + throw new TaskException( "The endtoken attribute must be a single character." ); } @@ -287,7 +287,7 @@ public class Translate extends MatchingTask if( toDir == null ) { - throw new BuildException( "The todir attribute must be set." ); + throw new TaskException( "The todir attribute must be set." ); } if( !toDir.exists() ) @@ -298,7 +298,7 @@ public class Translate extends MatchingTask { if( toDir.isFile() ) { - throw new BuildException( toDir + " is not a directory" ); + throw new TaskException( toDir + " is not a directory" ); } } @@ -327,10 +327,10 @@ public class Translate extends MatchingTask * overwritten. Bundle's encoding scheme is used. * * @param ins Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void loadResourceMap( FileInputStream ins ) - throws BuildException + throws TaskException { try { @@ -397,7 +397,7 @@ public class Translate extends MatchingTask } catch( IOException ioe ) { - throw new BuildException( ioe.getMessage() ); + throw new TaskException( ioe.getMessage() ); } } @@ -415,10 +415,10 @@ public class Translate extends MatchingTask * located, it is treated just like a properties file but with bundle * encoding also considered while loading. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void loadResourceMaps() - throws BuildException + throws TaskException { Locale locale = new Locale( bundleLanguage, bundleCountry, @@ -475,11 +475,11 @@ public class Translate extends MatchingTask * @param bundleFile Description of Parameter * @param i Description of Parameter * @param checkLoaded Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void processBundle( String bundleFile, int i, boolean checkLoaded ) - throws BuildException + throws TaskException { bundleFile += ".properties"; FileInputStream ins = null; @@ -499,7 +499,7 @@ public class Translate extends MatchingTask //find a single resrouce file, throw exception if( !loaded && checkLoaded ) { - throw new BuildException( ioe.getMessage() ); + throw new TaskException( ioe.getMessage() ); } } } @@ -514,10 +514,10 @@ public class Translate extends MatchingTask * if the source file or any associated bundle resource file is newer than * the destination file. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void translate() - throws BuildException + throws TaskException { for( int i = 0; i < filesets.size(); i++ ) { @@ -643,7 +643,7 @@ public class Translate extends MatchingTask } catch( IOException ioe ) { - throw new BuildException( ioe.getMessage() ); + throw new TaskException( ioe.getMessage() ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJAntTool.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJAntTool.java index 1526cd393..1e29f0c42 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJAntTool.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJAntTool.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import com.ibm.ivj.util.base.Project; import com.ibm.ivj.util.base.ToolData; -import org.apache.tools.ant.BuildException; - +import org.apache.myrmidon.api.TaskException; /** * This class is the equivalent to org.apache.tools.ant.Main for the VAJ tool @@ -24,7 +24,6 @@ public class VAJAntTool { private final static String TOOL_DATA_KEY = "AntTool"; - /** * Loads the BuildInfo for the specified VAJ project from the tool data for * this project. If there is no build info stored for that project, a new @@ -43,7 +42,7 @@ public class VAJAntTool if( project.testToolRepositoryData( TOOL_DATA_KEY ) ) { ToolData td = project.getToolRepositoryData( TOOL_DATA_KEY ); - String data = ( String )td.getData(); + String data = (String)td.getData(); result = VAJBuildInfo.parse( data ); } else @@ -54,13 +53,12 @@ public class VAJAntTool } catch( Throwable t ) { - throw new BuildException( "BuildInfo for Project " - + projectName + " could not be loaded" + t ); + throw new TaskException( "BuildInfo for Project " + + projectName + " could not be loaded" + t ); } return result; } - /** * Starts the application. * @@ -73,9 +71,9 @@ public class VAJAntTool try { VAJBuildInfo info; - if( args.length >= 2 && args[1] instanceof String ) + if( args.length >= 2 && args[ 1 ] instanceof String ) { - String projectName = ( String )args[1]; + String projectName = (String)args[ 1 ]; info = loadBuildData( projectName ); } else @@ -94,7 +92,6 @@ public class VAJAntTool } } - /** * Saves the BuildInfo for a project in the VAJ repository. * @@ -111,8 +108,8 @@ public class VAJAntTool } catch( Throwable t ) { - throw new BuildException( "BuildInfo for Project " - + info.getVAJProjectName() + " could not be saved", t ); + throw new TaskException( "BuildInfo for Project " + + info.getVAJProjectName() + " could not be saved", t ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java index 7aa8916e0..89a890346 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJAntToolGUI.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.awt.BorderLayout; import java.awt.Button; import java.awt.Choice; @@ -36,11 +37,9 @@ import java.awt.event.TextListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.beans.PropertyChangeListener; -import java.io.PrintWriter; -import java.io.StringWriter; import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.Project; import org.apache.tools.ant.util.StringUtils; @@ -182,14 +181,14 @@ public class VAJAntToolGUI extends Frame 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" ); } } @@ -1617,9 +1616,13 @@ public class VAJAntToolGUI extends Frame connectTextFieldToBuildFileName(); } - public void windowActivated( WindowEvent e ) { } + public void windowActivated( WindowEvent e ) + { + } - public void windowClosed( WindowEvent e ) { } + public void windowClosed( WindowEvent e ) + { + } /** * WindowListener methods @@ -1646,13 +1649,21 @@ public class VAJAntToolGUI extends Frame } } - public void windowDeactivated( WindowEvent e ) { } + public void windowDeactivated( WindowEvent e ) + { + } - public void windowDeiconified( WindowEvent e ) { } + public void windowDeiconified( WindowEvent e ) + { + } - public void windowIconified( WindowEvent e ) { } + public void windowIconified( WindowEvent e ) + { + } - public void windowOpened( WindowEvent e ) { } + public void windowOpened( WindowEvent e ) + { + } } /** @@ -1716,7 +1727,6 @@ public class VAJAntToolGUI extends Frame getMessageTextArea().append( lineSeparator ); } - /** * Outputs an exception. * @@ -1726,11 +1736,11 @@ public class VAJAntToolGUI extends Frame { getMessageTextArea().append( lineSeparator + "BUILD FAILED" + lineSeparator ); - if( error instanceof BuildException ) + if( error instanceof TaskException ) { getMessageTextArea().append( error.toString() ); - Throwable nested = ( ( BuildException )error ).getCause(); + Throwable nested = ( (TaskException)error ).getCause(); if( nested != null ) { nested.printStackTrace( System.err ); @@ -1767,7 +1777,9 @@ public class VAJAntToolGUI extends Frame * @param event Description of Parameter * @see BuildEvent#getException() */ - public void targetFinished( BuildEvent event ) { } + public void targetFinished( BuildEvent event ) + { + } /** * Fired when a target is started. @@ -1790,7 +1802,9 @@ public class VAJAntToolGUI extends Frame * @param event Description of Parameter * @see BuildEvent#getException() */ - public void taskFinished( BuildEvent event ) { } + public void taskFinished( BuildEvent event ) + { + } /** * Fired when a task is started. @@ -1798,6 +1812,8 @@ public class VAJAntToolGUI extends Frame * @param event Description of Parameter * @see BuildEvent#getTask() */ - public void taskStarted( BuildEvent event ) { } + public void taskStarted( BuildEvent event ) + { + } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJBuildInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJBuildInfo.java index a504426bb..4a26a2b1a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJBuildInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJBuildInfo.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.io.File; import java.util.Enumeration; import java.util.StringTokenizer; import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectHelper; @@ -106,7 +107,7 @@ class VAJBuildInfo implements Runnable int res = names.size(); for( int i = 0; i < names.size() && res == names.size(); i++ ) { - if( name.compareTo( ( String )names.elementAt( i ) ) < 0 ) + if( name.compareTo( (String)names.elementAt( i ) ) < 0 ) { res = i; } @@ -137,7 +138,7 @@ class VAJBuildInfo implements Runnable int oldValue = outputMessageLevel; outputMessageLevel = newOutputMessageLevel; firePropertyChange( "outputMessageLevel", - new Integer( oldValue ), new Integer( outputMessageLevel ) ); + new Integer( oldValue ), new Integer( outputMessageLevel ) ); } /** @@ -225,7 +226,6 @@ class VAJBuildInfo implements Runnable return projectInitialized; } - /** * The addPropertyChangeListener method was generated to support the * propertyChange field. @@ -247,9 +247,9 @@ class VAJBuildInfo implements Runnable public String asDataString() { String result = getOutputMessageLevel() + "|" + getBuildFileName() - + "|" + getTarget(); + + "|" + getTarget(); for( Enumeration e = getProjectTargets().elements(); - e.hasMoreElements(); ) + e.hasMoreElements(); ) { result = result + "|" + e.nextElement(); } @@ -257,7 +257,6 @@ class VAJBuildInfo implements Runnable return result; } - /** * cancels a build. */ @@ -368,7 +367,7 @@ class VAJBuildInfo implements Runnable Enumeration ptargets = project.getTargets().elements(); while( ptargets.hasMoreElements() ) { - Target currentTarget = ( Target )ptargets.nextElement(); + Target currentTarget = (Target)ptargets.nextElement(); if( currentTarget.getDescription() != null ) { String targetName = currentTarget.getName(); @@ -460,7 +459,7 @@ class VAJBuildInfo implements Runnable * * @author RT */ - public static class BuildInterruptedException extends BuildException + public static class BuildInterruptedException extends TaskException { public String toString() { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java index 4d49c923d..4b9f40cf7 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.PatternSet; /** @@ -160,24 +161,24 @@ public class VAJExport extends VAJTask /** * do the export * - * @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 destdir if( destDir == null ) { - throw new BuildException( "destdir attribute must be set!" ); + throw new TaskException( "destdir attribute must be set!" ); } // delegate the export to the VAJUtil object. getUtil().exportPackages( destDir, - patternSet.getIncludePatterns( getProject() ), - patternSet.getExcludePatterns( getProject() ), - exportClasses, exportDebugInfo, - exportResources, exportSources, - useDefaultExcludes, overwrite ); + patternSet.getIncludePatterns( getProject() ), + patternSet.getExcludePatterns( getProject() ), + exportClasses, exportDebugInfo, + exportResources, exportSources, + useDefaultExcludes, overwrite ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJExportServlet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJExportServlet.java index a78a51efc..310e78d6d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJExportServlet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJExportServlet.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.File; /** @@ -251,6 +252,6 @@ public class VAJExportServlet extends VAJToolsServlet getBooleanParam( SOURCES_PARAM, true ), getBooleanParam( DEFAULT_EXCLUDES_PARAM, true ), getBooleanParam( OVERWRITE_PARAM, true ) - ); + ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java index 36d63bbf8..a31924865 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJImport.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.lang.reflect.Field; 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.types.FileSet; @@ -172,7 +173,6 @@ public class VAJImport extends VAJTask this.importSources = importSources; } - /** * The VisualAge for Java Project name to import into. * @@ -196,24 +196,24 @@ public class VAJImport extends VAJTask /** * Do the import. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { if( filesets.size() == 0 ) { - throw new BuildException( "At least one fileset is required!" ); + throw new TaskException( "At least one fileset is required!" ); } if( importProject == null || "".equals( importProject ) ) { - throw new BuildException( "The VisualAge for Java Project name is required!" ); + throw new TaskException( "The VisualAge for Java Project name is required!" ); } - for( Enumeration e = filesets.elements(); e.hasMoreElements(); ) + for( Enumeration e = filesets.elements(); e.hasMoreElements(); ) { - importFileset( ( FileSet )e.nextElement() ); + importFileset( (FileSet)e.nextElement() ); } } @@ -243,26 +243,26 @@ public class VAJImport extends VAJTask Field includesField = directoryScanner.getDeclaredField( "includes" ); includesField.setAccessible( true ); - includes = ( String[] )includesField.get( ds ); + includes = (String[])includesField.get( ds ); Field excludesField = directoryScanner.getDeclaredField( "excludes" ); excludesField.setAccessible( true ); - excludes = ( String[] )excludesField.get( ds ); + excludes = (String[])excludesField.get( ds ); } catch( NoSuchFieldException nsfe ) { - throw new BuildException( + throw new TaskException( "DirectoryScanner.includes or .excludes missing" + nsfe.getMessage() ); } catch( IllegalAccessException iae ) { - throw new BuildException( + throw new TaskException( "Access to DirectoryScanner.includes or .excludes not allowed" ); } getUtil().importFiles( importProject, ds.getBasedir(), - includes, excludes, - importClasses, importResources, importSources, - useDefaultExcludes ); + includes, excludes, + importClasses, importResources, importSources, + useDefaultExcludes ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJImportServlet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJImportServlet.java index 9ea01067e..d7c290b9f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJImportServlet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJImportServlet.java @@ -6,8 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; -import java.io.File; +import java.io.File; /** * A Remote Access to Tools Servlet to import a Project from files into the @@ -71,8 +71,8 @@ public class VAJImportServlet extends VAJToolsServlet getBooleanParam( RESOURCES_PARAM, true ), getBooleanParam( SOURCES_PARAM, true ), false// no default excludes, because they - // are already added on client side - // getBooleanParam(DEFAULT_EXCLUDES_PARAM, true) - ); + // are already added on client side + // getBooleanParam(DEFAULT_EXCLUDES_PARAM, true) + ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java index d42912f1f..26e36d1f3 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoad.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.util.Vector; /** diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java index 86c9f8a79..d51ae1918 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadProjects.java @@ -7,11 +7,6 @@ */ package org.apache.tools.ant.taskdefs.optional.ide; - - - - - /** * This is only there for backward compatibility with the default task list and * will be removed soon diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadServlet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadServlet.java index 1fca4d63d..ea8f861c4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadServlet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLoadServlet.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.util.Vector; /** @@ -73,8 +74,8 @@ public class VAJLoadServlet extends VAJToolsServlet for( int i = 0; i < projectNames.length && i < versionNames.length; i++ ) { VAJProjectDescription desc = new VAJProjectDescription(); - desc.setName( projectNames[i] ); - desc.setVersion( versionNames[i] ); + desc.setName( projectNames[ i ] ); + desc.setVersion( versionNames[ i ] ); projectDescriptions.addElement( desc ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java index 729090720..d5d0d29ee 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJLocalUtil.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import com.ibm.ivj.util.base.ExportCodeSpec; import com.ibm.ivj.util.base.ImportCodeSpec; import com.ibm.ivj.util.base.IvjException; @@ -18,13 +19,12 @@ import com.ibm.ivj.util.base.Workspace; 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; - /** * Helper class for VAJ tasks. Holds Workspace singleton and wraps IvjExceptions - * into BuildExceptions + * into TaskExceptions * * @author Wolf Siberski, TUI Infotec GmbH */ @@ -46,7 +46,7 @@ abstract class VAJLocalUtil implements VAJUtil for( int i = 0; i < currentProjects.length; i++ ) { - Project p = currentProjects[i]; + Project p = currentProjects[ i ]; if( p.getName().equals( importProject ) ) { found = p; @@ -62,8 +62,8 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException e ) { - throw createBuildException( "Error while creating Project " - + importProject + ": ", e ); + throw createTaskException( "Error while creating Project " + + importProject + ": ", e ); } } @@ -82,9 +82,9 @@ abstract class VAJLocalUtil implements VAJUtil workspace = ToolEnv.connectToWorkspace(); if( workspace == null ) { - throw new BuildException( + throw new TaskException( "Unable to connect to Workspace! " - + "Make sure you are running in VisualAge for Java." ); + + "Make sure you are running in VisualAge for Java." ); } } @@ -92,14 +92,14 @@ abstract class VAJLocalUtil implements VAJUtil } /** - * Wraps IvjException into a BuildException + * Wraps IvjException into a TaskException * * @param errMsg Additional error message * @param e IvjException which is wrapped - * @return org.apache.tools.ant.BuildException + * @return org.apache.tools.ant.TaskException */ - static BuildException createBuildException( - String errMsg, IvjException e ) + static TaskException createTaskException( + String errMsg, IvjException e ) { errMsg = errMsg + "\n" + e.getMessage(); String[] errors = e.getErrors(); @@ -107,10 +107,10 @@ abstract class VAJLocalUtil implements VAJUtil { for( int i = 0; i < errors.length; i++ ) { - errMsg = errMsg + "\n" + errors[i]; + errMsg = errMsg + "\n" + errors[ i ]; } } - return new BuildException( errMsg, e ); + return new TaskException( errMsg, e ); } @@ -132,11 +132,11 @@ abstract class VAJLocalUtil implements VAJUtil * @param overwrite Description of Parameter */ public void exportPackages( - File dest, - String[] includePatterns, String[] excludePatterns, - boolean exportClasses, boolean exportDebugInfo, - boolean exportResources, boolean exportSources, - boolean useDefaultExcludes, boolean overwrite ) + File dest, + String[] includePatterns, String[] excludePatterns, + boolean exportClasses, boolean exportDebugInfo, + boolean exportResources, boolean exportSources, + boolean useDefaultExcludes, boolean overwrite ) { if( includePatterns == null || includePatterns.length == 0 ) { @@ -162,7 +162,7 @@ abstract class VAJLocalUtil implements VAJUtil + dest, MSG_INFO ); for( int i = 0; i < packages.length; i++ ) { - log( " " + packages[i].getName(), MSG_VERBOSE ); + log( " " + packages[ i ].getName(), MSG_VERBOSE ); } ExportCodeSpec exportSpec = new ExportCodeSpec(); @@ -179,7 +179,7 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException ex ) { - throw createBuildException( "Exporting failed!", ex ); + throw createTaskException( "Exporting failed!", ex ); } } } @@ -201,20 +201,20 @@ abstract class VAJLocalUtil implements VAJUtil * @param importResources Description of Parameter * @param importSources Description of Parameter * @param useDefaultExcludes Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void importFiles( - String importProject, File srcDir, - String[] includePatterns, String[] excludePatterns, - boolean importClasses, boolean importResources, - boolean importSources, boolean useDefaultExcludes ) - throws BuildException + String importProject, File srcDir, + String[] includePatterns, String[] excludePatterns, + boolean importClasses, boolean importResources, + boolean importSources, boolean useDefaultExcludes ) + throws TaskException { if( importProject == null || "".equals( importProject ) ) { - throw new BuildException( "The VisualAge for Java project " - + "name is required!" ); + throw new TaskException( "The VisualAge for Java project " + + "name is required!" ); } ImportCodeSpec importSpec = new ImportCodeSpec(); @@ -253,24 +253,24 @@ abstract class VAJLocalUtil implements VAJUtil Type[] importedTypes = getWorkspace().importData( importSpec ); if( importedTypes == null ) { - throw new BuildException( "Unable to import into Workspace!" ); + throw new TaskException( "Unable to import into Workspace!" ); } else { log( importedTypes.length + " types imported", MSG_DEBUG ); for( int i = 0; i < importedTypes.length; i++ ) { - log( importedTypes[i].getPackage().getName() - + "." + importedTypes[i].getName() - + " into " + importedTypes[i].getProject().getName(), - MSG_DEBUG ); + log( importedTypes[ i ].getPackage().getName() + + "." + importedTypes[ i ].getName() + + " into " + importedTypes[ i ].getProject().getName(), + MSG_DEBUG ); } } } catch( IvjException ivje ) { - throw createBuildException( "Error while importing into workspace: ", - ivje ); + throw createTaskException( "Error while importing into workspace: ", + ivje ); } } @@ -289,9 +289,9 @@ abstract class VAJLocalUtil implements VAJUtil Vector expandedDescs = getExpandedDescriptions( projectDescriptions ); // output warnings for projects not found - for( Enumeration e = projectDescriptions.elements(); e.hasMoreElements(); ) + for( Enumeration e = projectDescriptions.elements(); e.hasMoreElements(); ) { - VAJProjectDescription d = ( VAJProjectDescription )e.nextElement(); + VAJProjectDescription d = (VAJProjectDescription)e.nextElement(); if( !d.projectFound() ) { log( "No Projects match the name " + d.getName(), MSG_WARN ); @@ -302,9 +302,9 @@ abstract class VAJLocalUtil implements VAJUtil + " project(s) into workspace", MSG_INFO ); for( Enumeration e = expandedDescs.elements(); - e.hasMoreElements(); ) + e.hasMoreElements(); ) { - VAJProjectDescription d = ( VAJProjectDescription )e.nextElement(); + VAJProjectDescription d = (VAJProjectDescription)e.nextElement(); ProjectEdition pe = findProjectEdition( d.getName(), d.getVersion() ); try @@ -315,13 +315,12 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException ex ) { - throw createBuildException( "Project '" + d.getName() - + "' could not be loaded.", ex ); + throw createTaskException( "Project '" + d.getName() + + "' could not be loaded.", ex ); } } } - /** * return project descriptions containing full project names instead of * patterns with wildcards. @@ -339,15 +338,15 @@ abstract class VAJLocalUtil implements VAJUtil for( int i = 0; i < projectNames.length; i++ ) { for( Enumeration e = projectDescs.elements(); - e.hasMoreElements(); ) + e.hasMoreElements(); ) { - VAJProjectDescription d = ( VAJProjectDescription )e.nextElement(); + VAJProjectDescription d = (VAJProjectDescription)e.nextElement(); String pattern = d.getName(); - if( VAJWorkspaceScanner.match( pattern, projectNames[i] ) ) + if( VAJWorkspaceScanner.match( pattern, projectNames[ i ] ) ) { d.setProjectFound(); expandedDescs.addElement( new VAJProjectDescription( - projectNames[i], d.getVersion() ) ); + projectNames[ i ], d.getVersion() ) ); break; } } @@ -355,7 +354,7 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException e ) { - throw createBuildException( "VA Exception occured: ", e ); + throw createTaskException( "VA Exception occured: ", e ); } return expandedDescs; @@ -371,14 +370,14 @@ abstract class VAJLocalUtil implements VAJUtil * @param summaryLog buffer for logging */ private void addFilesToImport( - ImportCodeSpec spec, boolean doImport, - Vector files, String fileType, - StringBuffer summaryLog ) + ImportCodeSpec spec, boolean doImport, + Vector files, String fileType, + StringBuffer summaryLog ) { if( doImport ) { - String[] fileArr = new String[files.size()]; + String[] fileArr = new String[ files.size() ]; files.copyInto( fileArr ); try { @@ -392,7 +391,7 @@ abstract class VAJLocalUtil implements VAJUtil } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } if( files.size() > 0 ) { @@ -419,15 +418,15 @@ abstract class VAJLocalUtil implements VAJUtil } catch( IvjException e ) { - throw createBuildException( "VA Exception occured: ", e ); + throw createTaskException( "VA Exception occured: ", e ); } Vector matchingProjects = new Vector(); for( int i = 0; i < projectNames.length; i++ ) { - if( VAJWorkspaceScanner.match( pattern, projectNames[i] ) ) + if( VAJWorkspaceScanner.match( pattern, projectNames[ i ] ) ) { - matchingProjects.addElement( projectNames[i] ); + matchingProjects.addElement( projectNames[ i ] ); } } @@ -442,7 +441,7 @@ abstract class VAJLocalUtil implements VAJUtil * @return com.ibm.ivj.util.base.ProjectEdition the specified edition */ private ProjectEdition findProjectEdition( - String name, String versionName ) + String name, String versionName ) { try { @@ -451,27 +450,27 @@ abstract class VAJLocalUtil implements VAJUtil if( editions == null ) { - throw new BuildException( "Project " + name + " doesn't exist" ); + throw new TaskException( "Project " + name + " doesn't exist" ); } ProjectEdition pe = null; for( int i = 0; i < editions.length && pe == null; i++ ) { - if( versionName.equals( editions[i].getVersionName() ) ) + if( versionName.equals( editions[ i ].getVersionName() ) ) { - pe = editions[i]; + pe = editions[ i ]; } } if( pe == null ) { - throw new BuildException( "Version " + versionName - + " of Project " + name + " doesn't exist" ); + throw new TaskException( "Version " + versionName + + " of Project " + name + " doesn't exist" ); } return pe; } catch( IvjException e ) { - throw createBuildException( "VA Exception occured: ", e ); + throw createTaskException( "VA Exception occured: ", e ); } } @@ -485,13 +484,12 @@ abstract class VAJLocalUtil implements VAJUtil private void logFiles( Vector fileNames, String fileType ) { log( fileType + " files found for import:", MSG_VERBOSE ); - for( Enumeration e = fileNames.elements(); e.hasMoreElements(); ) + for( Enumeration e = fileNames.elements(); e.hasMoreElements(); ) { log( " " + e.nextElement(), MSG_VERBOSE ); } } - /** * Sort the files into classes, sources, and resources. * @@ -502,28 +500,27 @@ abstract class VAJLocalUtil implements VAJUtil * @param resources Description of Parameter */ private void scanForImport( - File dir, - String[] files, - Vector classes, - Vector sources, - Vector resources ) + File dir, + String[] files, + Vector classes, + Vector sources, + Vector resources ) { for( int i = 0; i < files.length; i++ ) { - String file = ( new File( dir, files[i] ) ).getAbsolutePath(); + String file = ( new File( dir, files[ i ] ) ).getAbsolutePath(); if( file.endsWith( ".java" ) || file.endsWith( ".JAVA" ) ) { sources.addElement( file ); } - else - if( file.endsWith( ".class" ) || file.endsWith( ".CLASS" ) ) + else if( file.endsWith( ".class" ) || file.endsWith( ".CLASS" ) ) { classes.addElement( file ); } else { // for resources VA expects the path relative to the resource path - resources.addElement( files[i] ); + resources.addElement( files[ i ] ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJProjectDescription.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJProjectDescription.java index 9e2105863..42da4632b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJProjectDescription.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJProjectDescription.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Type class. Holds information about a project edition. @@ -20,7 +21,9 @@ public class VAJProjectDescription private boolean projectFound; private String version; - public VAJProjectDescription() { } + public VAJProjectDescription() + { + } public VAJProjectDescription( String n, String v ) { @@ -32,7 +35,7 @@ public class VAJProjectDescription { if( newName == null || newName.equals( "" ) ) { - throw new BuildException( "name attribute must be set" ); + throw new TaskException( "name attribute must be set" ); } name = newName; } @@ -46,7 +49,7 @@ public class VAJProjectDescription { if( newVersion == null || newVersion.equals( "" ) ) { - throw new BuildException( "version attribute must be set" ); + throw new TaskException( "version attribute must be set" ); } version = newVersion; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java index 119ce308f..4288d36c9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJRemoteUtil.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -15,12 +16,12 @@ import java.net.HttpURLConnection; import java.net.URL; 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; /** * Helper class for VAJ tasks. Holds Workspace singleton and wraps IvjExceptions - * into BuildExceptions + * into TaskExceptions * * @author Wolf Siberski, TUI Infotec GmbH */ @@ -59,17 +60,17 @@ class VAJRemoteUtil implements VAJUtil try { String request = "http://" + remoteServer + "/servlet/vajexport?" - + VAJExportServlet.WITH_DEBUG_INFO + "=" + exportDebugInfo + "&" - + VAJExportServlet.OVERWRITE_PARAM + "=" + overwrite + "&" - + assembleImportExportParams( destDir, - includePatterns, excludePatterns, - exportClasses, exportResources, - exportSources, useDefaultExcludes ); + + VAJExportServlet.WITH_DEBUG_INFO + "=" + exportDebugInfo + "&" + + VAJExportServlet.OVERWRITE_PARAM + "=" + overwrite + "&" + + assembleImportExportParams( destDir, + includePatterns, excludePatterns, + exportClasses, exportResources, + exportSources, useDefaultExcludes ); sendRequest( request ); } catch( Exception ex ) { - throw new BuildException( "Error", ex ); + throw new TaskException( "Error", ex ); } } @@ -86,25 +87,25 @@ class VAJRemoteUtil implements VAJUtil * @param useDefaultExcludes Description of Parameter */ public void importFiles( - String importProject, File srcDir, - String[] includePatterns, String[] excludePatterns, - boolean importClasses, boolean importResources, - boolean importSources, boolean useDefaultExcludes ) + String importProject, File srcDir, + String[] includePatterns, String[] excludePatterns, + boolean importClasses, boolean importResources, + boolean importSources, boolean useDefaultExcludes ) { try { String request = "http://" + remoteServer + "/servlet/vajimport?" - + VAJImportServlet.PROJECT_NAME_PARAM + "=" - + importProject + "&" - + assembleImportExportParams( srcDir, - includePatterns, excludePatterns, - importClasses, importResources, - importSources, useDefaultExcludes ); + + VAJImportServlet.PROJECT_NAME_PARAM + "=" + + importProject + "&" + + assembleImportExportParams( srcDir, + includePatterns, excludePatterns, + importClasses, importResources, + importSources, useDefaultExcludes ); sendRequest( request ); } catch( Exception ex ) { - throw new BuildException( "Error", ex ); + throw new TaskException( "Error", ex ); } } @@ -120,14 +121,14 @@ class VAJRemoteUtil implements VAJUtil { String request = "http://" + remoteServer + "/servlet/vajload?"; String delimiter = ""; - for( Enumeration e = projectDescriptions.elements(); e.hasMoreElements(); ) + for( Enumeration e = projectDescriptions.elements(); e.hasMoreElements(); ) { - VAJProjectDescription pd = ( VAJProjectDescription )e.nextElement(); + VAJProjectDescription pd = (VAJProjectDescription)e.nextElement(); request = request - + delimiter + VAJLoadServlet.PROJECT_NAME_PARAM - + "=" + pd.getName().replace( ' ', '+' ) - + "&" + VAJLoadServlet.VERSION_PARAM - + "=" + pd.getVersion().replace( ' ', '+' ); + + delimiter + VAJLoadServlet.PROJECT_NAME_PARAM + + "=" + pd.getName().replace( ' ', '+' ) + + "&" + VAJLoadServlet.VERSION_PARAM + + "=" + pd.getVersion().replace( ' ', '+' ); //the first param needs no delimiter, but all other delimiter = "&"; } @@ -135,7 +136,7 @@ class VAJRemoteUtil implements VAJUtil } catch( Exception ex ) { - throw new BuildException( "Error", ex ); + throw new TaskException( "Error", ex ); } } @@ -164,25 +165,25 @@ class VAJRemoteUtil implements VAJUtil * @return Description of the Returned Value */ private String assembleImportExportParams( - File dir, - String[] includePatterns, String[] excludePatterns, - boolean includeClasses, boolean includeResources, - boolean includeSources, boolean useDefaultExcludes ) + File dir, + String[] includePatterns, String[] excludePatterns, + boolean includeClasses, boolean includeResources, + boolean includeSources, boolean useDefaultExcludes ) { String result = VAJToolsServlet.DIR_PARAM + "=" - + dir.getAbsolutePath().replace( '\\', '/' ) + "&" - + VAJToolsServlet.CLASSES_PARAM + "=" + includeClasses + "&" - + VAJToolsServlet.RESOURCES_PARAM + "=" + includeResources + "&" - + VAJToolsServlet.SOURCES_PARAM + "=" + includeSources + "&" - + VAJToolsServlet.DEFAULT_EXCLUDES_PARAM + "=" + useDefaultExcludes; + + dir.getAbsolutePath().replace( '\\', '/' ) + "&" + + VAJToolsServlet.CLASSES_PARAM + "=" + includeClasses + "&" + + VAJToolsServlet.RESOURCES_PARAM + "=" + includeResources + "&" + + VAJToolsServlet.SOURCES_PARAM + "=" + includeSources + "&" + + VAJToolsServlet.DEFAULT_EXCLUDES_PARAM + "=" + useDefaultExcludes; if( includePatterns != null ) { for( int i = 0; i < includePatterns.length; i++ ) { result = result + "&" + VAJExportServlet.INCLUDE_PARAM + "=" - + includePatterns[i].replace( ' ', '+' ).replace( '\\', '/' ); + + includePatterns[ i ].replace( ' ', '+' ).replace( '\\', '/' ); } } if( excludePatterns != null ) @@ -190,7 +191,7 @@ class VAJRemoteUtil implements VAJUtil for( int i = 0; i < excludePatterns.length; i++ ) { result = result + "&" + VAJExportServlet.EXCLUDE_PARAM + "=" - + excludePatterns[i].replace( ' ', '+' ).replace( '\\', '/' ); + + excludePatterns[ i ].replace( ' ', '+' ).replace( '\\', '/' ); } } @@ -212,7 +213,7 @@ class VAJRemoteUtil implements VAJUtil //must be HTTP connection URL requestUrl = new URL( request ); HttpURLConnection connection = - ( HttpURLConnection )requestUrl.openConnection(); + (HttpURLConnection)requestUrl.openConnection(); InputStream is = null; // retry three times @@ -230,7 +231,7 @@ class VAJRemoteUtil implements VAJUtil if( is == null ) { log( "Can't get " + request, MSG_ERR ); - throw new BuildException( "Couldn't execute " + request ); + throw new TaskException( "Couldn't execute " + request ); } // log the response @@ -260,11 +261,11 @@ class VAJRemoteUtil implements VAJUtil catch( IOException ex ) { log( "Error sending tool request to VAJ" + ex, MSG_ERR ); - throw new BuildException( "Couldn't execute " + request ); + throw new TaskException( "Couldn't execute " + request ); } if( requestFailed ) { - throw new BuildException( "VAJ tool request failed" ); + throw new TaskException( "VAJ tool request failed" ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java index 3c19052ec..24269204b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJTask.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + /** * Super class for all VAJ tasks. Contains common attributes (remoteServer) and * util methods * * @author: Wolf Siberski */ -import org.apache.tools.ant.Task; +import org.apache.tools.ant.Task; public class VAJTask extends Task { @@ -34,7 +35,6 @@ public class VAJTask extends Task this.remoteServer = remoteServer; } - /** * returns the VAJUtil implementation * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java index c27e163b9..e5045fca8 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJToolsServlet.java @@ -6,14 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.util.StringUtils; /** @@ -63,7 +62,7 @@ public abstract class VAJToolsServlet extends HttpServlet initRequest(); executeRequest(); } - catch( BuildException e ) + catch( TaskException e ) { util.log( "Error occured: " + e.getMessage(), VAJUtil.MSG_ERR ); } @@ -71,11 +70,11 @@ public abstract class VAJToolsServlet extends HttpServlet { try { - if( !( e instanceof BuildException ) ) + if( !( e instanceof TaskException ) ) { String trace = StringUtils.getStackTrace( e ); util.log( "Program error in " + this.getClass().getName() - + ":\n" + trace, VAJUtil.MSG_ERR ); + + ":\n" + trace, VAJUtil.MSG_ERR ); } } catch( Throwable t ) @@ -84,7 +83,7 @@ public abstract class VAJToolsServlet extends HttpServlet } finally { - if( !( e instanceof BuildException ) ) + if( !( e instanceof TaskException ) ) { throw new ServletException( e.getMessage() ); } @@ -137,7 +136,7 @@ public abstract class VAJToolsServlet extends HttpServlet { return null; } - return paramValuesArray[0]; + return paramValuesArray[ 0 ]; } /** @@ -151,7 +150,6 @@ public abstract class VAJToolsServlet extends HttpServlet return request.getParameterValues( param ); } - /** * Execute the request by calling the appropriate VAJ tool API methods. This * method must be implemented by the concrete servlets @@ -219,15 +217,15 @@ public abstract class VAJToolsServlet extends HttpServlet nlPos = msg.length(); } response.getWriter().println( Integer.toString( level ) - + " " + msg.substring( i, nlPos ) ); + + " " + msg.substring( i, nlPos ) ); i = nlPos + 1; } } } catch( IOException e ) { - throw new BuildException( "logging failed. msg was: " - + e.getMessage() ); + throw new TaskException( "logging failed. msg was: " + + e.getMessage() ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java index 203b97252..5fe92868b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJUtil.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import java.io.File; import java.util.Vector; @@ -38,11 +39,11 @@ interface VAJUtil * @param overwrite Description of Parameter */ void exportPackages( - File dest, - String[] includePatterns, String[] excludePatterns, - boolean exportClasses, boolean exportDebugInfo, - boolean exportResources, boolean exportSources, - boolean useDefaultExcludes, boolean overwrite ); + File dest, + String[] includePatterns, String[] excludePatterns, + boolean exportClasses, boolean exportDebugInfo, + boolean exportResources, boolean exportSources, + boolean useDefaultExcludes, boolean overwrite ); /** * Do the import. @@ -57,10 +58,10 @@ interface VAJUtil * @param useDefaultExcludes Description of Parameter */ void importFiles( - String importProject, File srcDir, - String[] includePatterns, String[] excludePatterns, - boolean importClasses, boolean importResources, - boolean importSources, boolean useDefaultExcludes ); + String importProject, File srcDir, + String[] includePatterns, String[] excludePatterns, + boolean importClasses, boolean importResources, + boolean importSources, boolean useDefaultExcludes ); /** * Load specified projects. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java index 9624722af..65ca0fefc 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/ide/VAJWorkspaceScanner.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.ide; + import com.ibm.ivj.util.base.IvjException; import com.ibm.ivj.util.base.Package; import com.ibm.ivj.util.base.Project; @@ -45,11 +46,11 @@ class VAJWorkspaceScanner extends DirectoryScanner // Patterns that should be excluded by default. private final static String[] DEFAULTEXCLUDES = { - "IBM*/**", - "Java class libraries/**", - "Sun class libraries*/**", - "JSP Page Compile Generated Code/**", - "VisualAge*/**", + "IBM*/**", + "Java class libraries/**", + "Sun class libraries*/**", + "JSP Page Compile Generated Code/**", + "VisualAge*/**", }; // The packages that where found and matched at least @@ -80,10 +81,10 @@ class VAJWorkspaceScanner extends DirectoryScanner public Package[] getIncludedPackages() { int count = packagesIncluded.size(); - Package[] packages = new Package[count]; + Package[] packages = new Package[ count ]; for( int i = 0; i < count; i++ ) { - packages[i] = ( Package )packagesIncluded.elementAt( i ); + packages[ i ] = (Package)packagesIncluded.elementAt( i ); } return packages; } @@ -95,14 +96,14 @@ class VAJWorkspaceScanner extends DirectoryScanner { int excludesLength = excludes == null ? 0 : excludes.length; String[] newExcludes; - newExcludes = new String[excludesLength + DEFAULTEXCLUDES.length]; + newExcludes = new String[ excludesLength + DEFAULTEXCLUDES.length ]; if( excludesLength > 0 ) { System.arraycopy( excludes, 0, newExcludes, 0, excludesLength ); } for( int i = 0; i < DEFAULTEXCLUDES.length; i++ ) { - newExcludes[i + excludesLength] = DEFAULTEXCLUDES[i]. + newExcludes[ i + excludesLength ] = DEFAULTEXCLUDES[ i ]. replace( '/', File.separatorChar ). replace( '\\', File.separatorChar ); } @@ -123,11 +124,11 @@ class VAJWorkspaceScanner extends DirectoryScanner boolean allProjectsMatch = false; for( int i = 0; i < projects.length; i++ ) { - Project project = projects[i]; + Project project = projects[ i ]; for( int j = 0; j < includes.length && !allProjectsMatch; j++ ) { StringTokenizer tok = - new StringTokenizer( includes[j], File.separator ); + new StringTokenizer( includes[ j ], File.separator ); String projectNamePattern = tok.nextToken(); if( projectNamePattern.equals( "**" ) ) { @@ -135,8 +136,7 @@ class VAJWorkspaceScanner extends DirectoryScanner // all projects match allProjectsMatch = true; } - else - if( match( projectNamePattern, project.getName() ) ) + else if( match( projectNamePattern, project.getName() ) ) { matchingProjects.addElement( project ); break; @@ -149,7 +149,7 @@ class VAJWorkspaceScanner extends DirectoryScanner matchingProjects = new Vector(); for( int i = 0; i < projects.length; i++ ) { - matchingProjects.addElement( projects[i] ); + matchingProjects.addElement( projects[ i ] ); } } @@ -165,19 +165,19 @@ class VAJWorkspaceScanner extends DirectoryScanner if( includes == null ) { // No includes supplied, so set it to 'matches all' - includes = new String[1]; - includes[0] = "**"; + includes = new String[ 1 ]; + includes[ 0 ] = "**"; } if( excludes == null ) { - excludes = new String[0]; + excludes = new String[ 0 ]; } // only scan projects which are included in at least one include pattern Vector matchingProjects = findMatchingProjects(); - for( Enumeration e = matchingProjects.elements(); e.hasMoreElements(); ) + for( Enumeration e = matchingProjects.elements(); e.hasMoreElements(); ) { - Project project = ( Project )e.nextElement(); + Project project = (Project)e.nextElement(); scanProject( project ); } } @@ -197,14 +197,14 @@ class VAJWorkspaceScanner extends DirectoryScanner { for( int i = 0; i < packages.length; i++ ) { - Package item = packages[i]; + Package item = packages[ i ]; // replace '.' by file seperator because the patterns are // using file seperator syntax (and we can use the match // methods this way). String name = project.getName() - + File.separator - + item.getName().replace( '.', File.separatorChar ); + + File.separator + + item.getName().replace( '.', File.separatorChar ); if( isIncluded( name ) && !isExcluded( name ) ) { packagesIncluded.addElement( item ); @@ -214,7 +214,7 @@ class VAJWorkspaceScanner extends DirectoryScanner } catch( IvjException e ) { - throw VAJLocalUtil.createBuildException( "VA Exception occured: ", e ); + throw VAJLocalUtil.createTaskException( "VA Exception occured: ", e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java index 912a18bb9..3f5e1d93f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JJTree.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.javacc; + import java.io.File; import java.io.IOException; import java.util.Enumeration; 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.taskdefs.Execute; @@ -58,7 +59,6 @@ public class JJTree extends Task cmdl.setClassname( "COM.sun.labs.jjtree.Main" ); } - public void setBuildnodefiles( boolean buildNodeFiles ) { optionalAttrs.put( BUILD_NODE_FILES, new Boolean( buildNodeFiles ) ); @@ -130,21 +130,21 @@ public class JJTree extends Task } public void execute() - throws BuildException + throws TaskException { // load command line with optional attributes Enumeration iter = optionalAttrs.keys(); while( iter.hasMoreElements() ) { - String name = ( String )iter.nextElement(); + String name = (String)iter.nextElement(); Object value = optionalAttrs.get( name ); cmdl.createArgument().setValue( "-" + name + ":" + value.toString() ); } if( target == null || !target.isFile() ) { - throw new BuildException( "Invalid target: " + target ); + throw new TaskException( "Invalid target: " + target ); } // use the directory containing the target as the output directory @@ -154,7 +154,7 @@ public class JJTree extends Task } if( !outputDirectory.isDirectory() ) { - throw new BuildException( "'outputdirectory' " + outputDirectory + " is not a directory." ); + throw new TaskException( "'outputdirectory' " + outputDirectory + " is not a directory." ); } // convert backslashes to slashes, otherwise jjtree will put this as // comments and this seems to confuse javacc @@ -163,7 +163,7 @@ public class JJTree extends Task String targetName = target.getName(); final File javaFile = new File( outputDirectory, - targetName.substring( 0, targetName.indexOf( ".jjt" ) ) + ".jj" ); + targetName.substring( 0, targetName.indexOf( ".jjt" ) ) + ".jj" ); if( javaFile.exists() && target.lastModified() < javaFile.lastModified() ) { project.log( "Target is already built - skipping (" + target + ")" ); @@ -173,11 +173,11 @@ public class JJTree extends Task if( javaccHome == null || !javaccHome.isDirectory() ) { - throw new BuildException( "Javacchome not set." ); + throw new TaskException( "Javacchome not set." ); } final Path classpath = cmdl.createClasspath( project ); classpath.createPathElement().setPath( javaccHome.getAbsolutePath() + - "/JavaCC.zip" ); + "/JavaCC.zip" ); classpath.addJavaRuntime(); final Commandline.Argument arg = cmdl.createVmArgument(); @@ -186,9 +186,9 @@ public class JJTree extends Task final Execute process = new Execute( new LogStreamHandler( this, - Project.MSG_INFO, - Project.MSG_INFO ), - null ); + Project.MSG_INFO, + Project.MSG_INFO ), + null ); log( cmdl.toString(), Project.MSG_VERBOSE ); process.setCommandline( cmdl.getCommandline() ); @@ -196,12 +196,12 @@ public class JJTree extends Task { if( process.execute() != 0 ) { - throw new BuildException( "JJTree failed." ); + throw new TaskException( "JJTree failed." ); } } catch( IOException e ) { - throw new BuildException( "Failed to launch JJTree: " + e ); + throw new TaskException( "Failed to launch JJTree: " + e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java index f85e9089c..8d3a2af7e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.javacc; + import java.io.File; import java.util.Enumeration; 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.taskdefs.Execute; @@ -130,7 +131,6 @@ public class JavaCC extends Task optionalAttrs.put( JAVA_UNICODE_ESCAPE, new Boolean( javaUnicodeEscape ) ); } - public void setLookahead( int lookahead ) { optionalAttrs.put( LOOKAHEAD, new Integer( lookahead ) ); @@ -182,14 +182,14 @@ public class JavaCC extends Task } public void execute() - throws BuildException + throws TaskException { // load command line with optional attributes Enumeration iter = optionalAttrs.keys(); while( iter.hasMoreElements() ) { - String name = ( String )iter.nextElement(); + String name = (String)iter.nextElement(); Object value = optionalAttrs.get( name ); cmdl.createArgument().setValue( "-" + name + ":" + value.toString() ); } @@ -197,7 +197,7 @@ public class JavaCC extends Task // check the target is a file if( target == null || !target.isFile() ) { - throw new BuildException( "Invalid target: " + target ); + throw new TaskException( "Invalid target: " + target ); } // use the directory containing the target as the output directory @@ -207,7 +207,7 @@ public class JavaCC extends Task } else if( !outputDirectory.isDirectory() ) { - throw new BuildException( "Outputdir not a directory." ); + throw new TaskException( "Outputdir not a directory." ); } cmdl.createArgument().setValue( "-OUTPUT_DIRECTORY:" + outputDirectory.getAbsolutePath() ); @@ -223,11 +223,11 @@ public class JavaCC extends Task if( javaccHome == null || !javaccHome.isDirectory() ) { - throw new BuildException( "Javacchome not set." ); + throw new TaskException( "Javacchome not set." ); } final Path classpath = cmdl.createClasspath( project ); classpath.createPathElement().setPath( javaccHome.getAbsolutePath() + - "/JavaCC.zip" ); + "/JavaCC.zip" ); classpath.addJavaRuntime(); final Commandline.Argument arg = cmdl.createVmArgument(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java index 2efdae7e3..a53c643ea 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTask.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jdepend; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.PathTokenizer; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; @@ -62,7 +63,9 @@ public class JDependTask extends Task // required attributes private Path _sourcesPath; - public JDependTask() { } + public JDependTask() + { + } /** * Set the classpath to be used for this compilation. @@ -113,7 +116,6 @@ public class JDependTask extends Task _fork = value; } - public void setFormat( FormatAttribute ea ) { format = ea.getValue(); @@ -237,22 +239,21 @@ public class JDependTask extends Task } public void execute() - throws BuildException + throws TaskException { CommandlineJava commandline = new CommandlineJava(); if( "text".equals( format ) ) commandline.setClassname( "jdepend.textui.JDepend" ); - else - if( "xml".equals( format ) ) + else if( "xml".equals( format ) ) commandline.setClassname( "jdepend.xmlui.JDepend" ); if( _jvm != null ) commandline.setVm( _jvm ); if( getSourcespath() == null ) - throw new BuildException( "Missing Sourcepath required argument" ); + throw new TaskException( "Missing Sourcepath required argument" ); // execute the test and get the return code int exitValue = JDependTask.ERRORS; @@ -280,7 +281,7 @@ public class JDependTask extends Task if( errorOccurred ) { if( getHaltonerror() ) - throw new BuildException( "JDepend failed" ); + throw new TaskException( "JDepend failed" ); else log( "JDepend FAILED", Project.MSG_ERR ); } @@ -297,11 +298,11 @@ public class JDependTask extends Task * case the test could probably hang forever. * @param commandline Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ // JL: comment extracted from JUnitTask (and slightly modified) public int executeAsForked( CommandlineJava commandline, ExecuteWatchdog watchdog ) - throws BuildException + throws TaskException { // if not set, auto-create the ClassPath from the project createClasspath(); @@ -330,7 +331,7 @@ public class JDependTask extends Task // not necessary as JDepend would fail, but why loose some time? if( !f.exists() || !f.isDirectory() ) - throw new BuildException( "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail." ); + throw new TaskException( "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail." ); commandline.createArgument().setValue( f.getPath() ); } @@ -351,7 +352,7 @@ public class JDependTask extends Task } catch( IOException e ) { - throw new BuildException( "Process fork failed.", e ); + throw new TaskException( "Process fork failed.", e ); } } @@ -366,10 +367,10 @@ public class JDependTask extends Task * * @param commandline Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public int executeInVM( CommandlineJava commandline ) - throws BuildException + throws TaskException { jdepend.textui.JDepend jdepend; @@ -389,7 +390,7 @@ public class JDependTask extends Task { String msg = "JDepend Failed when creating the output file: " + e.getMessage(); log( msg ); - throw new BuildException( msg ); + throw new TaskException( msg ); } jdepend.setWriter( new PrintWriter( fw ) ); log( "Output to be stored in " + getOutputFile().getPath() ); @@ -405,7 +406,7 @@ public class JDependTask extends Task { String msg = "\"" + f.getPath() + "\" does not represent a valid directory. JDepend would fail."; log( msg ); - throw new BuildException( msg ); + throw new TaskException( msg ); } try { @@ -415,7 +416,7 @@ public class JDependTask extends Task { String msg = "JDepend Failed when adding a source directory: " + e.getMessage(); log( msg ); - throw new BuildException( msg ); + throw new TaskException( msg ); } } jdepend.analyze(); @@ -425,10 +426,10 @@ public class JDependTask extends Task /** * @return null if there is a timeout value, otherwise the watchdog * instance. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected ExecuteWatchdog createWatchdog() - throws BuildException + throws TaskException { return null; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java index b1a089810..59c9cfa84 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jlink; + import java.io.DataInput; import java.io.DataInputStream; import java.io.IOException; @@ -37,8 +38,8 @@ public class ClassNameReader extends Object // read access flags and class index. int accessFlags = data.readUnsignedShort(); int classIndex = data.readUnsignedShort(); - Integer stringIndex = ( Integer )values[classIndex]; - String className = ( String )values[stringIndex.intValue()]; + Integer stringIndex = (Integer)values[ classIndex ]; + String className = (String)values[ stringIndex.intValue() ]; return className; } @@ -55,10 +56,9 @@ public class ClassNameReader extends Object class ConstantPool extends Object { - final static byte UTF8 = 1, UNUSED = 2, INTEGER = 3, FLOAT = 4, LONG = 5, DOUBLE = 6, - CLASS = 7, STRING = 8, FIELDREF = 9, METHODREF = 10, - INTERFACEMETHODREF = 11, NAMEANDTYPE = 12; + CLASS = 7, STRING = 8, FIELDREF = 9, METHODREF = 10, + INTERFACEMETHODREF = 11, NAMEANDTYPE = 12; byte[] types; @@ -70,44 +70,44 @@ class ConstantPool extends Object super(); int count = data.readUnsignedShort(); - types = new byte[count]; - values = new Object[count]; + types = new byte[ count ]; + values = new Object[ count ]; // read in all constant pool entries. for( int i = 1; i < count; i++ ) { byte type = data.readByte(); - types[i] = type; - switch ( type ) + types[ i ] = type; + switch( type ) { - case UTF8: - values[i] = data.readUTF(); - break; - case UNUSED: - break; - case INTEGER: - values[i] = new Integer( data.readInt() ); - break; - case FLOAT: - values[i] = new Float( data.readFloat() ); - break; - case LONG: - values[i] = new Long( data.readLong() ); - ++i; - break; - case DOUBLE: - values[i] = new Double( data.readDouble() ); - ++i; - break; - case CLASS: - case STRING: - values[i] = new Integer( data.readUnsignedShort() ); - break; - case FIELDREF: - case METHODREF: - case INTERFACEMETHODREF: - case NAMEANDTYPE: - values[i] = new Integer( data.readInt() ); - break; + case UTF8: + values[ i ] = data.readUTF(); + break; + case UNUSED: + break; + case INTEGER: + values[ i ] = new Integer( data.readInt() ); + break; + case FLOAT: + values[ i ] = new Float( data.readFloat() ); + break; + case LONG: + values[ i ] = new Long( data.readLong() ); + ++i; + break; + case DOUBLE: + values[ i ] = new Double( data.readDouble() ); + ++i; + break; + case CLASS: + case STRING: + values[ i ] = new Integer( data.readUnsignedShort() ); + break; + case FIELDREF: + case METHODREF: + case INTERFACEMETHODREF: + case NAMEANDTYPE: + values[ i ] = new Integer( data.readInt() ); + break; } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java index a053c2111..4261a067f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/JlinkTask.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jlink; + 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.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; @@ -138,19 +139,19 @@ public class JlinkTask extends MatchingTask /** * Does the adding and merging. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { //Be sure everything has been set. if( outfile == null ) { - throw new BuildException( "outfile attribute is required! Please set." ); + throw new TaskException( "outfile attribute is required! Please set." ); } if( !haveAddFiles() && !haveMergeFiles() ) { - throw new BuildException( "addfiles or mergefiles required! Please set." ); + throw new TaskException( "addfiles or mergefiles required! Please set." ); } log( "linking: " + outfile.getPath() ); log( "compression: " + compress, Project.MSG_VERBOSE ); @@ -173,7 +174,7 @@ public class JlinkTask extends MatchingTask } catch( Exception ex ) { - throw new BuildException( "Error", ex); + throw new TaskException( "Error", ex ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java index cb9a3fbe8..1c8c015af 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jlink; + import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -32,7 +33,7 @@ public class jlink extends Object private boolean compression = false; - byte[] buffer = new byte[8192]; + byte[] buffer = new byte[ 8192 ]; public static void main( String[] args ) { @@ -43,11 +44,11 @@ public class jlink extends Object System.exit( 1 ); } jlink linker = new jlink(); - linker.setOutfile( args[0] ); + linker.setOutfile( args[ 0 ] ); //To maintain compatibility with the command-line version, we will only add files to be merged. for( int i = 1; i < args.length; i++ ) { - linker.addMergeFile( args[i] ); + linker.addMergeFile( args[ i ] ); } try { @@ -110,7 +111,7 @@ public class jlink extends Object } for( int i = 0; i < addfiles.length; i++ ) { - addAddFile( addfiles[i] ); + addAddFile( addfiles[ i ] ); } } @@ -141,7 +142,7 @@ public class jlink extends Object } for( int i = 0; i < mergefiles.length; i++ ) { - addMergeFile( mergefiles[i] ); + addMergeFile( mergefiles[ i ] ); } } @@ -174,7 +175,7 @@ public class jlink extends Object Enumeration merges = mergefiles.elements(); while( merges.hasMoreElements() ) { - String path = ( String )merges.nextElement(); + String path = (String)merges.nextElement(); File f = new File( path ); if( f.getName().endsWith( ".jar" ) || f.getName().endsWith( ".zip" ) ) { @@ -191,7 +192,7 @@ public class jlink extends Object Enumeration adds = addfiles.elements(); while( adds.hasMoreElements() ) { - String name = ( String )adds.nextElement(); + String name = (String)adds.nextElement(); File f = new File( name ); if( f.isDirectory() ) { @@ -210,7 +211,8 @@ public class jlink extends Object output.close(); } catch( IOException ioe ) - {} + { + } } } @@ -236,7 +238,8 @@ public class jlink extends Object } } catch( IOException ioe ) - {} + { + } } System.out.println( "From " + file.getPath() + " and prefix " + prefix + ", creating entry " + prefix + name ); return ( prefix + name ); @@ -251,7 +254,7 @@ public class jlink extends Object String[] contents = dir.list(); for( int i = 0; i < contents.length; ++i ) { - String name = contents[i]; + String name = contents[ i ]; File file = new File( dir, name ); if( file.isDirectory() ) { @@ -359,7 +362,7 @@ public class jlink extends Object Enumeration entries = zipf.entries(); while( entries.hasMoreElements() ) { - ZipEntry inputEntry = ( ZipEntry )entries.nextElement(); + ZipEntry inputEntry = (ZipEntry)entries.nextElement(); //Ignore manifest entries. They're bound to cause conflicts between //files that are being merged. User should supply their own //manifest file when doing the merge. @@ -439,7 +442,8 @@ public class jlink extends Object } } catch( IOException ioe ) - {} + { + } } ZipEntry outputEntry = new ZipEntry( name ); outputEntry.setTime( inputEntry.getTime() ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java index ae6938f5a..3ed023fae 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp; + import java.io.File; import java.util.Date; 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; @@ -63,7 +64,7 @@ public class JspC extends MatchingTask { private final static String FAIL_MSG - = "Compile failed, messages should have been provided."; + = "Compile failed, messages should have been provided."; private int verbose = 0; protected Vector compileList = new Vector(); protected boolean failOnError = true; @@ -135,7 +136,7 @@ public class JspC extends MatchingTask * ------------------------------------------------------------ */ /** - * Throw a BuildException if compilation fails + * Throw a TaskException if compilation fails * * @param fail The new Failonerror value */ @@ -318,24 +319,24 @@ public class JspC extends MatchingTask * ------------------------------------------------------------ */ 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" ); + TaskException( "destination directory \"" + destDir + + "\" does not exist or is not a directory" ); } // calculate where the files will end up: @@ -355,11 +356,11 @@ public class JspC extends MatchingTask int filecount = 0; for( int i = 0; i < list.length; i++ ) { - File srcDir = ( File )resolveFile( list[i] ); + 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 ); @@ -384,7 +385,7 @@ public class JspC extends MatchingTask CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( compiler, this ); log( "Compiling " + compileList.size() + - " source file" + " source file" + ( compileList.size() == 1 ? "" : "s" ) + ( destDir != null ? " to " + destDir : "" ) ); @@ -396,7 +397,7 @@ public class JspC extends MatchingTask { if( failOnError ) { - throw new BuildException( FAIL_MSG ); + throw new TaskException( FAIL_MSG ); } else { @@ -446,19 +447,19 @@ public class JspC extends MatchingTask for( int i = 0; i < files.length; i++ ) { - File srcFile = new File( srcDir, files[i] ); - if( files[i].endsWith( ".jsp" ) ) + File srcFile = new File( srcDir, files[ i ] ); + if( files[ i ].endsWith( ".jsp" ) ) { // drop leading path (if any) int fileStart = - files[i].lastIndexOf( File.separatorChar ) + 1; - File javaFile = new File( destDir, files[i].substring( fileStart, - files[i].indexOf( ".jsp" ) ) + ".java" ); + files[ i ].lastIndexOf( File.separatorChar ) + 1; + File javaFile = new File( destDir, files[ i ].substring( fileStart, + files[ i ].indexOf( ".jsp" ) ) + ".java" ); if( srcFile.lastModified() > now ) { log( "Warning: file modified in the future: " + - files[i], Project.MSG_WARN ); + files[ i ], Project.MSG_WARN ); } if( !javaFile.exists() || @@ -467,14 +468,14 @@ public class JspC extends MatchingTask if( !javaFile.exists() ) { log( "Compiling " + srcFile.getPath() + - " because java file " + " because java file " + javaFile.getPath() + " does not exist", - Project.MSG_DEBUG ); + Project.MSG_DEBUG ); } else { log( "Compiling " + srcFile.getPath() + - " because it is out of date with respect to " + " because it is out of date with respect to " + javaFile.getPath(), Project.MSG_DEBUG ); } compileList.addElement( srcFile.getAbsolutePath() ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java index 0c8e43a4b..0a9a1b07b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java @@ -6,14 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp;//java imports + import java.io.File; import java.util.Date; 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.DirectoryScanner; import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Java;//apache/ant imports +import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.MatchingTask; import org.apache.tools.ant.types.Path; @@ -67,7 +68,6 @@ public class WLJspc extends MatchingTask private String destinationPackage;//root of compiled files tree private File sourceDirectory; - /** * Set the classpath to be used for this compilation. * @@ -133,23 +133,23 @@ public class WLJspc extends MatchingTask } public void execute() - throws BuildException + throws TaskException { if( !destinationDirectory.isDirectory() ) { - throw new BuildException( "destination directory " + destinationDirectory.getPath() + - " is not valid" ); + throw new TaskException( "destination directory " + destinationDirectory.getPath() + + " is not valid" ); } if( !sourceDirectory.isDirectory() ) { - throw new BuildException( "src directory " + sourceDirectory.getPath() + - " is not valid" ); + throw new TaskException( "src directory " + sourceDirectory.getPath() + + " is not valid" ); } if( destinationPackage == null ) { - throw new BuildException( "package attribute must be present." ); + throw new TaskException( "package attribute must be present." ); } String systemClassPath = System.getProperty( "java.class.path" ); @@ -171,31 +171,31 @@ public class WLJspc extends MatchingTask // Therefore, takes loads of time // Can pass directories at a time (*.jsp) but easily runs out of memory on hefty dirs // (even on a Sun) - Java helperTask = ( Java )project.createTask( "java" ); + Java helperTask = (Java)project.createTask( "java" ); helperTask.setFork( true ); helperTask.setClassname( "weblogic.jspc" ); helperTask.setTaskName( getTaskName() ); - String[] args = new String[12]; + String[] args = new String[ 12 ]; File jspFile = null; String parents = ""; String arg = ""; int j = 0; //XXX this array stuff is a remnant of prev trials.. gotta remove. - args[j++] = "-d"; - args[j++] = destinationDirectory.getAbsolutePath().trim(); - args[j++] = "-docroot"; - args[j++] = sourceDirectory.getAbsolutePath().trim(); - args[j++] = "-keepgenerated";//TODO: Parameterise ?? + args[ j++ ] = "-d"; + args[ j++ ] = destinationDirectory.getAbsolutePath().trim(); + args[ j++ ] = "-docroot"; + args[ j++ ] = sourceDirectory.getAbsolutePath().trim(); + args[ j++ ] = "-keepgenerated";//TODO: Parameterise ?? //Call compiler as class... dont want to fork again //Use classic compiler -- can be parameterised? - args[j++] = "-compilerclass"; - args[j++] = "sun.tools.javac.Main"; + args[ j++ ] = "-compilerclass"; + args[ j++ ] = "sun.tools.javac.Main"; //Weblogic jspc does not seem to work unless u explicitly set this... // Does not take the classpath from the env.... // Am i missing something about the Java task?? - args[j++] = "-classpath"; - args[j++] = compileClasspath.toString(); + args[ j++ ] = "-classpath"; + args[ j++ ] = compileClasspath.toString(); this.scanDir( files ); log( "Compiling " + filesToDo.size() + " JSP files" ); @@ -206,25 +206,25 @@ public class WLJspc extends MatchingTask // All this to get package according to weblogic standards // Can be written better... this is too hacky! // Careful.. similar code in scanDir , but slightly different!! - jspFile = new File( ( String )filesToDo.elementAt( i ) ); - args[j] = "-package"; + jspFile = new File( (String)filesToDo.elementAt( i ) ); + args[ j ] = "-package"; parents = jspFile.getParent(); if( ( parents != null ) && ( !( "" ).equals( parents ) ) ) { parents = this.replaceString( parents, File.separator, "_." ); - args[j + 1] = destinationPackage + "." + "_" + parents; + args[ j + 1 ] = destinationPackage + "." + "_" + parents; } else { - args[j + 1] = destinationPackage; + args[ j + 1 ] = destinationPackage; } - args[j + 2] = sourceDirectory + File.separator + ( String )filesToDo.elementAt( i ); + args[ j + 2 ] = sourceDirectory + File.separator + (String)filesToDo.elementAt( i ); arg = ""; for( int x = 0; x < 12; x++ ) { - arg += " " + args[x]; + arg += " " + args[ x ]; } System.out.println( "arg = " + arg ); @@ -234,12 +234,11 @@ public class WLJspc extends MatchingTask helperTask.setClasspath( compileClasspath ); if( helperTask.executeJava() != 0 ) { - log( files[i] + " failed to compile", Project.MSG_WARN ); + log( files[ i ] + " failed to compile", Project.MSG_WARN ); } } } - protected String replaceString( String inpString, String escapeChars, String replaceChars ) { String localString = ""; @@ -255,7 +254,6 @@ public class WLJspc extends MatchingTask return localString; } - protected void scanDir( String files[] ) { @@ -265,11 +263,11 @@ public class WLJspc extends MatchingTask String pack = ""; for( int i = 0; i < files.length; i++ ) { - File srcFile = new File( this.sourceDirectory, files[i] ); + File srcFile = new File( this.sourceDirectory, files[ i ] ); //XXX // All this to convert source to destination directory according to weblogic standards // Can be written better... this is too hacky! - jspFile = new File( files[i] ); + jspFile = new File( files[ i ] ); parents = jspFile.getParent(); int loc = 0; @@ -285,27 +283,27 @@ public class WLJspc extends MatchingTask String filePath = pack + File.separator + "_"; int startingIndex - = files[i].lastIndexOf( File.separator ) != -1 ? files[i].lastIndexOf( File.separator ) + 1 : 0; - int endingIndex = files[i].indexOf( ".jsp" ); + = files[ i ].lastIndexOf( File.separator ) != -1 ? files[ i ].lastIndexOf( File.separator ) + 1 : 0; + int endingIndex = files[ i ].indexOf( ".jsp" ); if( endingIndex == -1 ) { break; } - filePath += files[i].substring( startingIndex, endingIndex ); + filePath += files[ i ].substring( startingIndex, endingIndex ); filePath += ".class"; File classFile = new File( this.destinationDirectory, filePath ); if( srcFile.lastModified() > now ) { log( "Warning: file modified in the future: " + - files[i], Project.MSG_WARN ); + files[ i ], Project.MSG_WARN ); } if( srcFile.lastModified() > classFile.lastModified() ) { //log("Files are" + srcFile.getAbsolutePath()+" " +classFile.getAbsolutePath()); - filesToDo.addElement( files[i] ); - log( "Recompiling File " + files[i], Project.MSG_VERBOSE ); + filesToDo.addElement( files[ i ] ); + log( "Recompiling File " + files[ i ], Project.MSG_VERBOSE ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java index 62465e8d8..4365df9d6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapter.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.taskdefs.optional.jsp.JspC; /** @@ -37,8 +38,8 @@ public interface CompilerAdapter * Executes the task. * * @return has the compilation been successful - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean execute() - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java index 2e648a5ac..c090879db 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/CompilerAdapterFactory.java @@ -6,9 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; +import org.apache.myrmidon.api.TaskException; +import org.apache.tools.ant.Task; /** * Creates the necessary compiler adapter, given basic criteria. @@ -22,7 +22,9 @@ public class CompilerAdapterFactory /** * This is a singlton -- can't create instances!! */ - private CompilerAdapterFactory() { } + private CompilerAdapterFactory() + { + } /** * Based on the parameter passed in, this method creates the necessary @@ -39,11 +41,11 @@ public class CompilerAdapterFactory * classname of the compiler's adapter. * @param task a task to log through. * @return The Compiler value - * @throws BuildException if the compiler type could not be resolved into a + * @throws TaskException if the compiler type could not be resolved into a * compiler adapter. */ public static CompilerAdapter getCompiler( String compilerType, Task task ) - throws BuildException + throws TaskException { /* * If I've done things right, this should be the extent of the @@ -62,32 +64,32 @@ public class CompilerAdapterFactory * * @param className The fully qualified classname to be created. * @return Description of the Returned Value - * @throws BuildException This is the fit that is thrown if className isn't + * @throws TaskException This is the fit that is thrown if className isn't * an instance of CompilerAdapter. */ private static CompilerAdapter resolveClassName( String className ) - throws BuildException + throws TaskException { try { Class c = Class.forName( className ); Object o = c.newInstance(); - return ( CompilerAdapter )o; + return (CompilerAdapter)o; } catch( ClassNotFoundException cnfe ) { - throw new BuildException( className + " can\'t be found.", cnfe ); + throw new TaskException( className + " can\'t be found.", cnfe ); } catch( ClassCastException cce ) { - throw new BuildException( className + " isn\'t the classname of " - + "a compiler adapter.", cce ); + throw new TaskException( className + " isn\'t the classname of " + + "a compiler adapter.", cce ); } catch( Throwable t ) { // for all other possibilities - throw new BuildException( className + " caused an interesting " - + "exception.", t ); + throw new TaskException( className + " caused an interesting " + + "exception.", t ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java index 6c54419d4..704ee79af 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultCompilerAdapter.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; + import java.util.Enumeration; import java.util.Vector; import org.apache.tools.ant.Project; @@ -19,7 +20,7 @@ import org.apache.tools.ant.types.Commandline; * @author Matthew Watson mattw@i3sp.com */ public abstract class DefaultCompilerAdapter - implements CompilerAdapter + implements CompilerAdapter { /* * ------------------------------------------------------------ @@ -69,7 +70,7 @@ public abstract class DefaultCompilerAdapter Enumeration enum = compileList.elements(); while( enum.hasMoreElements() ) { - String arg = ( String )enum.nextElement(); + String arg = (String)enum.nextElement(); cmd.createArgument().setValue( arg ); niceSourceList.append( " " + arg + lSep ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java index bd169b9f6..a711952f4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/jsp/compilers/JasperC.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.jsp.compilers; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.taskdefs.optional.jsp.JspC; @@ -24,7 +25,7 @@ public class JasperC extends DefaultCompilerAdapter * ------------------------------------------------------------ */ public boolean execute() - throws BuildException + throws TaskException { getJspc().log( "Using jasper compiler", Project.MSG_VERBOSE ); Commandline cmd = setupJasperCommand(); @@ -33,27 +34,27 @@ public class JasperC extends DefaultCompilerAdapter { // Create an instance of the compiler, redirecting output to // the project log - Java java = ( Java )( getJspc().getProject() ).createTask( "java" ); + Java java = (Java)( getJspc().getProject() ).createTask( "java" ); if( getJspc().getClasspath() != null ) java.setClasspath( getJspc().getClasspath() ); java.setClassname( "org.apache.jasper.JspC" ); String args[] = cmd.getArguments(); for( int i = 0; i < args.length; i++ ) - java.createArg().setValue( args[i] ); + java.createArg().setValue( args[ i ] ); java.setFailonerror( true ); java.execute(); return true; } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error running jsp compiler: ", - ex ); + throw new TaskException( "Error running jsp compiler: ", + ex ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java index 123c51854..4951c172a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -14,17 +15,14 @@ import java.io.InputStream; import java.net.URL; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -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.util.FileUtils; import org.apache.tools.ant.types.EnumeratedAttribute; +import org.apache.tools.ant.util.FileUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; - - - /** * Transform a JUnit xml report. The default transformation generates an html * report in either framed or non-framed style. The non-framed style is @@ -121,7 +119,7 @@ public class AggregateTransformer } public void transform() - throws BuildException + throws TaskException { checkOptions(); final long t0 = System.currentTimeMillis(); @@ -133,7 +131,7 @@ public class AggregateTransformer } catch( Exception e ) { - throw new BuildException( "Errors while applying transformations", e ); + throw new TaskException( "Errors while applying transformations", e ); } final long dt = System.currentTimeMillis() - t0; task.log( "Transform time: " + dt + "ms" ); @@ -144,10 +142,10 @@ public class AggregateTransformer * file directly. Much more for testing purposes. * * @param xmlfile xml file to be processed - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void setXmlfile( File xmlfile ) - throws BuildException + throws TaskException { try { @@ -165,7 +163,7 @@ public class AggregateTransformer } catch( Exception e ) { - throw new BuildException( "Error while parsing document: " + xmlfile, e ); + throw new TaskException( "Error while parsing document: " + xmlfile, e ); } } @@ -209,10 +207,10 @@ public class AggregateTransformer /** * check for invalid options * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { // set the destination directory relative from the project if needed. if( toDir == null ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java index b2173d3e8..91ff9de58 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BaseTest.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.util.Vector; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java index 115e2c1a3..28e5d24eb 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.util.Enumeration; import java.util.Vector; @@ -103,7 +104,7 @@ public final class BatchTest extends BaseTest v.ensureCapacity( v.size() + tests.length ); for( int i = 0; i < tests.length; i++ ) { - v.addElement( tests[i] ); + v.addElement( tests[ i ] ); } } @@ -125,13 +126,13 @@ public final class BatchTest extends BaseTest final int size = this.filesets.size(); for( int j = 0; j < size; j++ ) { - FileSet fs = ( FileSet )filesets.elementAt( j ); + FileSet fs = (FileSet)filesets.elementAt( j ); DirectoryScanner ds = fs.getDirectoryScanner( project ); ds.scan(); String[] f = ds.getIncludedFiles(); for( int k = 0; k < f.length; k++ ) { - String pathname = f[k]; + String pathname = f[ k ]; if( pathname.endsWith( ".java" ) ) { v.addElement( pathname.substring( 0, pathname.length() - ".java".length() ) ); @@ -143,7 +144,7 @@ public final class BatchTest extends BaseTest } } - String[] files = new String[v.size()]; + String[] files = new String[ v.size() ]; v.copyInto( files ); return files; } @@ -157,11 +158,11 @@ public final class BatchTest extends BaseTest private JUnitTest[] createAllJUnitTest() { String[] filenames = getFilenames(); - JUnitTest[] tests = new JUnitTest[filenames.length]; + JUnitTest[] tests = new JUnitTest[ filenames.length ]; for( int i = 0; i < tests.length; i++ ) { - String classname = javaToClass( filenames[i] ); - tests[i] = createJUnitTest( classname ); + String classname = javaToClass( filenames[ i ] ); + tests[ i ] = createJUnitTest( classname ); } return tests; } @@ -190,7 +191,7 @@ public final class BatchTest extends BaseTest Enumeration list = this.formatters.elements(); while( list.hasMoreElements() ) { - test.addFormatter( ( FormatterElement )list.nextElement() ); + test.addFormatter( (FormatterElement)list.nextElement() ); } return test; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java index 81ee9ac8f..f23e5bf99 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import junit.framework.AssertionFailedError; import junit.framework.Test; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Prints plain text output of the test to a specified Writer. Inspired by the @@ -117,7 +118,7 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } /** @@ -125,16 +126,18 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter * * @param test Description of Parameter */ - public void endTest( Test test ) { } + public void endTest( Test test ) + { + } /** * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void endTestSuite( JUnitTest suite ) - throws BuildException + throws TaskException { String newLine = System.getProperty( "line.separator" ); StringBuffer sb = new StringBuffer( "Testsuite: " ); @@ -182,15 +185,16 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter } finally { - if( m_out != ( Object )System.out && - m_out != ( Object )System.err ) + if( m_out != (Object)System.out && + m_out != (Object)System.err ) { try { m_out.close(); } catch( java.io.IOException e ) - {} + { + } } } } @@ -201,16 +205,20 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter * * @param test Description of Parameter */ - public void startTest( Test test ) { } + public void startTest( Test test ) + { + } /** * The whole testsuite started. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void startTestSuite( JUnitTest suite ) - throws BuildException { } + throws TaskException + { + } /** * Format an error and print it. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java index 3fab8d7be..49ff9e78f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/DOMUtil.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.util.Vector; import org.w3c.dom.Attr; import org.w3c.dom.CDATASection; @@ -30,8 +31,9 @@ public final class DOMUtil /** * unused constructor */ - private DOMUtil() { } - + private DOMUtil() + { + } /** * Iterate over the children of a given node and return the first node that @@ -58,7 +60,7 @@ public final class DOMUtil if( child != null && child.getNodeType() == Node.ELEMENT_NODE && child.getNodeName().equals( tagname ) ) { - return ( Element )child; + return (Element)child; } } return null; @@ -77,7 +79,7 @@ public final class DOMUtil { if( node instanceof Element ) { - Element element = ( Element )node; + Element element = (Element)node; return element.getAttribute( name ); } return null; @@ -101,44 +103,44 @@ public final class DOMUtil Node copy = null; final Document doc = parent.getOwnerDocument(); - switch ( child.getNodeType() ) + switch( child.getNodeType() ) { - case Node.CDATA_SECTION_NODE: - copy = doc.createCDATASection( ( ( CDATASection )child ).getData() ); - break; - case Node.COMMENT_NODE: - copy = doc.createComment( ( ( Comment )child ).getData() ); - break; - case Node.DOCUMENT_FRAGMENT_NODE: - copy = doc.createDocumentFragment(); - break; - case Node.ELEMENT_NODE: - final Element elem = doc.createElement( ( ( Element )child ).getTagName() ); - copy = elem; - final NamedNodeMap attributes = child.getAttributes(); - if( attributes != null ) - { - final int size = attributes.getLength(); - for( int i = 0; i < size; i++ ) + case Node.CDATA_SECTION_NODE: + copy = doc.createCDATASection( ( (CDATASection)child ).getData() ); + break; + case Node.COMMENT_NODE: + copy = doc.createComment( ( (Comment)child ).getData() ); + break; + case Node.DOCUMENT_FRAGMENT_NODE: + copy = doc.createDocumentFragment(); + break; + case Node.ELEMENT_NODE: + final Element elem = doc.createElement( ( (Element)child ).getTagName() ); + copy = elem; + final NamedNodeMap attributes = child.getAttributes(); + if( attributes != null ) { - final Attr attr = ( Attr )attributes.item( i ); - elem.setAttribute( attr.getName(), attr.getValue() ); + final int size = attributes.getLength(); + for( int i = 0; i < size; i++ ) + { + final Attr attr = (Attr)attributes.item( i ); + elem.setAttribute( attr.getName(), attr.getValue() ); + } } - } - break; - case Node.ENTITY_REFERENCE_NODE: - copy = doc.createEntityReference( child.getNodeName() ); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - final ProcessingInstruction pi = ( ProcessingInstruction )child; - copy = doc.createProcessingInstruction( pi.getTarget(), pi.getData() ); - break; - case Node.TEXT_NODE: - copy = doc.createTextNode( ( ( Text )child ).getData() ); - break; - default: - // this should never happen - throw new IllegalStateException( "Invalid node type: " + child.getNodeType() ); + break; + case Node.ENTITY_REFERENCE_NODE: + copy = doc.createEntityReference( child.getNodeName() ); + break; + case Node.PROCESSING_INSTRUCTION_NODE: + final ProcessingInstruction pi = (ProcessingInstruction)child; + copy = doc.createProcessingInstruction( pi.getTarget(), pi.getData() ); + break; + case Node.TEXT_NODE: + copy = doc.createTextNode( ( (Text)child ).getData() ); + break; + default: + // this should never happen + throw new IllegalStateException( "Invalid node type: " + child.getNodeType() ); } // okay we have a copy of the child, now the child becomes the parent @@ -238,7 +240,7 @@ public final class DOMUtil { try { - return ( Node )elementAt( i ); + return (Node)elementAt( i ); } catch( ArrayIndexOutOfBoundsException e ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java index bc75a4e5a..b06f5afe2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Enumerations.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.util.Enumeration; import java.util.NoSuchElementException; @@ -18,7 +19,9 @@ import java.util.NoSuchElementException; public final class Enumerations { - private Enumerations() { } + private Enumerations() + { + } /** * creates an enumeration from an array of objects. @@ -46,7 +49,6 @@ public final class Enumerations } - /** * Convenient enumeration over an array of objects. * @@ -99,7 +101,7 @@ class ArrayEnumeration implements Enumeration { if( hasMoreElements() ) { - Object o = array[pos]; + Object o = array[ pos ]; pos++; return o; } @@ -162,7 +164,7 @@ class CompoundEnumeration implements Enumeration { while( index < enumArray.length ) { - if( enumArray[index] != null && enumArray[index].hasMoreElements() ) + if( enumArray[ index ] != null && enumArray[ index ].hasMoreElements() ) { return true; } @@ -183,7 +185,7 @@ class CompoundEnumeration implements Enumeration { if( hasMoreElements() ) { - return enumArray[index].nextElement(); + return enumArray[ index ].nextElement(); } throw new NoSuchElementException(); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java index 5bc2dc3a9..52e680fe6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/FormatterElement.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.EnumeratedAttribute; /** @@ -171,11 +172,11 @@ public class FormatterElement } JUnitResultFormatter createFormatter() - throws BuildException + throws TaskException { if( classname == null ) { - throw new BuildException( "you must specify type or classname" ); + throw new TaskException( "you must specify type or classname" ); } Class f = null; @@ -185,7 +186,7 @@ public class FormatterElement } catch( ClassNotFoundException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } Object o = null; @@ -195,19 +196,19 @@ public class FormatterElement } catch( InstantiationException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } catch( IllegalAccessException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } if( !( o instanceof JUnitResultFormatter ) ) { - throw new BuildException( classname + " is not a JUnitResultFormatter" ); + throw new TaskException( classname + " is not a JUnitResultFormatter" ); } - JUnitResultFormatter r = ( JUnitResultFormatter )o; + JUnitResultFormatter r = (JUnitResultFormatter)o; if( useFile && outFile != null ) { @@ -217,7 +218,7 @@ public class FormatterElement } catch( java.io.IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } r.setOutput( out ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java index 7f5f3a4ed..b783bc910 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitResultFormatter.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.OutputStream; import junit.framework.TestListener; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * This Interface describes classes that format the results of a JUnit testrun. @@ -21,19 +22,19 @@ public interface JUnitResultFormatter extends TestListener * The whole testsuite started. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void startTestSuite( JUnitTest suite ) - throws BuildException; + throws TaskException; /** * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void endTestSuite( JUnitTest suite ) - throws BuildException; + throws TaskException; /** * Sets the stream the formatter is supposed to write its results to. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index 42e0488e5..c8c2cf09d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -16,8 +17,8 @@ import java.util.Hashtable; import java.util.Properties; import java.util.Random; 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.Task; import org.apache.tools.ant.taskdefs.Execute; @@ -149,7 +150,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setErrorProperty( propertyName ); } } @@ -167,7 +168,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setFailureProperty( propertyName ); } } @@ -186,7 +187,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setFiltertrace( value ); } } @@ -206,7 +207,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setFork( value ); } } @@ -223,7 +224,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setHaltonerror( value ); } } @@ -240,7 +241,7 @@ public class JUnitTask extends Task Enumeration enum = allTests(); while( enum.hasMoreElements() ) { - BaseTest test = ( BaseTest )enum.nextElement(); + BaseTest test = (BaseTest)enum.nextElement(); test.setHaltonfailure( value ); } } @@ -373,15 +374,15 @@ public class JUnitTask extends Task /** * Runs the testcase. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Enumeration list = getIndividualTests(); while( list.hasMoreElements() ) { - JUnitTest test = ( JUnitTest )list.nextElement(); + JUnitTest test = (JUnitTest)list.nextElement(); if( test.shouldRun( project ) ) { execute( test ); @@ -419,13 +420,13 @@ public class JUnitTask extends Task */ protected Enumeration getIndividualTests() { - Enumeration[] enums = new Enumeration[batchTests.size() + 1]; + Enumeration[] enums = new Enumeration[ batchTests.size() + 1 ]; for( int i = 0; i < batchTests.size(); i++ ) { - BatchTest batchtest = ( BatchTest )batchTests.elementAt( i ); - enums[i] = batchtest.elements(); + BatchTest batchtest = (BatchTest)batchTests.elementAt( i ); + enums[ i ] = batchtest.elements(); } - enums[enums.length - 1] = tests.elements(); + enums[ enums.length - 1 ] = tests.elements(); return Enumerations.fromCompound( enums ); } @@ -437,6 +438,7 @@ public class JUnitTask extends Task * @return The Output value */ protected File getOutput( FormatterElement fe, JUnitTest test ) + throws TaskException { if( fe.getUseFile() ) { @@ -468,7 +470,7 @@ public class JUnitTask extends Task int pling = u.indexOf( "!" ); String jarName = u.substring( 9, pling ); log( "Implicitly adding " + jarName + " to classpath", - Project.MSG_DEBUG ); + Project.MSG_DEBUG ); createClasspath().setLocation( new File( ( new File( jarName ) ).getAbsolutePath() ) ); } else if( u.startsWith( "file:" ) ) @@ -476,13 +478,13 @@ public class JUnitTask extends Task int tail = u.indexOf( resource ); String dirName = u.substring( 5, tail ); log( "Implicitly adding " + dirName + " to classpath", - Project.MSG_DEBUG ); + Project.MSG_DEBUG ); createClasspath().setLocation( new File( ( new File( dirName ) ).getAbsolutePath() ) ); } else { log( "Don\'t know how to handle resource URL " + u, - Project.MSG_DEBUG ); + Project.MSG_DEBUG ); } } else @@ -500,10 +502,10 @@ public class JUnitTask extends Task /** * @return null if there is a timeout value, otherwise the watchdog * instance. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected ExecuteWatchdog createWatchdog() - throws BuildException + throws TaskException { if( timeout == null ) { @@ -516,10 +518,10 @@ public class JUnitTask extends Task * Run the tests. * * @param test Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void execute( JUnitTest test ) - throws BuildException + throws TaskException { // set the default values if not specified //@todo should be moved to the test class instead. @@ -558,10 +560,10 @@ public class JUnitTask extends Task if( errorOccurredHere || failureOccurredHere ) { if( errorOccurredHere && test.getHaltonerror() - || failureOccurredHere && test.getHaltonfailure() ) + || failureOccurredHere && test.getHaltonfailure() ) { - throw new BuildException( "Test " + test.getName() + " failed" - + ( wasKilled ? " (timeout)" : "" ) ); + throw new TaskException( "Test " + test.getName() + " failed" + + ( wasKilled ? " (timeout)" : "" ) ); } else { @@ -618,12 +620,12 @@ public class JUnitTask extends Task * exceeds a certain amount of time. Can be null , in this * case the test could probably hang forever. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private int executeAsForked( JUnitTest test, ExecuteWatchdog watchdog ) - throws BuildException + throws TaskException { - CommandlineJava cmd = ( CommandlineJava )commandline.clone(); + CommandlineJava cmd = (CommandlineJava)commandline.clone(); cmd.setClassname( "org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" ); cmd.createArgument().setValue( test.getName() ); @@ -640,7 +642,7 @@ public class JUnitTask extends Task final FormatterElement[] feArray = mergeFormatters( test ); for( int i = 0; i < feArray.length; i++ ) { - FormatterElement fe = feArray[i]; + FormatterElement fe = feArray[ i ]; formatterArg.append( "formatter=" ); formatterArg.append( fe.getClassname() ); File outFile = getOutput( fe, test ); @@ -658,7 +660,7 @@ public class JUnitTask extends Task cmd.createArgument().setValue( "propsfile=" + propsFile.getAbsolutePath() ); Hashtable p = project.getProperties(); Properties props = new Properties(); - for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) + for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) { Object key = enum.nextElement(); props.put( key, p.get( key ) ); @@ -671,7 +673,7 @@ public class JUnitTask extends Task } catch( java.io.IOException e ) { - throw new BuildException( "Error creating temporary properties file.", e ); + throw new TaskException( "Error creating temporary properties file.", e ); } Execute execute = new Execute( new LogStreamHandler( this, Project.MSG_INFO, Project.MSG_WARN ), watchdog ); @@ -690,12 +692,12 @@ public class JUnitTask extends Task } catch( IOException e ) { - throw new BuildException( "Process fork failed.", e ); + throw new TaskException( "Process fork failed.", e ); } finally { if( !propsFile.delete() ) - throw new BuildException( "Could not delete temporary properties file." ); + throw new TaskException( "Could not delete temporary properties file." ); } return retVal; @@ -706,10 +708,10 @@ public class JUnitTask extends Task * * @param test Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private int executeInVM( JUnitTest test ) - throws BuildException + throws TaskException { test.setProperties( project.getProperties() ); if( dir != null ) @@ -752,7 +754,7 @@ public class JUnitTask extends Task final FormatterElement[] feArray = mergeFormatters( test ); for( int i = 0; i < feArray.length; i++ ) { - FormatterElement fe = feArray[i]; + FormatterElement fe = feArray[ i ]; File outFile = getOutput( fe, test ); if( outFile != null ) { @@ -779,9 +781,9 @@ public class JUnitTask extends Task private FormatterElement[] mergeFormatters( JUnitTest test ) { - Vector feVector = ( Vector )formatters.clone(); + Vector feVector = (Vector)formatters.clone(); test.addFormattersTo( feVector ); - FormatterElement[] feArray = new FormatterElement[feVector.size()]; + FormatterElement[] feArray = new FormatterElement[ feVector.size() ]; feVector.copyInto( feArray ); return feArray; } @@ -796,15 +798,15 @@ public class JUnitTask extends Task public String[] getValues() { return new String[]{"true", "yes", "false", "no", - "on", "off", "withOutAndErr"}; + "on", "off", "withOutAndErr"}; } public boolean asBoolean() { return "true".equals( value ) - || "on".equals( value ) - || "yes".equals( value ) - || "withOutAndErr".equals( value ); + || "on".equals( value ) + || "yes".equals( value ) + || "withOutAndErr".equals( value ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java index 93c2b2d01..2c76294e9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTest.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.util.Enumeration; import java.util.Hashtable; import java.util.Properties; @@ -48,7 +49,9 @@ public class JUnitTest extends BaseTest // and deal with it. (SB) private long runs, failures, errors; - public JUnitTest() { } + public JUnitTest() + { + } public JUnitTest( String name ) { @@ -93,7 +96,7 @@ public class JUnitTest extends BaseTest public void setProperties( Hashtable p ) { props = new Properties(); - for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) + for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) { Object key = enum.nextElement(); props.put( key, p.get( key ) ); @@ -107,7 +110,7 @@ public class JUnitTest extends BaseTest public FormatterElement[] getFormatters() { - FormatterElement[] fes = new FormatterElement[formatters.size()]; + FormatterElement[] fes = new FormatterElement[ formatters.size() ]; formatters.copyInto( fes ); return fes; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java index 29170e402..7139d8b00 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.File; @@ -25,8 +26,8 @@ import junit.framework.Test; import junit.framework.TestListener; import junit.framework.TestResult; import junit.framework.TestSuite; +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.util.StringUtils; @@ -76,12 +77,12 @@ public class JUnitTestRunner implements TestListener "junit.framework.TestResult", "junit.framework.TestSuite", "junit.framework.Assert.", // don't filter AssertionFailure - "junit.swingui.TestRunner", + "junit.swingui.TestRunner", "junit.awtui.TestRunner", "junit.textui.TestRunner", "java.lang.reflect.Method.invoke(", "org.apache.tools.ant." - }; + }; private static Vector fromCmdLine = new Vector(); @@ -184,7 +185,7 @@ public class JUnitTestRunner implements TestListener try { // check if there is a suite method - suiteMethod = testClass.getMethod( "suite", new Class[0] ); + suiteMethod = testClass.getMethod( "suite", new Class[ 0 ] ); } catch( Exception e ) { @@ -198,7 +199,7 @@ public class JUnitTestRunner implements TestListener // if there is a suite method available, then try // to extract the suite from it. If there is an error // here it will be caught below and reported. - suite = ( Test )suiteMethod.invoke( null, new Class[0] ); + suite = (Test)suiteMethod.invoke( null, new Class[ 0 ] ); } else { @@ -357,43 +358,43 @@ public class JUnitTestRunner implements TestListener for( int i = 1; i < args.length; i++ ) { - if( args[i].startsWith( "haltOnError=" ) ) + if( args[ i ].startsWith( "haltOnError=" ) ) { - haltError = Project.toBoolean( args[i].substring( 12 ) ); + haltError = Project.toBoolean( args[ i ].substring( 12 ) ); } - else if( args[i].startsWith( "haltOnFailure=" ) ) + else if( args[ i ].startsWith( "haltOnFailure=" ) ) { - haltFail = Project.toBoolean( args[i].substring( 14 ) ); + haltFail = Project.toBoolean( args[ i ].substring( 14 ) ); } - else if( args[i].startsWith( "filtertrace=" ) ) + else if( args[ i ].startsWith( "filtertrace=" ) ) { - stackfilter = Project.toBoolean( args[i].substring( 12 ) ); + stackfilter = Project.toBoolean( args[ i ].substring( 12 ) ); } - else if( args[i].startsWith( "formatter=" ) ) + else if( args[ i ].startsWith( "formatter=" ) ) { try { - createAndStoreFormatter( args[i].substring( 10 ) ); + createAndStoreFormatter( args[ i ].substring( 10 ) ); } - catch( BuildException be ) + catch( TaskException be ) { System.err.println( be.getMessage() ); System.exit( ERRORS ); } } - else if( args[i].startsWith( "propsfile=" ) ) + else if( args[ i ].startsWith( "propsfile=" ) ) { - FileInputStream in = new FileInputStream( args[i].substring( 10 ) ); + FileInputStream in = new FileInputStream( args[ i ].substring( 10 ) ); props.load( in ); in.close(); } } - JUnitTest t = new JUnitTest( args[0] ); + JUnitTest t = new JUnitTest( args[ 0 ] ); // Add/overlay system properties on the properties from the Ant project Hashtable p = System.getProperties(); - for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) + for( Enumeration enum = p.keys(); enum.hasMoreElements(); ) { Object key = enum.nextElement(); props.put( key, p.get( key ) ); @@ -412,10 +413,10 @@ public class JUnitTestRunner implements TestListener * )? * * @param line Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private static void createAndStoreFormatter( String line ) - throws BuildException + throws TaskException { FormatterElement fe = new FormatterElement(); int pos = line.indexOf( ',' ); @@ -435,7 +436,7 @@ public class JUnitTestRunner implements TestListener { for( int i = 0; i < DEFAULT_TRACE_FILTERS.length; i++ ) { - if( line.indexOf( DEFAULT_TRACE_FILTERS[i] ) > 0 ) + if( line.indexOf( DEFAULT_TRACE_FILTERS[ i ] ) > 0 ) { return true; } @@ -447,7 +448,7 @@ public class JUnitTestRunner implements TestListener { for( int i = 0; i < fromCmdLine.size(); i++ ) { - runner.addFormatter( ( JUnitResultFormatter )fromCmdLine.elementAt( i ) ); + runner.addFormatter( (JUnitResultFormatter)fromCmdLine.elementAt( i ) ); } } @@ -503,7 +504,7 @@ public class JUnitTestRunner implements TestListener */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } public void addFormatter( JUnitResultFormatter f ) @@ -518,7 +519,9 @@ public class JUnitTestRunner implements TestListener * * @param test Description of Parameter */ - public void endTest( Test test ) { } + public void endTest( Test test ) + { + } public void run() { @@ -526,7 +529,7 @@ public class JUnitTestRunner implements TestListener res.addListener( this ); for( int i = 0; i < formatters.size(); i++ ) { - res.addListener( ( TestListener )formatters.elementAt( i ) ); + res.addListener( (TestListener)formatters.elementAt( i ) ); } long start = System.currentTimeMillis(); @@ -536,8 +539,8 @@ public class JUnitTestRunner implements TestListener {// had an exception in the constructor for( int i = 0; i < formatters.size(); i++ ) { - ( ( TestListener )formatters.elementAt( i ) ).addError( null, - exception ); + ( (TestListener)formatters.elementAt( i ) ).addError( null, + exception ); } junitTest.setCounts( 1, 0, 1 ); junitTest.setRunTime( 0 ); @@ -562,10 +565,10 @@ public class JUnitTestRunner implements TestListener systemOut.close(); systemOut = null; sendOutAndErr( new String( outStrm.toByteArray() ), - new String( errStrm.toByteArray() ) ); + new String( errStrm.toByteArray() ) ); junitTest.setCounts( res.runCount(), res.failureCount(), - res.errorCount() ); + res.errorCount() ); junitTest.setRunTime( System.currentTimeMillis() - start ); } } @@ -588,7 +591,9 @@ public class JUnitTestRunner implements TestListener * * @param t Description of Parameter */ - public void startTest( Test t ) { } + public void startTest( Test t ) + { + } protected void handleErrorOutput( String line ) { @@ -610,7 +615,7 @@ public class JUnitTestRunner implements TestListener { for( int i = 0; i < formatters.size(); i++ ) { - ( ( JUnitResultFormatter )formatters.elementAt( i ) ).endTestSuite( junitTest ); + ( (JUnitResultFormatter)formatters.elementAt( i ) ).endTestSuite( junitTest ); } } @@ -618,7 +623,7 @@ public class JUnitTestRunner implements TestListener { for( int i = 0; i < formatters.size(); i++ ) { - ( ( JUnitResultFormatter )formatters.elementAt( i ) ).startTestSuite( junitTest ); + ( (JUnitResultFormatter)formatters.elementAt( i ) ).startTestSuite( junitTest ); } } @@ -627,7 +632,7 @@ public class JUnitTestRunner implements TestListener for( int i = 0; i < formatters.size(); i++ ) { JUnitResultFormatter formatter = - ( ( JUnitResultFormatter )formatters.elementAt( i ) ); + ( (JUnitResultFormatter)formatters.elementAt( i ) ); formatter.setSystemOutput( out ); formatter.setSystemError( err ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java index 082af4960..02fde0ad6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/JUnitVersionHelper.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.lang.reflect.Method; import junit.framework.Test; import junit.framework.TestCase; @@ -21,21 +22,23 @@ public class JUnitVersionHelper { private static Method testCaseName = null; + static { try { - testCaseName = TestCase.class.getMethod( "getName", new Class[0] ); + testCaseName = TestCase.class.getMethod( "getName", new Class[ 0 ] ); } catch( NoSuchMethodException e ) { // pre JUnit 3.7 try { - testCaseName = TestCase.class.getMethod( "name", new Class[0] ); + testCaseName = TestCase.class.getMethod( "name", new Class[ 0 ] ); } catch( NoSuchMethodException e2 ) - {} + { + } } } @@ -54,10 +57,11 @@ public class JUnitVersionHelper { try { - return ( String )testCaseName.invoke( t, new Object[0] ); + return (String)testCaseName.invoke( t, new Object[ 0 ] ); } catch( Throwable e ) - {} + { + } } return "unknown"; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java index 239da0895..e6a119b58 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/PlainJUnitResultFormatter.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; @@ -15,7 +16,7 @@ import java.util.Hashtable; import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Prints plain text output of the test to a specified Writer. @@ -111,7 +112,7 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } /** @@ -126,16 +127,16 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter synchronized( wri ) { wri.print( "Testcase: " - + JUnitVersionHelper.getTestCaseName( test ) ); + + JUnitVersionHelper.getTestCaseName( test ) ); if( Boolean.TRUE.equals( failed.get( test ) ) ) { return; } - Long l = ( Long )testStarts.get( test ); + Long l = (Long)testStarts.get( test ); wri.println( " took " - + nf.format( ( System.currentTimeMillis() - l.longValue() ) - / 1000.0 ) - + " sec" ); + + nf.format( ( System.currentTimeMillis() - l.longValue() ) + / 1000.0 ) + + " sec" ); } } @@ -143,10 +144,10 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void endTestSuite( JUnitTest suite ) - throws BuildException + throws TaskException { String newLine = System.getProperty( "line.separator" ); StringBuffer sb = new StringBuffer( "Testsuite: " ); @@ -195,7 +196,7 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter } catch( IOException ioex ) { - throw new BuildException( "Unable to write output", ioex ); + throw new TaskException( "Unable to write output", ioex ); } finally { @@ -206,7 +207,8 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter out.close(); } catch( IOException e ) - {} + { + } } } } @@ -230,7 +232,9 @@ public class PlainJUnitResultFormatter implements JUnitResultFormatter * * @param suite Description of Parameter */ - public void startTestSuite( JUnitTest suite ) { } + public void startTestSuite( JUnitTest suite ) + { + } private void formatError( String type, Test test, Throwable t ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java index 2932da2d0..04efe04dd 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.IOException; import java.io.OutputStream; import java.text.NumberFormat; import junit.framework.AssertionFailedError; import junit.framework.Test; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Prints short summary output of the test to Ant's logging system. @@ -38,7 +39,9 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter /** * Empty */ - public SummaryJUnitResultFormatter() { } + public SummaryJUnitResultFormatter() + { + } public void setOutput( OutputStream out ) { @@ -71,7 +74,9 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter * @param test The feature to be added to the Error attribute * @param t The feature to be added to the Error attribute */ - public void addError( Test test, Throwable t ) { } + public void addError( Test test, Throwable t ) + { + } /** * Empty @@ -79,7 +84,9 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter * @param test The feature to be added to the Failure attribute * @param t The feature to be added to the Failure attribute */ - public void addFailure( Test test, Throwable t ) { } + public void addFailure( Test test, Throwable t ) + { + } /** * Interface TestListener for JUnit > 3.4.

@@ -91,7 +98,7 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } /** @@ -99,16 +106,18 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter * * @param test Description of Parameter */ - public void endTest( Test test ) { } + public void endTest( Test test ) + { + } /** * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void endTestSuite( JUnitTest suite ) - throws BuildException + throws TaskException { String newLine = System.getProperty( "line.separator" ); StringBuffer sb = new StringBuffer( "Tests run: " ); @@ -144,7 +153,7 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter } catch( IOException ioex ) { - throw new BuildException( "Unable to write summary output", ioex ); + throw new TaskException( "Unable to write summary output", ioex ); } finally { @@ -155,7 +164,8 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter out.close(); } catch( IOException e ) - {} + { + } } } } @@ -165,12 +175,16 @@ public class SummaryJUnitResultFormatter implements JUnitResultFormatter * * @param t Description of Parameter */ - public void startTest( Test t ) { } + public void startTest( Test t ) + { + } /** * Empty * * @param suite Description of Parameter */ - public void startTestSuite( JUnitTest suite ) { } + public void startTestSuite( JUnitTest suite ) + { + } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java index 97501dc2c..bdaf7e14b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLJUnitResultFormatter.java @@ -6,11 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.StringWriter; import java.io.Writer; import java.util.Enumeration; import java.util.Hashtable; @@ -20,7 +19,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import junit.framework.AssertionFailedError; import junit.framework.Test; import junit.framework.TestCase; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.util.DOMElementWriter; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -58,7 +57,9 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan */ private Element rootElement; - public XMLJUnitResultFormatter() { } + public XMLJUnitResultFormatter() + { + } private static DocumentBuilder getDocumentBuilder() { @@ -123,7 +124,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan */ public void addFailure( Test test, AssertionFailedError t ) { - addFailure( test, ( Throwable )t ); + addFailure( test, (Throwable)t ); } /** @@ -135,21 +136,21 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan */ public void endTest( Test test ) { - Element currentTest = ( Element )testElements.get( test ); - Long l = ( Long )testStarts.get( test ); + Element currentTest = (Element)testElements.get( test ); + Long l = (Long)testStarts.get( test ); currentTest.setAttribute( ATTR_TIME, - "" + ( ( System.currentTimeMillis() - l.longValue() ) - / 1000.0 ) ); + "" + ( ( System.currentTimeMillis() - l.longValue() ) + / 1000.0 ) ); } /** * The whole testsuite ended. * * @param suite Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void endTestSuite( JUnitTest suite ) - throws BuildException + throws TaskException { rootElement.setAttribute( ATTR_TESTS, "" + suite.runCount() ); rootElement.setAttribute( ATTR_FAILURES, "" + suite.failureCount() ); @@ -167,7 +168,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan } catch( IOException exc ) { - throw new BuildException( "Unable to write log file", exc ); + throw new TaskException( "Unable to write log file", exc ); } finally { @@ -180,7 +181,8 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan wri.close(); } catch( IOException e ) - {} + { + } } } } @@ -200,7 +202,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan Element currentTest = doc.createElement( TESTCASE ); currentTest.setAttribute( ATTR_NAME, - JUnitVersionHelper.getTestCaseName( t ) ); + JUnitVersionHelper.getTestCaseName( t ) ); rootElement.appendChild( currentTest ); testElements.put( t, currentTest ); } @@ -225,7 +227,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan Enumeration e = props.propertyNames(); while( e.hasMoreElements() ) { - String name = ( String )e.nextElement(); + String name = (String)e.nextElement(); Element propElement = doc.createElement( PROPERTY ); propElement.setAttribute( ATTR_NAME, name ); propElement.setAttribute( ATTR_VALUE, props.getProperty( name ) ); @@ -245,7 +247,7 @@ public class XMLJUnitResultFormatter implements JUnitResultFormatter, XMLConstan Element currentTest = null; if( test != null ) { - currentTest = ( Element )testElements.get( test ); + currentTest = (Element)testElements.get( test ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java index bdbf5233f..ef3d88354 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java @@ -6,30 +6,29 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.io.StringWriter; import java.util.Enumeration; import java.util.Vector; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -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; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.util.DOMElementWriter; -import org.apache.tools.ant.util.StringUtils; import org.apache.tools.ant.util.FileUtils; +import org.apache.tools.ant.util.StringUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; - /** *

* @@ -132,7 +131,6 @@ public class XMLResultAggregator extends Task implements XMLConstants filesets.addElement( fs ); } - public AggregateTransformer createReport() { AggregateTransformer transformer = new AggregateTransformer( this ); @@ -144,11 +142,11 @@ public class XMLResultAggregator extends Task implements XMLConstants * Aggregate all testsuites into a single document and write it to the * specified directory and file. * - * @throws BuildException thrown if there is a serious error while writing + * @throws TaskException thrown if there is a serious error while writing * the document. */ public void execute() - throws BuildException + throws TaskException { Element rootElement = createDocument(); File destFile = getDestinationFile(); @@ -159,14 +157,14 @@ public class XMLResultAggregator extends Task implements XMLConstants } catch( IOException e ) { - throw new BuildException( "Unable to write test aggregate to '" + destFile + "'", e ); + throw new TaskException( "Unable to write test aggregate to '" + destFile + "'", e ); } // apply transformation Enumeration enum = transformers.elements(); while( enum.hasMoreElements() ) { AggregateTransformer transformer = - ( AggregateTransformer )enum.nextElement(); + (AggregateTransformer)enum.nextElement(); transformer.setXmlDocument( rootElement.getOwnerDocument() ); transformer.transform(); } @@ -202,13 +200,13 @@ public class XMLResultAggregator extends Task implements XMLConstants final int size = filesets.size(); for( int i = 0; i < size; i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); DirectoryScanner ds = fs.getDirectoryScanner( project ); ds.scan(); String[] f = ds.getIncludedFiles(); for( int j = 0; j < f.length; j++ ) { - String pathname = f[j]; + String pathname = f[ j ]; if( pathname.endsWith( ".xml" ) ) { File file = new File( ds.getBasedir(), pathname ); @@ -219,7 +217,7 @@ public class XMLResultAggregator extends Task implements XMLConstants } } - File[] files = new File[v.size()]; + File[] files = new File[ v.size() ]; v.copyInto( files ); return files; } @@ -247,7 +245,7 @@ public class XMLResultAggregator extends Task implements XMLConstants // a missing . might imply no package at all. Don't get fooled. String pkgName = ( pos == -1 ) ? "" : fullclassname.substring( 0, pos ); String classname = ( pos == -1 ) ? fullclassname : fullclassname.substring( pos + 1 ); - Element copy = ( Element )DOMUtil.importNode( root, testsuite ); + Element copy = (Element)DOMUtil.importNode( root, testsuite ); // modify the name attribute and set the package copy.setAttribute( ATTR_NAME, classname ); @@ -276,11 +274,11 @@ public class XMLResultAggregator extends Task implements XMLConstants { try { - log( "Parsing file: '" + files[i] + "'", Project.MSG_VERBOSE ); + log( "Parsing file: '" + files[ i ] + "'", Project.MSG_VERBOSE ); //XXX there seems to be a bug in xerces 1.3.0 that doesn't like file object // will investigate later. It does not use the given directory but // the vm dir instead ? Works fine with crimson. - Document testsuiteDoc = builder.parse( "file:///" + files[i].getAbsolutePath() ); + Document testsuiteDoc = builder.parse( "file:///" + files[ i ].getAbsolutePath() ); Element elem = testsuiteDoc.getDocumentElement(); // make sure that this is REALLY a testsuite. if( TESTSUITE.equals( elem.getNodeName() ) ) @@ -290,19 +288,19 @@ public class XMLResultAggregator extends Task implements XMLConstants else { // issue a warning. - log( "the file " + files[i] + " is not a valid testsuite XML document", Project.MSG_WARN ); + log( "the file " + files[ i ] + " is not a valid testsuite XML document", Project.MSG_WARN ); } } catch( SAXException e ) { // a testcase might have failed and write a zero-length document, // It has already failed, but hey.... mm. just put a warning - log( "The file " + files[i] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN ); + log( "The file " + files[ i ] + " is not a valid XML document. It is possibly corrupted.", Project.MSG_WARN ); log( StringUtils.getStackTrace( e ), Project.MSG_DEBUG ); } catch( IOException e ) { - log( "Error while accessing file " + files[i] + ": " + e.getMessage(), Project.MSG_ERR ); + log( "Error while accessing file " + files[ i ] + ": " + e.getMessage(), Project.MSG_ERR ); } } return rootElement; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java index 5f426d55e..0b1c42fdf 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Xalan1Executor.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.OutputStream; import org.apache.xalan.xslt.XSLTInputSource; import org.apache.xalan.xslt.XSLTProcessor; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java index 617424290..cfdec9467 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/Xalan2Executor.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.OutputStream; import javax.xml.transform.Result; import javax.xml.transform.Source; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java index 0b95c3426..7169bd98f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/junit/XalanExecutor.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.junit; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Field; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Command class that encapsulate specific behavior for each Xalan version. The @@ -34,11 +35,11 @@ abstract class XalanExecutor * * @param caller object containing the transformation information. * @return Description of the Returned Value - * @throws BuildException thrown if it could not find a valid xalan + * @throws TaskException thrown if it could not find a valid xalan * executor. */ static XalanExecutor newInstance( AggregateTransformer caller ) - throws BuildException + throws TaskException { Class procVersion = null; XalanExecutor executor = null; @@ -52,12 +53,12 @@ abstract class XalanExecutor try { procVersion = Class.forName( "org.apache.xalan.xslt.XSLProcessorVersion" ); - executor = ( XalanExecutor )Class.forName( + executor = (XalanExecutor)Class.forName( "org.apache.tools.ant.taskdefs.optional.junit.Xalan1Executor" ).newInstance(); } catch( Exception xalan1missing ) { - throw new BuildException( "Could not find xalan2 nor xalan1 in the classpath. Check http://xml.apache.org/xalan-j" ); + throw new TaskException( "Could not find xalan2 nor xalan1 in the classpath. Check http://xml.apache.org/xalan-j" ); } } String version = getXalanVersion( procVersion ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java index 31b5ff0c9..86983a729 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -14,7 +15,7 @@ import java.util.Enumeration; import java.util.Hashtable; import java.util.Random; 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; @@ -75,7 +76,9 @@ public abstract class AbstractMetamataTask extends Task // be set when calling scanFileSets(); protected Hashtable includedFiles = null; - public AbstractMetamataTask() { } + public AbstractMetamataTask() + { + } /** * initialize the task with the classname of the task to run @@ -137,7 +140,6 @@ public abstract class AbstractMetamataTask extends Task this.metamataHome = metamataHome; } - /** * The java files or directory to be audited * @@ -189,10 +191,10 @@ public abstract class AbstractMetamataTask extends Task /** * execute the command line * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { try { @@ -211,10 +213,10 @@ public abstract class AbstractMetamataTask extends Task /** * check the options and build the command line * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void setUp() - throws BuildException + throws TaskException { checkOptions(); @@ -250,7 +252,6 @@ public abstract class AbstractMetamataTask extends Task return new File( new File( home.getAbsolutePath() ), "lib/metamata.jar" ); } - protected Hashtable getFileMapping() { return includedFiles; @@ -266,21 +267,21 @@ public abstract class AbstractMetamataTask extends Task /** * validate options set * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { // do some validation first if( metamataHome == null || !metamataHome.exists() ) { - throw new BuildException( "'metamatahome' must point to Metamata home directory." ); + throw new TaskException( "'metamatahome' must point to Metamata home directory." ); } metamataHome = resolveFile( metamataHome.getPath() ); File jar = getMetamataJar( metamataHome ); if( !jar.exists() ) { - throw new BuildException( jar + " does not exist. Check your metamata installation." ); + throw new TaskException( jar + " does not exist. Check your metamata installation." ); } } @@ -304,15 +305,14 @@ public abstract class AbstractMetamataTask extends Task */ protected abstract ExecuteStreamHandler createStreamHandler(); - /** * execute the process with a specific handler * * @param handler Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void execute0( ExecuteStreamHandler handler ) - throws BuildException + throws TaskException { final Execute process = new Execute( handler ); log( cmdl.toString(), Project.MSG_VERBOSE ); @@ -321,18 +321,17 @@ public abstract class AbstractMetamataTask extends Task { if( process.execute() != 0 ) { - throw new BuildException( "Metamata task failed." ); + throw new TaskException( "Metamata task failed." ); } } catch( IOException e ) { - throw new BuildException( "Failed to launch Metamata task: " + e ); + throw new TaskException( "Failed to launch Metamata task: " + e ); } } - protected void generateOptionsFile( File tofile, Vector options ) - throws BuildException + throws TaskException { FileWriter fw = null; try @@ -348,7 +347,7 @@ public abstract class AbstractMetamataTask extends Task } catch( IOException e ) { - throw new BuildException( "Error while writing options file " + tofile, e ); + throw new TaskException( "Error while writing options file " + tofile, e ); } finally { @@ -359,7 +358,8 @@ public abstract class AbstractMetamataTask extends Task fw.close(); } catch( IOException ignored ) - {} + { + } } } } @@ -373,18 +373,18 @@ public abstract class AbstractMetamataTask extends Task Hashtable files = new Hashtable(); 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 ); ds.scan(); String[] f = ds.getIncludedFiles(); log( i + ") Adding " + f.length + " files from directory " + ds.getBasedir(), Project.MSG_VERBOSE ); for( int j = 0; j < f.length; j++ ) { - String pathname = f[j]; + String pathname = f[ j ]; if( pathname.endsWith( ".java" ) ) { File file = new File( ds.getBasedir(), pathname ); -// file = project.resolveFile(file.getAbsolutePath()); + // file = project.resolveFile(file.getAbsolutePath()); String classname = pathname.substring( 0, pathname.length() - ".java".length() ); classname = classname.replace( File.separatorChar, '.' ); files.put( file.getAbsolutePath(), classname );// it's a java file, add it. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java index 900bdc243..62cbe5266 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; 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.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.LogStreamHandler; @@ -160,7 +161,7 @@ public class MAudit extends AbstractMetamataTask } // suppress copyright msg when running, we will let it so that this // will be the only output to the console if in xml mode -// options.addElement("-quiet"); + // options.addElement("-quiet"); if( fix ) { options.addElement( "-fix" ); @@ -190,12 +191,12 @@ public class MAudit extends AbstractMetamataTask } protected void checkOptions() - throws BuildException + throws TaskException { super.checkOptions(); if( unused && searchPath == null ) { - throw new BuildException( "'searchpath' element must be set when looking for 'unused' declarations." ); + throw new TaskException( "'searchpath' element must be set when looking for 'unused' declarations." ); } if( !unused && searchPath != null ) { @@ -204,7 +205,7 @@ public class MAudit extends AbstractMetamataTask } protected void cleanUp() - throws BuildException + throws TaskException { super.cleanUp(); // at this point if -list is used, we should move @@ -220,7 +221,7 @@ public class MAudit extends AbstractMetamataTask } protected ExecuteStreamHandler createStreamHandler() - throws BuildException + throws TaskException { ExecuteStreamHandler handler = null; // if we didn't specify a file, then use a screen report @@ -238,7 +239,7 @@ public class MAudit extends AbstractMetamataTask } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } return handler; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java index 1096d6700..83520b850 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -26,7 +27,6 @@ import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; - /** * This is a very bad stream handler for the MAudit task. All report to stdout * that does not match a specific report pattern is dumped to the Ant output as @@ -99,14 +99,18 @@ class MAuditStreamHandler implements ExecuteStreamHandler * * @param is The new ProcessErrorStream value */ - public void setProcessErrorStream( InputStream is ) { } + public void setProcessErrorStream( InputStream is ) + { + } /** * Ignore. * * @param os The new ProcessInputStream value */ - public void setProcessInputStream( OutputStream os ) { } + public void setProcessInputStream( OutputStream os ) + { + } /** * Set the inputstream @@ -148,9 +152,9 @@ class MAuditStreamHandler implements ExecuteStreamHandler int errors = 0; while( keys.hasMoreElements() ) { - String filepath = ( String )keys.nextElement(); - Vector v = ( Vector )auditedFiles.get( filepath ); - String fullclassname = ( String )filemapping.get( filepath ); + String filepath = (String)keys.nextElement(); + Vector v = (Vector)auditedFiles.get( filepath ); + String fullclassname = (String)filemapping.get( filepath ); if( fullclassname == null ) { task.getProject().log( "Could not find class mapping for " + filepath, Project.MSG_WARN ); @@ -166,7 +170,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler errors += v.size(); for( int i = 0; i < v.size(); i++ ) { - MAudit.Violation violation = ( MAudit.Violation )v.elementAt( i ); + MAudit.Violation violation = (MAudit.Violation)v.elementAt( i ); Element error = doc.createElement( "violation" ); error.setAttribute( "line", String.valueOf( violation.line ) ); error.setAttribute( "message", violation.error ); @@ -202,7 +206,8 @@ class MAuditStreamHandler implements ExecuteStreamHandler wri.close(); } catch( IOException e ) - {} + { + } } } } @@ -218,7 +223,7 @@ class MAuditStreamHandler implements ExecuteStreamHandler */ protected void addViolationEntry( String file, MAudit.Violation entry ) { - Vector violations = ( Vector )auditedFiles.get( file ); + Vector violations = (Vector)auditedFiles.get( file ); // if there is no decl for this file yet, create it. if( violations == null ) { @@ -251,9 +256,9 @@ class MAuditStreamHandler implements ExecuteStreamHandler Vector matches = matcher.getGroups( line ); if( matches != null ) { - String file = ( String )matches.elementAt( 1 ); - int lineNum = Integer.parseInt( ( String )matches.elementAt( 2 ) ); - String msg = ( String )matches.elementAt( 3 ); + String file = (String)matches.elementAt( 1 ); + int lineNum = Integer.parseInt( (String)matches.elementAt( 2 ) ); + String msg = (String)matches.elementAt( 3 ); addViolationEntry( file, MAudit.createViolation( lineNum, msg ) ); } else diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java index 6a5ae42ee..be5009094 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; 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.taskdefs.ExecuteStreamHandler; import org.apache.tools.ant.taskdefs.LogStreamHandler; @@ -117,7 +118,6 @@ public class MMetrics extends AbstractMetamataTask return path; } - protected Vector getOptions() { Vector options = new Vector( 512 ); @@ -158,7 +158,7 @@ public class MMetrics extends AbstractMetamataTask String[] dirs = path.list(); for( int i = 0; i < dirs.length; i++ ) { - options.addElement( dirs[i] ); + options.addElement( dirs[ i ] ); } // files next. addAllVector( options, includedFiles.keys() ); @@ -170,38 +170,37 @@ public class MMetrics extends AbstractMetamataTask // check for existing options and outfile, all other are optional protected void checkOptions() - throws BuildException + throws TaskException { super.checkOptions(); if( !"files".equals( granularity ) && !"methods".equals( granularity ) - && !"types".equals( granularity ) ) + && !"types".equals( granularity ) ) { - throw new BuildException( "Metrics reporting granularity is invalid. Must be one of 'files', 'methods', 'types'" ); + throw new TaskException( "Metrics reporting granularity is invalid. Must be one of 'files', 'methods', 'types'" ); } if( outFile == null ) { - throw new BuildException( "Output XML file must be set via 'tofile' attribute." ); + throw new TaskException( "Output XML file must be set via 'tofile' attribute." ); } if( path == null && fileSets.size() == 0 ) { - throw new BuildException( "Must set either paths (path element) or files (fileset element)" ); + throw new TaskException( "Must set either paths (path element) or files (fileset element)" ); } // I don't accept dirs and files at the same time, I cannot recognize the semantic in the result if( path != null && fileSets.size() > 0 ) { - throw new BuildException( "Cannot set paths (path element) and files (fileset element) at the same time" ); + throw new TaskException( "Cannot set paths (path element) and files (fileset element) at the same time" ); } } - /** * cleanup the temporary txt report * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void cleanUp() - throws BuildException + throws TaskException { try { @@ -232,7 +231,7 @@ public class MMetrics extends AbstractMetamataTask } protected void execute0( ExecuteStreamHandler handler ) - throws BuildException + throws TaskException { super.execute0( handler ); transformFile(); @@ -243,11 +242,11 @@ public class MMetrics extends AbstractMetamataTask * called if the result is written to the output file via -output or we * could use the handler directly on stdout if not. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @see #createStreamHandler() */ protected void transformFile() - throws BuildException + throws TaskException { FileInputStream tmpStream = null; try @@ -256,7 +255,7 @@ public class MMetrics extends AbstractMetamataTask } catch( IOException e ) { - throw new BuildException( "Error reading temporary file: " + tmpFile, e ); + throw new TaskException( "Error reading temporary file: " + tmpFile, e ); } FileOutputStream xmlStream = null; try @@ -269,7 +268,7 @@ public class MMetrics extends AbstractMetamataTask } catch( IOException e ) { - throw new BuildException( "Error creating output file: " + outFile, e ); + throw new TaskException( "Error creating output file: " + outFile, e ); } finally { @@ -280,7 +279,8 @@ public class MMetrics extends AbstractMetamataTask xmlStream.close(); } catch( IOException ignored ) - {} + { + } } if( tmpStream != null ) { @@ -289,7 +289,8 @@ public class MMetrics extends AbstractMetamataTask tmpStream.close(); } catch( IOException ignored ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java index b09fd00fc..932f5f1ad 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -68,8 +69,8 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler protected final static String METHOD = "method"; protected final static String[] ATTRIBUTES = {"name", "vg", "loc", - "dit", "noa", "nrm", "nlm", "wmc", "rfc", "dac", "fanout", "cbo", "lcom", "nocl" - }; + "dit", "noa", "nrm", "nlm", "wmc", "rfc", "dac", "fanout", "cbo", "lcom", "nocl" + }; /** * the stack where are stored the metrics element so that they we can know @@ -117,7 +118,9 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler * @exception IOException Description of Exception */ public void setProcessErrorStream( InputStream p1 ) - throws IOException { } + throws IOException + { + } /** * Ignore. @@ -126,7 +129,9 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler * @exception IOException Description of Exception */ public void setProcessInputStream( OutputStream p1 ) - throws IOException { } + throws IOException + { + } /** * Set the inputstream @@ -152,7 +157,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler } try { - metricsHandler = ( ( SAXTransformerFactory )factory ).newTransformerHandler(); + metricsHandler = ( (SAXTransformerFactory)factory ).newTransformerHandler(); metricsHandler.setResult( new StreamResult( new OutputStreamWriter( xmlOutputStream, "UTF-8" ) ) ); Transformer transformer = metricsHandler.getTransformer(); transformer.setOutputProperty( OutputKeys.INDENT, "yes" ); @@ -185,7 +190,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler // closed yet. while( stack.size() > 0 ) { - ElementEntry elem = ( ElementEntry )stack.pop(); + ElementEntry elem = (ElementEntry)stack.pop(); metricsHandler.endElement( "", elem.getType(), elem.getType() ); } // close the root @@ -231,7 +236,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler // ok, this is now black magic time, we will guess the type based on // the previous type and its indent... - final ElementEntry previous = ( ElementEntry )stack.peek(); + final ElementEntry previous = (ElementEntry)stack.peek(); final String prevType = previous.getType(); final int prevIndent = previous.getIndent(); final int indent = elem.getIndent(); @@ -252,7 +257,6 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler return PACKAGE; } - /** * Create all attributes of a MetricsElement skipping those who have an * empty string @@ -264,15 +268,15 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler { AttributesImpl impl = new AttributesImpl(); int i = 0; - String name = ATTRIBUTES[i++]; + String name = ATTRIBUTES[ i++ ]; impl.addAttribute( "", name, name, "CDATA", elem.getName() ); Enumeration metrics = elem.getMetrics(); for( ; metrics.hasMoreElements(); i++ ) { - String value = ( String )metrics.nextElement(); + String value = (String)metrics.nextElement(); if( value.length() > 0 ) { - name = ATTRIBUTES[i]; + name = ATTRIBUTES[ i ]; impl.addAttribute( "", name, name, "CDATA", value ); } } @@ -339,7 +343,7 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler int indent = elem.getIndent(); if( stack.size() > 0 ) { - ElementEntry previous = ( ElementEntry )stack.peek(); + ElementEntry previous = (ElementEntry)stack.peek(); // close nodes until you got the parent. try { @@ -347,11 +351,12 @@ public class MMetricsStreamHandler implements ExecuteStreamHandler { stack.pop(); metricsHandler.endElement( "", previous.getType(), previous.getType() ); - previous = ( ElementEntry )stack.peek(); + previous = (ElementEntry)stack.peek(); } } catch( EmptyStackException ignored ) - {} + { + } } // ok, now start the new construct @@ -404,6 +409,7 @@ class MetricsElement private int indent; private Vector metrics; + static { METAMATA_NF = NumberFormat.getInstance(); @@ -411,7 +417,7 @@ class MetricsElement NEUTRAL_NF = NumberFormat.getInstance(); if( NEUTRAL_NF instanceof DecimalFormat ) { - ( ( DecimalFormat )NEUTRAL_NF ).applyPattern( "###0.###;-###0.###" ); + ( (DecimalFormat)NEUTRAL_NF ).applyPattern( "###0.###;-###0.###" ); } NEUTRAL_NF.setMaximumFractionDigits( 1 ); } @@ -456,7 +462,7 @@ class MetricsElement // construct name, we'll need all this to figure out what type of // construct it is since we lost all semantics :( // (#indent[/]*)(#construct.*) - String name = ( String )metrics.elementAt( 0 ); + String name = (String)metrics.elementAt( 0 ); metrics.removeElementAt( 0 ); int indent = 0; pos = name.lastIndexOf( '/' ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java index 1e25b6b93..f856fd39b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.metamata; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Random; 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.taskdefs.Execute; @@ -178,14 +179,13 @@ public class MParse extends Task return sourcepath; } - /** * execute the command line * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { try { @@ -202,10 +202,10 @@ public class MParse extends Task /** * check the options and build the command line * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void setUp() - throws BuildException + throws TaskException { checkOptions(); @@ -214,7 +214,7 @@ public class MParse extends Task final Path classPath = cmdl.createClasspath( project ); for( int i = 0; i < jars.length; i++ ) { - classPath.createPathElement().setLocation( jars[i] ); + classPath.createPathElement().setLocation( jars[ i ] ); } // set the metamata.home property @@ -242,7 +242,7 @@ public class MParse extends Task files.addElement( new File( metahome, "lib/metamata.jar" ) ); files.addElement( new File( metahome, "bin/lib/JavaCC.zip" ) ); - File[] array = new File[files.size()]; + File[] array = new File[ files.size() ]; files.copyInto( array ); return array; } @@ -279,20 +279,19 @@ public class MParse extends Task } options.addElement( target.getAbsolutePath() ); - String[] array = new String[options.size()]; + String[] array = new String[ options.size() ]; options.copyInto( array ); return array; } - /** * execute the process with a specific handler * * @param handler Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void _execute( ExecuteStreamHandler handler ) - throws BuildException + throws TaskException { // target has been checked as a .jj, see if there is a matching // java file and if it is needed to run to process the grammar @@ -313,28 +312,27 @@ public class MParse extends Task { if( process.execute() != 0 ) { - throw new BuildException( "Metamata task failed." ); + throw new TaskException( "Metamata task failed." ); } } catch( IOException e ) { - throw new BuildException( "Failed to launch Metamata task: " + e ); + throw new TaskException( "Failed to launch Metamata task: " + e ); } } - /** * validate options set and resolve files and paths * - * @throws BuildException thrown if an option has an incorrect state. + * @throws TaskException thrown if an option has an incorrect state. */ protected void checkOptions() - throws BuildException + throws TaskException { // check that the home is ok. if( metahome == null || !metahome.exists() ) { - throw new BuildException( "'metamatahome' must point to Metamata home directory." ); + throw new TaskException( "'metamatahome' must point to Metamata home directory." ); } metahome = resolveFile( metahome.getPath() ); @@ -342,16 +340,16 @@ public class MParse extends Task File[] jars = getMetamataLibs(); for( int i = 0; i < jars.length; i++ ) { - if( !jars[i].exists() ) + if( !jars[ i ].exists() ) { - throw new BuildException( jars[i] + " does not exist. Check your metamata installation." ); + throw new TaskException( jars[ i ] + " does not exist. Check your metamata installation." ); } } // check that the target is ok and resolve it. if( target == null || !target.isFile() || !target.getName().endsWith( ".jj" ) ) { - throw new BuildException( "Invalid target: " + target ); + throw new TaskException( "Invalid target: " + target ); } target = resolveFile( target.getPath() ); } @@ -395,11 +393,11 @@ public class MParse extends Task * * @param tofile the file to write the options to. * @param options the array of options element to write to the file. - * @throws BuildException thrown if there is a problem while writing to the + * @throws TaskException thrown if there is a problem while writing to the * file. */ protected void generateOptionsFile( File tofile, String[] options ) - throws BuildException + throws TaskException { FileWriter fw = null; try @@ -408,13 +406,13 @@ public class MParse extends Task PrintWriter pw = new PrintWriter( fw ); for( int i = 0; i < options.length; i++ ) { - pw.println( options[i] ); + pw.println( options[ i ] ); } pw.flush(); } catch( IOException e ) { - throw new BuildException( "Error while writing options file " + tofile, e ); + throw new TaskException( "Error while writing options file " + tofile, e ); } finally { @@ -425,7 +423,8 @@ public class MParse extends Task fw.close(); } catch( IOException ignored ) - {} + { + } } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java index 8865b344b..55766207e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/FTP.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.net; + import com.oroinc.net.ftp.FTPClient; import com.oroinc.net.ftp.FTPFile; import com.oroinc.net.ftp.FTPReply; @@ -21,7 +22,7 @@ import java.io.InputStream; import java.io.OutputStream; 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.FileScanner; import org.apache.tools.ant.Project; @@ -52,7 +53,7 @@ import org.apache.tools.ant.types.FileSet; * @author Magesh Umasankar */ public class FTP - extends Task + extends Task { protected final static int SEND_FILES = 0; protected final static int GET_FILES = 1; @@ -66,7 +67,7 @@ public class FTP "deleting", "listing", "making directory" - }; + }; protected final static String[] COMPLETED_ACTION_STRS = { "sent", @@ -74,7 +75,7 @@ public class FTP "deleted", "listed", "created directory" - }; + }; private boolean binary = true; private boolean passive = false; private boolean verbose = false; @@ -100,10 +101,10 @@ public class FTP * "mkdir" and "list". * * @param action The new Action value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setAction( Action action ) - throws BuildException + throws TaskException { this.action = action.getAction(); } @@ -146,10 +147,10 @@ public class FTP * other actions. * * @param listing The new Listing value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setListing( File listing ) - throws BuildException + throws TaskException { this.listing = listing; } @@ -232,7 +233,6 @@ public class FTP this.server = server; } - /** * set the failed transfer flag * @@ -276,10 +276,10 @@ public class FTP /** * Runs the task. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { checkConfiguration(); @@ -294,7 +294,7 @@ public class FTP ftp.connect( server, port ); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { - throw new BuildException( "FTP connection failed: " + ftp.getReplyString() ); + throw new TaskException( "FTP connection failed: " + ftp.getReplyString() ); } log( "connected", Project.MSG_VERBOSE ); @@ -302,7 +302,7 @@ public class FTP if( !ftp.login( userid, password ) ) { - throw new BuildException( "Could not login to FTP server" ); + throw new TaskException( "Could not login to FTP server" ); } log( "login succeeded", Project.MSG_VERBOSE ); @@ -312,7 +312,7 @@ public class FTP ftp.setFileType( com.oroinc.net.ftp.FTP.IMAGE_FILE_TYPE ); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { - throw new BuildException( + throw new TaskException( "could not set transfer type: " + ftp.getReplyString() ); } @@ -324,7 +324,7 @@ public class FTP ftp.enterLocalPassiveMode(); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { - throw new BuildException( + throw new TaskException( "could not enter into passive mode: " + ftp.getReplyString() ); } @@ -347,19 +347,19 @@ public class FTP ftp.changeWorkingDirectory( remotedir ); if( !FTPReply.isPositiveCompletion( ftp.getReplyCode() ) ) { - throw new BuildException( + throw new TaskException( "could not change remote directory: " + ftp.getReplyString() ); } } - log( ACTION_STRS[action] + " files" ); + log( ACTION_STRS[ action ] + " files" ); transferFiles( ftp ); } } catch( IOException ex ) { - throw new BuildException( "error during FTP transfer: " + ex ); + throw new TaskException( "error during FTP transfer: " + ex ); } finally { @@ -390,10 +390,10 @@ public class FTP * @param dir Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void getFile( FTPClient ftp, String dir, String filename ) - throws IOException, BuildException + throws IOException, TaskException { OutputStream outstream = null; try @@ -426,14 +426,14 @@ public class FTP } else { - throw new BuildException( s ); + throw new TaskException( s ); } } else { log( "File " + file.getAbsolutePath() + " copied from " + server, - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); transferred++; } } @@ -462,10 +462,10 @@ public class FTP * @param remoteFile Description of Parameter * @return The UpToDate value * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected boolean isUpToDate( FTPClient ftp, File localFile, String remoteFile ) - throws IOException, BuildException + throws IOException, TaskException { log( "checking date for " + remoteFile, Project.MSG_VERBOSE ); @@ -486,12 +486,12 @@ public class FTP } else { - throw new BuildException( "could not date test remote file: " + - ftp.getReplyString() ); + throw new TaskException( "could not date test remote file: " + + ftp.getReplyString() ); } } - long remoteTimestamp = files[0].getTimestamp().getTime().getTime(); + long remoteTimestamp = files[ 0 ].getTimestamp().getTime().getTime(); long localTimestamp = localFile.lastModified(); if( this.action == SEND_FILES ) { @@ -506,32 +506,32 @@ public class FTP /** * Checks to see that all required parameters are set. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkConfiguration() - throws BuildException + throws TaskException { if( server == null ) { - throw new BuildException( "server attribute must be set!" ); + throw new TaskException( "server attribute must be set!" ); } if( userid == null ) { - throw new BuildException( "userid attribute must be set!" ); + throw new TaskException( "userid attribute must be set!" ); } if( password == null ) { - throw new BuildException( "password attribute must be set!" ); + throw new TaskException( "password attribute must be set!" ); } if( ( action == LIST_FILES ) && ( listing == null ) ) { - throw new BuildException( "listing attribute must be set for list action!" ); + throw new TaskException( "listing attribute must be set for list action!" ); } if( action == MK_DIR && remotedir == null ) { - throw new BuildException( "remotedir attribute must be set for mkdir action!" ); + throw new TaskException( "remotedir attribute must be set for mkdir action!" ); } } @@ -542,10 +542,10 @@ public class FTP * @param ftp Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void createParents( FTPClient ftp, String filename ) - throws IOException, BuildException + throws IOException, TaskException { Vector parents = new Vector(); File dir = new File( filename ); @@ -559,11 +559,11 @@ public class FTP for( int i = parents.size() - 1; i >= 0; i-- ) { - dir = ( File )parents.elementAt( i ); + dir = (File)parents.elementAt( i ); if( !dirCache.contains( dir ) ) { log( "creating remote directory " + resolveFile( dir.getPath() ), - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); ftp.makeDirectory( resolveFile( dir.getPath() ) ); // Both codes 550 and 553 can be produced by FTP Servers // to indicate that an attempt to create a directory has @@ -573,7 +573,7 @@ public class FTP ( result != 550 ) && ( result != 553 ) && !ignoreNoncriticalErrors ) { - throw new BuildException( + throw new TaskException( "could not create directory: " + ftp.getReplyString() ); } @@ -588,10 +588,10 @@ public class FTP * @param ftp Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void delFile( FTPClient ftp, String filename ) - throws IOException, BuildException + throws IOException, TaskException { if( verbose ) { @@ -608,7 +608,7 @@ public class FTP } else { - throw new BuildException( s ); + throw new TaskException( s ); } } else @@ -629,17 +629,17 @@ public class FTP * @param bw Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void listFile( FTPClient ftp, BufferedWriter bw, String filename ) - throws IOException, BuildException + throws IOException, TaskException { if( verbose ) { log( "listing " + filename ); } - FTPFile ftpfile = ftp.listFiles( resolveFile( filename ) )[0]; + FTPFile ftpfile = ftp.listFiles( resolveFile( filename ) )[ 0 ]; bw.write( ftpfile.toString() ); bw.newLine(); @@ -652,10 +652,10 @@ public class FTP * @param ftp The FTP client connection * @param dir The directory to create (format must be correct for host type) * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void makeRemoteDir( FTPClient ftp, String dir ) - throws IOException, BuildException + throws IOException, TaskException { if( verbose ) { @@ -671,8 +671,8 @@ public class FTP int rc = ftp.getReplyCode(); if( !( ignoreNoncriticalErrors && ( rc == 550 || rc == 553 || rc == 521 ) ) ) { - throw new BuildException( "could not create directory: " + - ftp.getReplyString() ); + throw new TaskException( "could not create directory: " + + ftp.getReplyString() ); } if( verbose ) @@ -702,7 +702,7 @@ public class FTP protected String resolveFile( String file ) { return file.replace( System.getProperty( "file.separator" ).charAt( 0 ), - remoteFileSep.charAt( 0 ) ); + remoteFileSep.charAt( 0 ) ); } /** @@ -718,10 +718,10 @@ public class FTP * @param dir Description of Parameter * @param filename Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void sendFile( FTPClient ftp, String dir, String filename ) - throws IOException, BuildException + throws IOException, TaskException { InputStream instream = null; try @@ -752,7 +752,7 @@ public class FTP } else { - throw new BuildException( s ); + throw new TaskException( s ); } } @@ -760,8 +760,8 @@ public class FTP { log( "File " + file.getAbsolutePath() + - " copied to " + server, - Project.MSG_VERBOSE ); + " copied to " + server, + Project.MSG_VERBOSE ); transferred++; } } @@ -789,10 +789,10 @@ public class FTP * @param fs Description of Parameter * @return Description of the Returned Value * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected int transferFiles( FTPClient ftp, FileSet fs ) - throws IOException, BuildException + throws IOException, TaskException { FileScanner ds; @@ -811,7 +811,7 @@ public class FTP String dir = null; if( ( ds.getBasedir() == null ) && ( ( action == SEND_FILES ) || ( action == GET_FILES ) ) ) { - throw new BuildException( "the dir attribute must be set for send and get actions" ); + throw new TaskException( "the dir attribute must be set for send and get actions" ); } else { @@ -835,36 +835,36 @@ public class FTP for( int i = 0; i < dsfiles.length; i++ ) { - switch ( action ) + switch( action ) { - case SEND_FILES: - { - sendFile( ftp, dir, dsfiles[i] ); - break; - } + case SEND_FILES: + { + sendFile( ftp, dir, dsfiles[ i ] ); + break; + } - case GET_FILES: - { - getFile( ftp, dir, dsfiles[i] ); - break; - } + case GET_FILES: + { + getFile( ftp, dir, dsfiles[ i ] ); + break; + } - case DEL_FILES: - { - delFile( ftp, dsfiles[i] ); - break; - } + case DEL_FILES: + { + delFile( ftp, dsfiles[ i ] ); + break; + } - case LIST_FILES: - { - listFile( ftp, bw, dsfiles[i] ); - break; - } + case LIST_FILES: + { + listFile( ftp, bw, dsfiles[ i ] ); + break; + } - default: - { - throw new BuildException( "unknown ftp action " + action ); - } + default: + { + throw new TaskException( "unknown ftp action " + action ); + } } } @@ -882,24 +882,24 @@ public class FTP * * @param ftp Description of Parameter * @exception IOException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void transferFiles( FTPClient ftp ) - throws IOException, BuildException + throws IOException, TaskException { transferred = 0; skipped = 0; if( filesets.size() == 0 ) { - throw new BuildException( "at least one fileset must be specified." ); + throw new TaskException( "at least one fileset must be specified." ); } else { // get files from filesets for( int i = 0; i < filesets.size(); i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); if( fs != null ) { transferFiles( ftp, fs ); @@ -907,10 +907,10 @@ public class FTP } } - log( transferred + " files " + COMPLETED_ACTION_STRS[action] ); + log( transferred + " files " + COMPLETED_ACTION_STRS[ action ] ); if( skipped != 0 ) { - log( skipped + " files were not successfully " + COMPLETED_ACTION_STRS[action] ); + log( skipped + " files were not successfully " + COMPLETED_ACTION_STRS[ action ] ); } } @@ -919,7 +919,7 @@ public class FTP private final static String[] validActions = { "send", "put", "recv", "get", "del", "delete", "list", "mkdir" - }; + }; public int getAction() { @@ -971,12 +971,12 @@ public class FTP if( includes == null ) { // No includes supplied, so set it to 'matches all' - includes = new String[1]; - includes[0] = "**"; + includes = new String[ 1 ]; + includes[ 0 ] = "**"; } if( excludes == null ) { - excludes = new String[0]; + excludes = new String[ 0 ]; } filesIncluded = new Vector(); @@ -994,7 +994,7 @@ public class FTP } catch( IOException e ) { - throw new BuildException( "Unable to scan FTP server: ", e ); + throw new TaskException( "Unable to scan FTP server: ", e ); } } @@ -1016,7 +1016,7 @@ public class FTP for( int i = 0; i < newfiles.length; i++ ) { - FTPFile file = newfiles[i]; + FTPFile file = newfiles[ i ]; if( !file.getName().equals( "." ) && !file.getName().equals( ".." ) ) { if( file.isDirectory() ) @@ -1078,7 +1078,7 @@ public class FTP } catch( IOException e ) { - throw new BuildException( "Error while communicating with FTP server: ", e ); + throw new TaskException( "Error while communicating with FTP server: ", e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java index ec6043e87..543879179 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/MimeMail.java @@ -6,15 +6,16 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.net; + import java.io.File; import java.io.FileInputStream; -import java.io.IOException;// Standard SDK imports +import java.io.IOException; import java.util.Properties; -import java.util.Vector;//imported for data source and handler +import java.util.Vector; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.mail.Message; -import javax.mail.MessagingException;//imported for the mail api +import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; @@ -22,13 +23,12 @@ import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project;// Ant imports +import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; - /** * A task to send SMTP email. This version has near identical syntax to the * SendEmail task, but is MIME aware. It also requires Sun's mail.jar and @@ -102,16 +102,17 @@ public class MimeMail extends Task /** * Creates new instance */ - public MimeMail() { } - + public MimeMail() + { + } // helper method to add recipients private static void addRecipients( MimeMessage msg, Message.RecipientType recipType, String addrUserName, String addrList - ) - throws MessagingException, BuildException + ) + throws MessagingException, TaskException { if( ( null == addrList ) || ( addrList.trim().length() <= 0 ) ) return; @@ -121,13 +122,13 @@ public class MimeMail extends Task InternetAddress[] addrArray = InternetAddress.parse( addrList ); if( ( null == addrArray ) || ( 0 == addrArray.length ) ) - throw new BuildException( "Empty " + addrUserName + " recipients list was specified" ); + throw new TaskException( "Empty " + addrUserName + " recipients list was specified" ); msg.setRecipients( recipType, addrArray ); } catch( AddressException ae ) { - throw new BuildException( "Invalid " + addrUserName + " recipient list" ); + throw new TaskException( "Invalid " + addrUserName + " recipient list" ); } } @@ -151,7 +152,6 @@ public class MimeMail extends Task this.ccList = ccList; } - /** * Sets the FailOnError attribute of the MimeMail object * @@ -162,7 +162,6 @@ public class MimeMail extends Task this.failOnError = failOnError; } - /** * Sets the "from" parameter of this build task. * @@ -173,7 +172,6 @@ public class MimeMail extends Task this.from = from; } - /** * Sets the mailhost parameter of this build task. * @@ -184,7 +182,6 @@ public class MimeMail extends Task this.mailhost = mailhost; } - /** * Sets the message parameter of this build task. * @@ -200,7 +197,6 @@ public class MimeMail extends Task this.messageFile = messageFile; } - /** * set type of the text message, plaintext by default but text/html or * text/xml is quite feasible @@ -247,10 +243,10 @@ public class MimeMail extends Task * * @exception MessagingException Description of Exception * @exception AddressException Description of Exception - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void doMail() - throws MessagingException, AddressException, BuildException + throws MessagingException, AddressException, TaskException { Properties props = new Properties(); props.put( "mail.smtp.host", mailhost ); @@ -284,8 +280,8 @@ public class MimeMail extends Task //first a message if( messageFile != null ) { - int size = ( int )messageFile.length(); - byte data[] = new byte[size]; + int size = (int)messageFile.length(); + byte data[] = new byte[ size ]; try { @@ -296,7 +292,7 @@ public class MimeMail extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } @@ -309,7 +305,7 @@ public class MimeMail extends Task for( int i = 0; i < filesets.size(); i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); if( fs != null ) { DirectoryScanner ds = fs.getDirectoryScanner( project ); @@ -318,16 +314,16 @@ public class MimeMail extends Task for( int j = 0; j < dsfiles.length; j++ ) { - File file = new File( baseDir, dsfiles[j] ); + File file = new File( baseDir, dsfiles[ j ] ); MimeBodyPart body; body = new MimeBodyPart(); if( !file.exists() || !file.canRead() ) { - throw new BuildException( "File \"" + file.getAbsolutePath() - + "\" does not exist or is not readable." ); + throw new TaskException( "File \"" + file.getAbsolutePath() + + "\" does not exist or is not readable." ); } log( "Attaching " + file.toString() + " - " + file.length() + " bytes", - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); FileDataSource fileData = new FileDataSource( file ); DataHandler fileDataHandler = new DataHandler( fileData ); body.setDataHandler( fileDataHandler ); @@ -342,15 +338,14 @@ public class MimeMail extends Task Transport.send( msg ); } - /** - * 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 { @@ -361,7 +356,7 @@ public class MimeMail extends Task { if( failOnError ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } else { @@ -371,32 +366,31 @@ public class MimeMail extends Task } } - /** * verify parameters * - * @throws BuildException if something is invalid + * @throws TaskException if something is invalid */ public void validate() { if( from == null ) { - throw new BuildException( "Attribute \"from\" is required." ); + throw new TaskException( "Attribute \"from\" is required." ); } if( ( toList == null ) && ( ccList == null ) && ( bccList == null ) ) { - throw new BuildException( "Attribute \"toList\", \"ccList\" or \"bccList\" is required." ); + throw new TaskException( "Attribute \"toList\", \"ccList\" or \"bccList\" is required." ); } if( message == null && filesets.isEmpty() && messageFile == null ) { - throw new BuildException( "FileSet, \"message\", or \"messageFile\" is required." ); + throw new TaskException( "FileSet, \"message\", or \"messageFile\" is required." ); } if( message != null && messageFile != null ) { - throw new BuildException( "Only one of \"message\" or \"messageFile\" may be specified." ); + throw new TaskException( "Only one of \"message\" or \"messageFile\" may be specified." ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java index 8fa57bed6..39164bb39 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/net/TelnetTask.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.net; + import com.oroinc.net.telnet.TelnetClient; import java.io.IOException; import java.io.InputStream; @@ -13,7 +14,7 @@ import java.io.OutputStream; import java.util.Calendar; 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; @@ -136,7 +137,7 @@ public class TelnetTask extends Task public TelnetSubTask createRead() { - TelnetSubTask task = ( TelnetSubTask )new TelnetRead(); + TelnetSubTask task = (TelnetSubTask)new TelnetRead(); telnetTasks.addElement( task ); return task; } @@ -149,7 +150,7 @@ public class TelnetTask extends Task */ public TelnetSubTask createWrite() { - TelnetSubTask task = ( TelnetSubTask )new TelnetWrite(); + TelnetSubTask task = (TelnetSubTask)new TelnetWrite(); telnetTasks.addElement( task ); return task; } @@ -158,24 +159,24 @@ public class TelnetTask extends Task * Verify that all parameters are included. Connect and possibly login * Iterate through the list of Reads and writes * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { /** * A server name is required to continue */ if( server == null ) - throw new BuildException( "No Server Specified" ); + throw new TaskException( "No Server Specified" ); /** * A userid and password must appear together if they appear. They are * not required. */ if( userid == null && password != null ) - throw new BuildException( "No Userid Specified" ); + throw new TaskException( "No Userid Specified" ); if( password == null && userid != null ) - throw new BuildException( "No Password Specified" ); + throw new TaskException( "No Password Specified" ); /** * Create the telnet client object @@ -187,7 +188,7 @@ public class TelnetTask extends Task } catch( IOException e ) { - throw new BuildException( "Can't connect to " + server ); + throw new TaskException( "Can't connect to " + server ); } /** * Login if userid and password were specified @@ -200,9 +201,9 @@ public class TelnetTask extends Task Enumeration tasksToRun = telnetTasks.elements(); while( tasksToRun != null && tasksToRun.hasMoreElements() ) { - TelnetSubTask task = ( TelnetSubTask )tasksToRun.nextElement(); + TelnetSubTask task = (TelnetSubTask)tasksToRun.nextElement(); if( task instanceof TelnetRead && defaultTimeout != null ) - ( ( TelnetRead )task ).setDefaultTimeout( defaultTimeout ); + ( (TelnetRead)task ).setDefaultTimeout( defaultTimeout ); task.execute( telnet ); } } @@ -249,7 +250,7 @@ public class TelnetTask extends Task } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } @@ -284,7 +285,7 @@ public class TelnetTask extends Task { while( sb.toString().indexOf( s ) == -1 ) { - sb.append( ( char )is.read() ); + sb.append( (char)is.read() ); } } else @@ -299,19 +300,19 @@ public class TelnetTask extends Task Thread.sleep( 250 ); } if( is.available() == 0 ) - throw new BuildException( "Response Timed-Out" ); - sb.append( ( char )is.read() ); + throw new TaskException( "Response Timed-Out" ); + sb.append( (char)is.read() ); } } log( sb.toString(), Project.MSG_INFO ); } - catch( BuildException be ) + catch( TaskException be ) { throw be; } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } @@ -348,7 +349,7 @@ public class TelnetTask extends Task } public void execute( AntTelnetClient telnet ) - throws BuildException + throws TaskException { telnet.waitForString( taskString, timeout ); } @@ -375,9 +376,9 @@ public class TelnetTask extends Task } public void execute( AntTelnetClient telnet ) - throws BuildException + throws TaskException { - throw new BuildException( "Shouldn't be able instantiate a SubTask directly" ); + throw new TaskException( "Shouldn't be able instantiate a SubTask directly" ); } } @@ -396,7 +397,7 @@ public class TelnetTask extends Task } public void execute( AntTelnetClient telnet ) - throws BuildException + throws TaskException { telnet.sendString( taskString, echoString ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java index 9630aa7ff..ae0f53b45 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Add.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; + 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; @@ -86,19 +87,19 @@ public class P4Add extends P4Base private int m_changelist; public void setChangelist( int changelist ) - throws BuildException + throws TaskException { if( changelist <= 0 ) - throw new BuildException( "P4Add: Changelist# should be a positive number" ); + throw new TaskException( "P4Add: Changelist# should be a positive number" ); this.m_changelist = changelist; } public void setCommandlength( int len ) - throws BuildException + throws TaskException { if( len <= 0 ) - throw new BuildException( "P4Add: Commandlength should be a positive number" ); + throw new TaskException( "P4Add: Commandlength should be a positive number" ); this.m_cmdLength = len; } @@ -108,7 +109,7 @@ public class P4Add extends P4Base } public void execute() - throws BuildException + throws TaskException { if( P4View != null ) @@ -122,7 +123,7 @@ public class P4Add extends P4Base 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); @@ -131,7 +132,7 @@ public class P4Add extends P4Base { for( int j = 0; j < srcFiles.length; j++ ) { - File f = new File( ds.getBasedir(), srcFiles[j] ); + File f = new File( ds.getBasedir(), srcFiles[ j ] ); filelist.append( " " ).append( '"' ).append( f.getAbsolutePath() ).append( '"' ); if( filelist.length() > m_cmdLength ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java index f23e4f6b4..ae28709b6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Base.java @@ -6,14 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; + import java.io.IOException; +import org.apache.myrmidon.api.TaskException; import org.apache.oro.text.perl.Perl5Util; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Execute; import org.apache.tools.ant.types.Commandline; - /** * Base class for Perforce (P4) ANT tasks. See individual task for example * usage. @@ -110,7 +110,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task } protected void execP4Command( String command ) - throws BuildException + throws TaskException { execP4Command( command, null ); } @@ -120,10 +120,10 @@ public abstract class P4Base extends org.apache.tools.ant.Task * * @param command The command to run * @param handler A P4Handler to process any input and output - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void execP4Command( String command, P4Handler handler ) - throws BuildException + throws TaskException { try { @@ -150,7 +150,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task String cmdl = ""; for( int i = 0; i < cmdline.length; i++ ) { - cmdl += cmdline[i] + " "; + cmdl += cmdline[ i ] + " "; } log( "Execing " + cmdl, Project.MSG_VERBOSE ); @@ -170,7 +170,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } finally { @@ -179,14 +179,14 @@ public abstract class P4Base extends org.apache.tools.ant.Task handler.stop(); } catch( Exception e ) - {} + { + } } - } catch( Exception e ) { - throw new BuildException( "Problem exec'ing P4 command: " + e.getMessage() ); + throw new TaskException( "Problem exec'ing P4 command: " + e.getMessage() ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java index 5068a9d13..f10bd6793 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Change.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -32,51 +33,50 @@ public class P4Change extends P4Base this.description = desc; } - public String getEmptyChangeList() - throws BuildException + throws TaskException { final StringBuffer stringbuf = new StringBuffer(); execP4Command( "change -o", - new P4HandlerAdapter() - { - public void process( String line ) - { - if( !util.match( "/^#/", line ) ) - { - if( util.match( "/error/", line ) ) - { - - log( "Client Error", Project.MSG_VERBOSE ); - throw new BuildException( "Perforce Error, check client settings and/or server" ); - } - else if( util.match( "//", line ) ) - { - - // we need to escape the description in case there are / - description = backslash( description ); - line = util.substitute( "s//" + description + "/", line ); - - } - else if( util.match( "/\\/\\//", line ) ) - { - //Match "//" for begining of depot filespec - return; - } - - stringbuf.append( line ); - stringbuf.append( "\n" ); - - } - } - } ); + new P4HandlerAdapter() + { + public void process( String line ) + { + if( !util.match( "/^#/", line ) ) + { + if( util.match( "/error/", line ) ) + { + + log( "Client Error", Project.MSG_VERBOSE ); + throw new TaskException( "Perforce Error, check client settings and/or server" ); + } + else if( util.match( "//", line ) ) + { + + // we need to escape the description in case there are / + description = backslash( description ); + line = util.substitute( "s//" + description + "/", line ); + + } + else if( util.match( "/\\/\\//", line ) ) + { + //Match "//" for begining of depot filespec + return; + } + + stringbuf.append( line ); + stringbuf.append( "\n" ); + + } + } + } ); return stringbuf.toString(); } public void execute() - throws BuildException + throws TaskException { if( emptyChangeList == null ) @@ -101,7 +101,7 @@ public class P4Change extends P4Base } else if( util.match( "/error/", line ) ) { - throw new BuildException( "Perforce Error, check client settings and/or server" ); + throw new TaskException( "Perforce Error, check client settings and/or server" ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java index 59949b617..7697036c6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Counter.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -46,17 +47,17 @@ public class P4Counter extends P4Base } public void execute() - throws BuildException + throws TaskException { if( ( counter == null ) || counter.length() == 0 ) { - throw new BuildException( "No counter specified to retrieve" ); + throw new TaskException( "No counter specified to retrieve" ); } if( shouldSetValue && shouldSetProperty ) { - throw new BuildException( "Cannot both set the value of the property and retrieve the value of the property." ); + throw new TaskException( "Cannot both set the value of the property and retrieve the value of the property." ); } String command = "counter " + P4CmdOpts + " " + counter; @@ -90,7 +91,7 @@ public class P4Counter extends P4Base } catch( NumberFormatException nfe ) { - throw new BuildException( "Perforce error. Could not retrieve counter value." ); + throw new TaskException( "Perforce error. Could not retrieve counter value." ); } } }; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java index f711fd2ca..39b0b8518 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Delete.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * P4Delete - checkout file(s) for delete. Example Usage:
@@ -30,12 +31,12 @@ public class P4Delete extends P4Base } public void execute() - throws BuildException + throws TaskException { if( change != null ) P4CmdOpts = "-c " + change; if( P4View == null ) - throw new BuildException( "No view specified to delete" ); + throw new TaskException( "No view specified to delete" ); execP4Command( "-s delete " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler( this ) ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java index c5b10ebc8..7a94b1ec7 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Edit.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * P4Edit - checkout file(s) for edit. Example Usage:
@@ -27,12 +28,12 @@ public class P4Edit extends P4Base } public void execute() - throws BuildException + throws TaskException { if( change != null ) P4CmdOpts = "-c " + change; if( P4View == null ) - throw new BuildException( "No view specified to edit" ); + throw new TaskException( "No view specified to edit" ); execP4Command( "-s edit " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler( this ) ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java index 7175096c3..2da77afc2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Handler.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; /** @@ -19,8 +20,8 @@ public interface P4Handler extends ExecuteStreamHandler { public void process( String line ) - throws BuildException; + throws TaskException; public void setOutput( String line ) - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java index d077d85ae..18ade82ea 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4HandlerAdapter.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.SequenceInputStream; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; public abstract class P4HandlerAdapter implements P4Handler { @@ -49,9 +50,8 @@ public abstract class P4HandlerAdapter implements P4Handler public abstract void process( String line ); - public void start() - throws BuildException + throws TaskException { try @@ -68,7 +68,7 @@ public abstract class P4HandlerAdapter implements P4Handler BufferedReader input = new BufferedReader( new InputStreamReader( - new SequenceInputStream( is, es ) ) ); + new SequenceInputStream( is, es ) ) ); String line; while( ( line = input.readLine() ) != null ) @@ -81,9 +81,11 @@ public abstract class P4HandlerAdapter implements P4Handler } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } - public void stop() { } + public void stop() + { + } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java index 406b08b52..110a89147 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java @@ -6,8 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * P4Have - lists files currently on client. P4Have simply dumps the current @@ -19,7 +19,7 @@ public class P4Have extends P4Base { public void execute() - throws BuildException + throws TaskException { execP4Command( "have " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler( this ) ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java index 277256019..296a1b4cf 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Label.java @@ -6,12 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; + import java.text.SimpleDateFormat; import java.util.Date; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; - /** * P4Label - create a Perforce Label. P4Label inserts a label into perforce * reflecting the current client contents. Label name defaults to AntLabel if @@ -44,7 +44,7 @@ public class P4Label extends P4Base } public void execute() - throws BuildException + throws TaskException { log( "P4Label exec:", Project.MSG_INFO ); @@ -94,13 +94,13 @@ public class P4Label extends P4Base execP4Command( "label -i", handler ); execP4Command( "labelsync -l " + name, - new P4HandlerAdapter() - { - public void process( String line ) - { - log( line, Project.MSG_VERBOSE ); - } - } ); + new P4HandlerAdapter() + { + public void process( String line ) + { + log( line, Project.MSG_VERBOSE ); + } + } ); log( "Created Label " + name + " (" + desc + ")", Project.MSG_INFO ); @@ -132,7 +132,6 @@ public class P4Label extends P4Base } }; - execP4Command( "label -o " + name, handler ); log( labelSpec.toString(), Project.MSG_DEBUG ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java index fdc248dc7..4f6285b16 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4OutputHandler.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Interface for p4 job output stream handler. Classes implementing this @@ -18,5 +19,5 @@ public interface P4OutputHandler { public void process( String line ) - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java index ce1031a3a..19eacf784 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Reopen.java @@ -6,33 +6,35 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /* * P4Reopen - move files to a new changelist * * @author Les Hughes */ + public class P4Reopen extends P4Base { private String toChange = ""; public void setToChange( String toChange ) - throws BuildException + throws TaskException { if( toChange == null && !toChange.equals( "" ) ) - throw new BuildException( "P4Reopen: tochange cannot be null or empty" ); + throw new TaskException( "P4Reopen: tochange cannot be null or empty" ); this.toChange = toChange; } public void execute() - throws BuildException + throws TaskException { if( P4View == null ) if( P4View == null ) - throw new BuildException( "No view specified to reopen" ); + throw new TaskException( "No view specified to reopen" ); execP4Command( "-s reopen -c " + toChange + " " + P4View, new SimpleP4OutputHandler( this ) ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java index f96d1862c..4c1dd7bcd 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Revert.java @@ -6,13 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /* * P4Revert - revert open files or files in a changelist * * @author Les Hughes */ + public class P4Revert extends P4Base { @@ -20,10 +22,10 @@ public class P4Revert extends P4Base private boolean onlyUnchanged = false; public void setChange( String revertChange ) - throws BuildException + throws TaskException { if( revertChange == null && !revertChange.equals( "" ) ) - throw new BuildException( "P4Revert: change cannot be null or empty" ); + throw new TaskException( "P4Revert: change cannot be null or empty" ); this.revertChange = revertChange; @@ -35,7 +37,7 @@ public class P4Revert extends P4Base } public void execute() - throws BuildException + throws TaskException { /* diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java index 07ebb1e97..587b5bb9a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Submit.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -30,26 +31,26 @@ public class P4Submit extends P4Base } public void execute() - throws BuildException + throws TaskException { if( change != null ) { execP4Command( "submit -c " + change, - new P4HandlerAdapter() - { - public void process( String line ) - { - log( line, Project.MSG_VERBOSE ); - } - } - ); + new P4HandlerAdapter() + { + public void process( String line ) + { + log( line, Project.MSG_VERBOSE ); + } + } + ); } else { //here we'd parse the output from change -o into submit -i //in order to support default change. - throw new BuildException( "No change specified (no support for default change yet...." ); + throw new TaskException( "No change specified (no support for default change yet...." ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java index 8c6e9bcc6..869f7eb07 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/P4Sync.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -88,27 +89,26 @@ public class P4Sync extends P4Base String label; - public void setForce( String force ) - throws BuildException + throws TaskException { if( force == null && !label.equals( "" ) ) - throw new BuildException( "P4Sync: If you want to force, set force to non-null string!" ); + throw new TaskException( "P4Sync: If you want to force, set force to non-null string!" ); P4CmdOpts = "-f"; } public void setLabel( String label ) - throws BuildException + throws TaskException { if( label == null && !label.equals( "" ) ) - throw new BuildException( "P4Sync: Labels cannot be Null or Empty" ); + throw new TaskException( "P4Sync: Labels cannot be Null or Empty" ); this.label = label; } public void execute() - throws BuildException + throws TaskException { if( P4View != null ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java index fc8e97e66..7ab63ca4b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/perforce/SimpleP4OutputHandler.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.perforce; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; public class SimpleP4OutputHandler extends P4HandlerAdapter @@ -20,7 +21,7 @@ public class SimpleP4OutputHandler extends P4HandlerAdapter } public void process( String line ) - throws BuildException + throws TaskException { if( parent.util.match( "/^exit/", line ) ) return; @@ -37,7 +38,7 @@ public class SimpleP4OutputHandler extends P4HandlerAdapter if( parent.util.match( "/error:/", line ) && !parent.util.match( "/up-to-date/", line ) ) { - throw new BuildException( line ); + throw new TaskException( line ); } parent.log( parent.util.substitute( "s/^.*: //", line ), Project.MSG_INFO ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java index 0068b772b..09d01e098 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/Pvcs.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.pvcs; + import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -19,7 +20,7 @@ import java.text.ParseException; import java.util.Enumeration; import java.util.Random; 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.taskdefs.Execute; import org.apache.tools.ant.taskdefs.ExecuteStreamHandler; @@ -314,17 +315,17 @@ public class Pvcs extends org.apache.tools.ant.Task } /** - * @exception org.apache.tools.ant.BuildException Something is stopping the + * @exception org.apache.tools.ant.TaskException Something is stopping the * build... */ public void execute() - throws org.apache.tools.ant.BuildException + throws org.apache.tools.ant.TaskException { Project aProj = getProject(); int result = 0; if( repository == null || repository.trim().equals( "" ) ) - throw new BuildException( "Required argument repository not specified" ); + throw new TaskException( "Required argument repository not specified" ); // Check workspace exists // Launch PCLI listversionedfiles -z -aw @@ -351,9 +352,9 @@ public class Pvcs extends org.apache.tools.ant.Task Enumeration e = getPvcsprojects().elements(); while( e.hasMoreElements() ) { - String projectName = ( ( PvcsProject )e.nextElement() ).getName(); + String projectName = ( (PvcsProject)e.nextElement() ).getName(); if( projectName == null || ( projectName.trim() ).equals( "" ) ) - throw new BuildException( "name is a required attribute of pvcsproject" ); + throw new TaskException( "name is a required attribute of pvcsproject" ); commandLine.createArgument().setValue( projectName ); } } @@ -370,11 +371,11 @@ public class Pvcs extends org.apache.tools.ant.Task if( result != 0 && !ignorerc ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } if( !tmp.exists() ) - throw new BuildException( "Communication between ant and pvcs failed. No output generated from executing PVCS commandline interface \"pcli\" and \"get\"" ); + throw new TaskException( "Communication between ant and pvcs failed. No output generated from executing PVCS commandline interface \"pcli\" and \"get\"" ); // Create folders in workspace log( "Creating folders", Project.MSG_INFO ); @@ -412,24 +413,24 @@ public class Pvcs extends org.apache.tools.ant.Task if( result != 0 && !ignorerc ) { String msg = "Failed executing: " + commandLine.toString() + ". Return code was " + result; - throw new BuildException( msg ); + throw new TaskException( msg ); } } catch( FileNotFoundException e ) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } catch( IOException e ) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } catch( ParseException e ) { String msg = "Failed executing: " + commandLine.toString() + ". Exception: " + e.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } finally { @@ -444,7 +445,6 @@ public class Pvcs extends org.apache.tools.ant.Task } } - protected int runCmd( Commandline cmd, ExecuteStreamHandler out ) { try @@ -459,7 +459,7 @@ public class Pvcs extends org.apache.tools.ant.Task catch( java.io.IOException e ) { String msg = "Failed executing: " + cmd.toString() + ". Exception: " + e.getMessage(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -495,7 +495,7 @@ public class Pvcs extends org.apache.tools.ant.Task line.startsWith( getLineStart() ) ) { Object[] objs = mf.parse( line ); - String f = ( String )objs[1]; + String f = (String)objs[ 1 ]; // Extract the name of the directory from the filename int index = f.lastIndexOf( File.separator ); if( index > -1 ) @@ -521,7 +521,7 @@ public class Pvcs extends org.apache.tools.ant.Task else { log( "File separator problem with " + line, - Project.MSG_WARN ); + Project.MSG_WARN ); } } else diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java index 524de2f1b..9d2f34a73 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/pvcs/PvcsProject.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.taskdefs.optional.pvcs; - /** * class to handle <pvcsprojec> elements * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java index 1c7832216..2b5caef0f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/scm/AntStarTeamCheckOut.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.scm; + import com.starbase.starteam.Folder; import com.starbase.starteam.Item; import com.starbase.starteam.Property; @@ -15,9 +16,8 @@ import com.starbase.starteam.Type; import com.starbase.starteam.View; import com.starbase.util.Platform; import java.util.StringTokenizer; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.Project; /** * Checks out files from a specific StarTeam server, project, view, and folder. @@ -44,7 +44,7 @@ import org.apache.tools.ant.Project; * You can set AntStarTeamCheckOut to verbose or quiet mode. Also, it has a * safeguard against overwriting the files on your computer: If the target * directory you specify already exists, the program will throw a - * BuildException. To override the exception, set force to true. + * TaskException. To override the exception, set force to true. *
*
* This program makes use of functions from the StarTeam API. As a result @@ -187,20 +187,19 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task */ private boolean targetFolderAbsolute = false; - /** * convenient method to check for conditions * * @param value Description of Parameter * @param msg Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private static void assertTrue( boolean value, String msg ) - throws BuildException + throws TaskException { if( !value ) { - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -549,7 +548,6 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task return targetFolder; } - /** * returns whether the StarTeam default path is factored into calculated * target path locations (false) or whether targetFolder is an absolute @@ -600,10 +598,10 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task /** * Do the execution. * - * @exception BuildException + * @exception TaskException */ public void execute() - throws BuildException + throws TaskException { // Connect to the StarTeam server, and log on. Server s = getServer(); @@ -638,7 +636,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Property[] properties = t.getProperties(); for( int i = 0; i < properties.length; i++ ) { - Property p = properties[i]; + Property p = properties[ i ]; if( p.isPrimaryDescriptor() ) { return p; @@ -660,7 +658,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Property[] properties = t.getProperties(); for( int i = 0; i < properties.length; i++ ) { - Property p = properties[i]; + Property p = properties[ i ]; if( p.isDescriptor() && !p.isPrimaryDescriptor() ) { return p; @@ -689,7 +687,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task } protected void checkParameters() - throws BuildException + throws TaskException { // Check all of the properties that are required. assertTrue( getServerName() != null, "ServerName must be set." ); @@ -713,8 +711,8 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task java.io.File dirExist = new java.io.File( getTargetFolder() ); if( dirExist.isDirectory() && !getForce() ) { - throw new BuildException( "Target directory exists. Set \"force\" to \"true\" " + - "to continue anyway." ); + throw new TaskException( "Target directory exists. Set \"force\" to \"true\" " + + "to continue anyway." ); } } @@ -741,7 +739,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { if( p.getTypeCode() == Property.Types.ENUMERATED ) { - return "\"" + p.getEnumDisplayName( ( ( Integer )value ).intValue() ) + "\""; + return "\"" + p.getEnumDisplayName( ( (Integer)value ).intValue() ) + "\""; } else { @@ -797,7 +795,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Item[] items = f.getItems( t.getName() ); for( int i = 0; i < items.length; i++ ) { - runItem( s, p, v, t, f, items[i], tgt ); + runItem( s, p, v, t, f, items[ i ], tgt ); } // Process all subfolders recursively if recursion is on. @@ -806,7 +804,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Folder[] subfolders = f.getSubFolders(); for( int i = 0; i < subfolders.length; i++ ) { - runFolder( s, p, v, t, subfolders[i], new java.io.File( tgt, subfolders[i].getName() ) ); + runFolder( s, p, v, t, subfolders[ i ], new java.io.File( tgt, subfolders[ i ].getName() ) ); } } } @@ -835,7 +833,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task Property p1 = getPrimaryDescriptor( t ); Property p2 = getSecondaryDescriptor( t ); - String pName = ( String )item.get( p1.getName() ); + String pName = (String)item.get( p1.getName() ); if( !shouldCheckout( pName ) ) { return; @@ -905,11 +903,11 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task // Check it out; also ugly. // Change the item to be checked out to a StarTeam File. - com.starbase.starteam.File remote = ( com.starbase.starteam.File )item; + com.starbase.starteam.File remote = (com.starbase.starteam.File)item; // The local file name is simply the local target path (tgt) which has // been passed recursively down from the top of the tree, with the item's name appended. - java.io.File local = new java.io.File( tgt, ( String )item.get( p1.getName() ) ); + java.io.File local = new java.io.File( tgt, (String)item.get( p1.getName() ) ); try { @@ -918,7 +916,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task } catch( Exception e ) { - throw new BuildException( "Failed to checkout '" + local + "'", e ); + throw new TaskException( "Failed to checkout '" + local + "'", e ); } } @@ -933,14 +931,14 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task View[] views = p.getViews(); for( int i = 0; i < views.length; i++ ) { - View v = views[i]; + View v = views[ i ]; if( v.getName().equals( getViewName() ) ) { if( getVerbose() ) { log( "Found " + getProjectName() + delim + getViewName() + delim ); } - runType( s, p, v, s.typeForName( ( String )s.getTypeNames().FILE ) ); + runType( s, p, v, s.typeForName( (String)s.getTypeNames().FILE ) ); break; } } @@ -956,7 +954,7 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task com.starbase.starteam.Project[] projects = s.getProjects(); for( int i = 0; i < projects.length; i++ ) { - com.starbase.starteam.Project p = projects[i]; + com.starbase.starteam.Project p = projects[ i ]; if( p.getName().equals( getProjectName() ) ) { @@ -992,15 +990,15 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task { f = StarTeamFinder.findFolder( v.getRootFolder(), getFolderName() ); assertTrue( null != f, "ERROR: " + getProjectName() + delim + getViewName() + delim + - v.getRootFolder() + delim + getFolderName() + delim + - " does not exist." ); + v.getRootFolder() + delim + getFolderName() + delim + + " does not exist." ); } } if( getVerbose() && getFolderName() != null ) { log( "Found " + getProjectName() + delim + getViewName() + - delim + getFolderName() + delim + "\n" ); + delim + getFolderName() + delim + "\n" ); } // For performance reasons, it is important to pre-fetch all the @@ -1021,13 +1019,13 @@ public class AntStarTeamCheckOut extends org.apache.tools.ant.Task } // Now, build an array of the property names. - String[] strNames = new String[nProperties]; + String[] strNames = new String[ nProperties ]; int iProperty = 0; - strNames[iProperty++] = s.getPropertyNames().OBJECT_ID; - strNames[iProperty++] = p1.getName(); + strNames[ iProperty++ ] = s.getPropertyNames().OBJECT_ID; + strNames[ iProperty++ ] = p1.getName(); if( p2 != null ) { - strNames[iProperty++] = p2.getName(); + strNames[ iProperty++ ] = p2.getName(); } // Pre-fetch the item properties and cache them. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java index 6711b46bf..9f1778702 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Random; 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; @@ -48,7 +49,9 @@ public class CovMerge extends Task //---------------- the tedious job begins here - public CovMerge() { } + public CovMerge() + { + } /** * set the coverage home. it must point to JProbe coverage directories where @@ -94,10 +97,10 @@ public class CovMerge extends Task /** * execute the jpcovmerge by providing a parameter file * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { checkOptions(); @@ -122,12 +125,12 @@ public class CovMerge extends Task int exitValue = exec.execute(); if( exitValue != 0 ) { - throw new BuildException( "JProbe Coverage Merging failed (" + exitValue + ")" ); + throw new TaskException( "JProbe Coverage Merging failed (" + exitValue + ")" ); } } catch( IOException e ) { - throw new BuildException( "Failed to run JProbe Coverage Merge: " + e ); + throw new TaskException( "Failed to run JProbe Coverage Merge: " + e ); } finally { @@ -142,25 +145,26 @@ public class CovMerge extends Task * @return The Snapshots value */ protected File[] getSnapshots() + throws TaskException { Vector v = new Vector(); final int size = filesets.size(); for( int i = 0; i < size; i++ ) { - FileSet fs = ( FileSet )filesets.elementAt( i ); + FileSet fs = (FileSet)filesets.elementAt( i ); DirectoryScanner ds = fs.getDirectoryScanner( getProject() ); ds.scan(); String[] f = ds.getIncludedFiles(); for( int j = 0; j < f.length; j++ ) { - String pathname = f[j]; + String pathname = f[ j ]; File file = new File( ds.getBasedir(), pathname ); file = resolveFile( file.getPath() ); v.addElement( file ); } } - File[] files = new File[v.size()]; + File[] files = new File[ v.size() ]; v.copyInto( files ); return files; } @@ -168,39 +172,38 @@ public class CovMerge extends Task /** * check for mandatory options * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { if( tofile == null ) { - throw new BuildException( "'tofile' attribute must be set." ); + throw new TaskException( "'tofile' attribute must be set." ); } // check coverage home if( home == null || !home.isDirectory() ) { - throw new BuildException( "Invalid home directory. Must point to JProbe home directory" ); + throw new TaskException( "Invalid home directory. Must point to JProbe home directory" ); } home = new File( home, "coverage" ); File jar = new File( home, "coverage.jar" ); if( !jar.exists() ) { - throw new BuildException( "Cannot find Coverage directory: " + home ); + throw new TaskException( "Cannot find Coverage directory: " + home ); } } - /** * create the parameters file that contains all file to merge and the output * filename. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected File createParamFile() - throws BuildException + throws TaskException { File[] snapshots = getSnapshots(); File file = createTmpFile(); @@ -211,7 +214,7 @@ public class CovMerge extends Task PrintWriter pw = new PrintWriter( fw ); for( int i = 0; i < snapshots.length; i++ ) { - pw.println( snapshots[i].getAbsolutePath() ); + pw.println( snapshots[ i ].getAbsolutePath() ); } // last file is the output snapshot pw.println( resolveFile( tofile.getPath() ) ); @@ -219,7 +222,7 @@ public class CovMerge extends Task } catch( IOException e ) { - throw new BuildException( "I/O error while writing to " + file, e ); + throw new TaskException( "I/O error while writing to " + file, e ); } finally { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java index 01a62e3b4..207c303fc 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.io.File; import java.io.IOException; import java.util.Vector; @@ -16,7 +17,7 @@ import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; -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.taskdefs.Execute; @@ -26,7 +27,6 @@ import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.Path; import org.w3c.dom.Document; - /** * Convenient task to run the snapshot merge utility for JProbe Coverage 3.0. * @@ -118,8 +118,9 @@ public class CovReport extends Task */ private Reference reference = null; - - public CovReport() { } + public CovReport() + { + } /** * set the filters @@ -141,7 +142,6 @@ public class CovReport extends Task this.format = value.getValue(); } - /** * Set the coverage home. it must point to JProbe coverage directories where * are stored native libraries and jars. @@ -227,7 +227,7 @@ public class CovReport extends Task } public void execute() - throws BuildException + throws TaskException { checkOptions(); try @@ -238,7 +238,7 @@ public class CovReport extends Task String[] params = getParameters(); for( int i = 0; i < params.length; i++ ) { - cmdl.createArgument().setValue( params[i] ); + cmdl.createArgument().setValue( params[ i ] ); } // use the custom handler for stdin issues @@ -249,7 +249,7 @@ public class CovReport extends Task int exitValue = exec.execute(); if( exitValue != 0 ) { - throw new BuildException( "JProbe Coverage Report failed (" + exitValue + ")" ); + throw new TaskException( "JProbe Coverage Report failed (" + exitValue + ")" ); } log( "coveragePath: " + coveragePath, Project.MSG_VERBOSE ); log( "format: " + format, Project.MSG_VERBOSE ); @@ -261,12 +261,12 @@ public class CovReport extends Task } catch( IOException e ) { - throw new BuildException( "Failed to execute JProbe Coverage Report.", e ); + throw new TaskException( "Failed to execute JProbe Coverage Report.", e ); } } - protected String[] getParameters() + throws TaskException { Vector v = new Vector(); if( format != null ) @@ -300,7 +300,7 @@ public class CovReport extends Task v.addElement( "-inc_src_text=" + ( includeSource ? "on" : "off" ) ); } - String[] params = new String[v.size()]; + String[] params = new String[ v.size() ]; v.copyInto( params ); return params; } @@ -308,28 +308,28 @@ public class CovReport extends Task /** * check for mandatory options * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { if( tofile == null ) { - throw new BuildException( "'tofile' attribute must be set." ); + throw new TaskException( "'tofile' attribute must be set." ); } if( snapshot == null ) { - throw new BuildException( "'snapshot' attribute must be set." ); + throw new TaskException( "'snapshot' attribute must be set." ); } if( home == null ) { - throw new BuildException( "'home' attribute must be set to JProbe home directory" ); + throw new TaskException( "'home' attribute must be set to JProbe home directory" ); } home = new File( home, "coverage" ); File jar = new File( home, "coverage.jar" ); if( !jar.exists() ) { - throw new BuildException( "Cannot find Coverage directory: " + home ); + throw new TaskException( "Cannot find Coverage directory: " + home ); } if( reference != null && !"xml".equals( format ) ) { @@ -355,7 +355,6 @@ public class CovReport extends Task } } - public class Reference { protected Path classPath; @@ -380,18 +379,18 @@ public class CovReport extends Task } protected void createEnhancedXMLReport() - throws BuildException + throws TaskException { // we need a classpath element if( classPath == null ) { - throw new BuildException( "Need a 'classpath' element." ); + throw new TaskException( "Need a 'classpath' element." ); } // and a valid one... String[] paths = classPath.list(); if( paths.length == 0 ) { - throw new BuildException( "Coverage path is invalid. It does not contain any existing path." ); + throw new TaskException( "Coverage path is invalid. It does not contain any existing path." ); } // and we need at least one filter include/exclude. if( filters == null || filters.size() == 0 ) @@ -418,7 +417,7 @@ public class CovReport extends Task } catch( Exception e ) { - throw new BuildException( "Error while performing enhanced XML report from file " + tofile, e ); + throw new TaskException( "Error while performing enhanced XML report from file " + tofile, e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java index 5b0039698..6517128c2 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.io.File; import java.io.FileWriter; import java.io.IOException; @@ -14,7 +15,7 @@ import java.io.PrintWriter; import java.io.StringWriter; import java.util.Random; 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.taskdefs.Execute; @@ -85,7 +86,9 @@ public class Coverage extends Task //---------------- the tedious job begins here - public Coverage() { } + public Coverage() + { + } /** * default to false unless file is htm or html @@ -267,10 +270,10 @@ public class Coverage extends Task /** * execute the jplauncher by providing a parameter file * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { File paramfile = null; // if an input file is used, all other options are ignored... @@ -297,12 +300,12 @@ public class Coverage extends Task int exitValue = exec.execute(); if( exitValue != 0 ) { - throw new BuildException( "JProbe Coverage failed (" + exitValue + ")" ); + throw new TaskException( "JProbe Coverage failed (" + exitValue + ")" ); } } catch( IOException e ) { - throw new BuildException( "Failed to execute JProbe Coverage.", e ); + throw new TaskException( "Failed to execute JProbe Coverage.", e ); } finally { @@ -322,6 +325,7 @@ public class Coverage extends Task * @return The Parameters value */ protected String[] getParameters() + throws TaskException { Vector params = new Vector(); params.addElement( "-jp_function=" + function ); @@ -358,7 +362,7 @@ public class Coverage extends Task String[] vmargs = cmdlJava.getVmCommand().getArguments(); for( int i = 0; i < vmargs.length; i++ ) { - params.addElement( vmargs[i] ); + params.addElement( vmargs[ i ] ); } // classpath Path classpath = cmdlJava.getClasspath(); @@ -375,10 +379,10 @@ public class Coverage extends Task String[] args = cmdlJava.getJavaCommand().getArguments(); for( int i = 0; i < args.length; i++ ) { - params.addElement( args[i] ); + params.addElement( args[ i ] ); } - String[] array = new String[params.size()]; + String[] array = new String[ params.size() ]; params.copyInto( array ); return array; } @@ -386,21 +390,21 @@ public class Coverage extends Task /** * wheck what is necessary to check, Coverage will do the job for us * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void checkOptions() - throws BuildException + throws TaskException { // check coverage home if( home == null || !home.isDirectory() ) { - throw new BuildException( "Invalid home directory. Must point to JProbe home directory" ); + throw new TaskException( "Invalid home directory. Must point to JProbe home directory" ); } home = new File( home, "coverage" ); File jar = new File( home, "coverage.jar" ); if( !jar.exists() ) { - throw new BuildException( "Cannot find Coverage directory: " + home ); + throw new TaskException( "Cannot find Coverage directory: " + home ); } // make sure snapshot dir exists and is resolved @@ -411,7 +415,7 @@ public class Coverage extends Task snapshotDir = resolveFile( snapshotDir.getPath() ); if( !snapshotDir.isDirectory() || !snapshotDir.exists() ) { - throw new BuildException( "Snapshot directory does not exists :" + snapshotDir ); + throw new TaskException( "Snapshot directory does not exists :" + snapshotDir ); } if( workingDir == null ) { @@ -440,18 +444,17 @@ public class Coverage extends Task } } - /** * create the parameter file from the given options. The file is created * with a random name in the current directory. * * @return the file object where are written the configuration to run JProbe * Coverage - * @throws BuildException thrown if something bad happens while writing the + * @throws TaskException thrown if something bad happens while writing the * arguments to the file. */ protected File createParamFile() - throws BuildException + throws TaskException { //@todo change this when switching to JDK 1.2 and use File.createTmpFile() File file = createTmpFile(); @@ -464,7 +467,7 @@ public class Coverage extends Task String[] params = getParameters(); for( int i = 0; i < params.length; i++ ) { - pw.println( params[i] ); + pw.println( params[ i ] ); } pw.flush(); log( "JProbe Coverage parameters:\n" + sw.toString(), Project.MSG_VERBOSE ); @@ -479,7 +482,7 @@ public class Coverage extends Task } catch( IOException e ) { - throw new BuildException( "Could not write parameter file " + file, e ); + throw new TaskException( "Could not write parameter file " + file, e ); } finally { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java index 6b6c9b345..2615352f4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.util.Vector; /** @@ -31,7 +32,9 @@ public class Filters */ protected Vector filters = new Vector(); - public Filters() { } + public Filters() + { + } public void setDefaultExclude( boolean value ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java index d8b5f2307..9f0c0438d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.util.Vector; import org.apache.tools.ant.util.regexp.RegexpMatcher; import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; @@ -28,7 +29,9 @@ public class ReportFilters */ protected Vector matchers = null; - public ReportFilters() { } + public ReportFilters() + { + } /** * Check whether a given <classname><method>() is accepted by @@ -51,8 +54,8 @@ public class ReportFilters final int size = filters.size(); for( int i = 0; i < size; i++ ) { - FilterElement filter = ( FilterElement )filters.elementAt( i ); - RegexpMatcher matcher = ( RegexpMatcher )matchers.elementAt( i ); + FilterElement filter = (FilterElement)filters.elementAt( i ); + RegexpMatcher matcher = (RegexpMatcher)matchers.elementAt( i ); if( filter instanceof Include ) { result = result || matcher.matches( methodname ); @@ -95,7 +98,7 @@ public class ReportFilters matchers = new Vector(); for( int i = 0; i < size; i++ ) { - FilterElement filter = ( FilterElement )filters.elementAt( i ); + FilterElement filter = (FilterElement)filters.elementAt( i ); RegexpMatcher matcher = factory.newRegexpMatcher(); String pattern = filter.getAsPattern(); matcher.setPattern( pattern ); @@ -112,7 +115,6 @@ public class ReportFilters { } - /** * default abstract filter element class * diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java index 5675959ed..6f693979c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java @@ -17,7 +17,9 @@ public final class StringUtil /** * private constructor, it's a utility class */ - private StringUtil() { } + private StringUtil() + { + } /** * Replaces all occurences of find with replacement in the diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java index c7d716f44..e99cd2b5d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.util.Hashtable; import java.util.Vector; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Trigger information. It will return as a command line argument by calling the @@ -44,7 +45,9 @@ public class Triggers eventMap.put( "exit", "X" ); } - public Triggers() { } + public Triggers() + { + } public void addMethod( Method method ) { @@ -67,7 +70,6 @@ public class Triggers return buf.toString(); } - public static class Method { protected String action; @@ -76,11 +78,11 @@ public class Triggers protected String param; public void setAction( String value ) - throws BuildException + throws TaskException { if( actionMap.get( value ) == null ) { - throw new BuildException( "Invalid action, must be one of " + actionMap ); + throw new TaskException( "Invalid action, must be one of " + actionMap ); } action = value; } @@ -89,7 +91,7 @@ public class Triggers { if( eventMap.get( value ) == null ) { - throw new BuildException( "Invalid event, must be one of " + eventMap ); + throw new TaskException( "Invalid event, must be one of " + eventMap ); } event = value; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java index f6ce7d400..078dd7db4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka; + import java.io.File; import java.io.FileInputStream; import java.util.Enumeration; @@ -150,13 +151,13 @@ public class XMLReport Enumeration enum = cpl.loaders(); while( enum.hasMoreElements() ) { - ClassPathLoader.FileLoader fl = ( ClassPathLoader.FileLoader )enum.nextElement(); + ClassPathLoader.FileLoader fl = (ClassPathLoader.FileLoader)enum.nextElement(); ClassFile[] classes = fl.getClasses(); log( "Processing " + classes.length + " classes in " + fl.getFile() ); // process all classes for( int i = 0; i < classes.length; i++ ) { - classFiles.put( classes[i].getFullName(), classes[i] ); + classFiles.put( classes[ i ].getFullName(), classes[ i ] ); } } @@ -178,7 +179,7 @@ public class XMLReport Enumeration classes = classFiles.elements(); while( classes.hasMoreElements() ) { - ClassFile cf = ( ClassFile )classes.nextElement(); + ClassFile cf = (ClassFile)classes.nextElement(); serializeClass( cf ); } // update the document with the stats @@ -208,14 +209,14 @@ public class XMLReport Node child = children.item( i ); if( child.getNodeType() == Node.ELEMENT_NODE ) { - Element elem = ( Element )child; + Element elem = (Element)child; if( "class".equals( elem.getNodeName() ) ) { v.addElement( elem ); } } } - Element[] elems = new Element[v.size()]; + Element[] elems = new Element[ v.size() ]; v.copyInto( elems ); return elems; } @@ -229,7 +230,7 @@ public class XMLReport Node child = children.item( i ); if( child.getNodeType() == Node.ELEMENT_NODE ) { - Element elem = ( Element )child; + Element elem = (Element)child; if( "cov.data".equals( elem.getNodeName() ) ) { return elem; @@ -245,7 +246,7 @@ public class XMLReport Vector methods = new Vector( methodlist.length ); for( int i = 0; i < methodlist.length; i++ ) { - MethodInfo method = methodlist[i]; + MethodInfo method = methodlist[ i ]; String signature = getMethodSignature( classFile, method ); if( filters.accept( signature ) ) { @@ -254,7 +255,7 @@ public class XMLReport } else { -// log("discarding " + signature); + // log("discarding " + signature); } } return methods; @@ -274,17 +275,17 @@ public class XMLReport String[] params = method.getParametersType(); for( int i = 0; i < params.length; i++ ) { - String type = params[i]; + String type = params[ i ]; int pos = type.lastIndexOf( '.' ); if( pos != -1 ) { String pkg = type.substring( 0, pos ); if( "java.lang".equals( pkg ) ) { - params[i] = type.substring( pos + 1 ); + params[ i ] = type.substring( pos + 1 ); } } - buf.append( params[i] ); + buf.append( params[ i ] ); if( i != params.length - 1 ) { buf.append( ", " ); @@ -321,7 +322,7 @@ public class XMLReport Node child = children.item( i ); if( child.getNodeType() == Node.ELEMENT_NODE ) { - Element elem = ( Element )child; + Element elem = (Element)child; if( "method".equals( elem.getNodeName() ) ) { String name = elem.getAttribute( "name" ); @@ -342,14 +343,14 @@ public class XMLReport Node child = children.item( i ); if( child.getNodeType() == Node.ELEMENT_NODE ) { - Element elem = ( Element )child; + Element elem = (Element)child; if( "package".equals( elem.getNodeName() ) ) { v.addElement( elem ); } } } - Element[] elems = new Element[v.size()]; + Element[] elems = new Element[ v.size() ]; v.copyInto( elems ); return elems; } @@ -402,7 +403,6 @@ public class XMLReport return methodElem; } - /** * create node maps so that we can access node faster by their name */ @@ -417,7 +417,7 @@ public class XMLReport log( "Indexing " + pkglen + " packages" ); for( int i = pkglen - 1; i > -1; i-- ) { - Element pkg = ( Element )packages.item( i ); + Element pkg = (Element)packages.item( i ); String pkgname = pkg.getAttribute( "name" ); int nbclasses = 0; @@ -428,7 +428,7 @@ public class XMLReport log( "Indexing " + classlen + " classes in package " + pkgname ); for( int j = classlen - 1; j > -1; j-- ) { - Element clazz = ( Element )classes.item( j ); + Element clazz = (Element)classes.item( j ); String classname = clazz.getAttribute( "name" ); if( pkgname != null && pkgname.length() != 0 ) { @@ -440,7 +440,7 @@ public class XMLReport final int methodlen = methods.getLength(); for( int k = methodlen - 1; k > -1; k-- ) { - Element meth = ( Element )methods.item( k ); + Element meth = (Element)methods.item( k ); StringBuffer methodname = new StringBuffer( meth.getAttribute( "name" ) ); methodname.delete( methodname.toString().indexOf( "(" ), methodname.toString().length() ); String signature = classname + "." + methodname + "()"; @@ -516,9 +516,9 @@ public class XMLReport final int size = methods.length; for( int i = 0; i < size; i++ ) { - MethodInfo method = methods[i]; + MethodInfo method = methods[ i ]; String methodSig = getMethodSignature( method ); - Element methodNode = ( Element )methodNodeList.get( methodSig ); + Element methodNode = (Element)methodNodeList.get( methodSig ); if( methodNode != null && Utils.isAbstract( method.getAccessFlags() ) ) { @@ -538,7 +538,7 @@ public class XMLReport // the class already is reported so ignore it String fullclassname = classFile.getFullName(); log( "Looking for '" + fullclassname + "'" ); - Element clazz = ( Element )classMap.get( fullclassname ); + Element clazz = (Element)classMap.get( fullclassname ); // ignore classes that are already reported, all the information is // already there. @@ -564,7 +564,7 @@ public class XMLReport String pkgname = classFile.getPackage(); // System.out.println("Looking for package " + pkgname); - Element pkgElem = ( Element )pkgMap.get( pkgname ); + Element pkgElem = (Element)pkgMap.get( pkgname ); if( pkgElem == null ) { pkgElem = createPackageElement( pkgname ); @@ -582,7 +582,7 @@ public class XMLReport for( int i = 0; i < methods.size(); i++ ) { // create the method element - MethodInfo method = ( MethodInfo )methods.elementAt( i ); + MethodInfo method = (MethodInfo)methods.elementAt( i ); if( Utils.isAbstract( method.getAccessFlags() ) ) { continue;// no need to report abstract methods @@ -601,7 +601,6 @@ public class XMLReport classMap.put( fullclassname, classElem ); } - /** * update the count of the XML, that is accumulate the stats on methods, * classes and package so that the numbers are valid according to the info @@ -619,7 +618,7 @@ public class XMLReport Enumeration enum = pkgMap.elements(); while( enum.hasMoreElements() ) { - Element pkgElem = ( Element )enum.nextElement(); + Element pkgElem = (Element)enum.nextElement(); String pkgname = pkgElem.getAttribute( "name" ); Element[] classes = getClasses( pkgElem ); int pkg_calls = 0; @@ -630,7 +629,7 @@ public class XMLReport //System.out.println("Processing package '" + pkgname + "': " + classes.length + " classes"); for( int j = 0; j < classes.length; j++ ) { - Element clazz = classes[j]; + Element clazz = classes[ j ]; String classname = clazz.getAttribute( "name" ); if( pkgname != null && pkgname.length() != 0 ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java index 25bf53a4d..228299b9a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; + import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; @@ -14,7 +15,6 @@ import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; import org.apache.tools.ant.taskdefs.optional.depend.constantpool.Utf8CPInfo; import org.apache.tools.ant.taskdefs.optional.sitraka.bytecode.attributes.AttributeInfo; - /** * Object representing a class. Information are kept to the strict minimum for * JProbe reports so that not too many objects are created for a class, @@ -50,7 +50,7 @@ public final class ClassFile // class information access_flags = dis.readShort(); int this_class = dis.readShort(); - fullname = ( ( ClassCPInfo )constantPool.getEntry( this_class ) ).getClassName().replace( '/', '.' ); + fullname = ( (ClassCPInfo)constantPool.getEntry( this_class ) ).getClassName().replace( '/', '.' ); int super_class = dis.readShort(); // skip interfaces... @@ -75,11 +75,11 @@ public final class ClassFile // read methods int method_count = dis.readShort(); - methods = new MethodInfo[method_count]; + methods = new MethodInfo[ method_count ]; for( int i = 0; i < method_count; i++ ) { - methods[i] = new MethodInfo(); - methods[i].read( constantPool, dis ); + methods[ i ] = new MethodInfo(); + methods[ i ].read( constantPool, dis ); } // get interesting attributes. @@ -92,7 +92,7 @@ public final class ClassFile if( AttributeInfo.SOURCE_FILE.equals( attr_name ) ) { int name_index = dis.readShort(); - sourceFile = ( ( Utf8CPInfo )constantPool.getEntry( name_index ) ).getValue(); + sourceFile = ( (Utf8CPInfo)constantPool.getEntry( name_index ) ).getValue(); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java index 26f19526c..ff2b49b0d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; + import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -52,7 +53,7 @@ public class ClassPathLoader File file = new File( st.nextToken() ); entries.addElement( file ); } - files = new File[entries.size()]; + files = new File[ entries.size() ]; entries.copyInto( files ); } @@ -63,10 +64,10 @@ public class ClassPathLoader */ public ClassPathLoader( String[] entries ) { - files = new File[entries.length]; + files = new File[ entries.length ]; for( int i = 0; i < entries.length; i++ ) { - files[i] = new File( entries[i] ); + files[ i ] = new File( entries[ i ] ); } } @@ -93,7 +94,7 @@ public class ClassPathLoader throws IOException { is = new BufferedInputStream( is ); - byte[] buffer = new byte[8192]; + byte[] buffer = new byte[ 8192 ]; ByteArrayOutputStream baos = new ByteArrayOutputStream( 2048 ); int n; baos.reset(); @@ -124,7 +125,7 @@ public class ClassPathLoader Enumeration enum = loaders(); while( enum.hasMoreElements() ) { - FileLoader loader = ( FileLoader )enum.nextElement(); + FileLoader loader = (FileLoader)enum.nextElement(); System.out.println( "Processing " + loader.getFile() ); long t0 = System.currentTimeMillis(); ClassFile[] classes = loader.getClasses(); @@ -132,12 +133,12 @@ public class ClassPathLoader System.out.println( "" + classes.length + " classes loaded in " + dt + "ms" ); for( int j = 0; j < classes.length; j++ ) { - String name = classes[j].getFullName(); + String name = classes[ j ].getFullName(); // do not allow duplicates entries to preserve 'classpath' behavior // first class in wins if( !map.containsKey( name ) ) { - map.put( name, classes[j] ); + map.put( name, classes[ j ] ); } } } @@ -197,7 +198,7 @@ public class ClassPathLoader { throw new NoSuchElementException(); } - File file = files[index++]; + File file = files[ index++ ]; if( !file.exists() ) { return new NullLoader( file ); @@ -240,7 +241,7 @@ class NullLoader implements ClassPathLoader.FileLoader public ClassFile[] getClasses() throws IOException { - return new ClassFile[0]; + return new ClassFile[ 0 ]; } public File getFile() @@ -273,7 +274,7 @@ class JarLoader implements ClassPathLoader.FileLoader Enumeration entries = zipFile.entries(); while( entries.hasMoreElements() ) { - ZipEntry entry = ( ZipEntry )entries.nextElement(); + ZipEntry entry = (ZipEntry)entries.nextElement(); if( entry.getName().endsWith( ".class" ) ) { InputStream is = ClassPathLoader.getCachedStream( zipFile.getInputStream( entry ) ); @@ -282,7 +283,7 @@ class JarLoader implements ClassPathLoader.FileLoader v.addElement( classFile ); } } - ClassFile[] classes = new ClassFile[v.size()]; + ClassFile[] classes = new ClassFile[ v.size() ]; v.copyInto( classes ); return classes; } @@ -346,7 +347,7 @@ class DirectoryLoader implements ClassPathLoader.FileLoader String[] files = directory.list( filter ); for( int i = 0; i < files.length; i++ ) { - list.addElement( new File( directory, files[i] ) ); + list.addElement( new File( directory, files[ i ] ) ); } files = null;// we don't need it anymore if( recurse ) @@ -354,7 +355,7 @@ class DirectoryLoader implements ClassPathLoader.FileLoader String[] subdirs = directory.list( new DirectoryFilter() ); for( int i = 0; i < subdirs.length; i++ ) { - listFilesTo( list, new File( directory, subdirs[i] ), filter, recurse ); + listFilesTo( list, new File( directory, subdirs[ i ] ), filter, recurse ); } } return list; @@ -367,7 +368,7 @@ class DirectoryLoader implements ClassPathLoader.FileLoader Vector files = listFiles( directory, new ClassFilter(), true ); for( int i = 0; i < files.size(); i++ ) { - File file = ( File )files.elementAt( i ); + File file = (File)files.elementAt( i ); InputStream is = null; try { @@ -386,11 +387,12 @@ class DirectoryLoader implements ClassPathLoader.FileLoader is.close(); } catch( IOException ignored ) - {} + { + } } } } - ClassFile[] classes = new ClassFile[v.size()]; + ClassFile[] classes = new ClassFile[ v.size() ]; v.copyInto( classes ); return classes; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java index 5d335ae3b..b3d648841 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; + import java.io.DataInputStream; import java.io.IOException; import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; @@ -24,7 +25,9 @@ public final class MethodInfo private String descriptor; private String name; - public MethodInfo() { } + public MethodInfo() + { + } public String getAccess() { @@ -73,7 +76,7 @@ public final class MethodInfo String[] params = getParametersType(); for( int i = 0; i < params.length; i++ ) { - buf.append( params[i] ); + buf.append( params[ i ] ); if( i != params.length - 1 ) { buf.append( ", " ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java index 74af7a06e..b9de64698 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sitraka.bytecode; + import java.util.Vector; import org.apache.tools.ant.taskdefs.optional.depend.constantpool.ConstantPool; import org.apache.tools.ant.taskdefs.optional.depend.constantpool.Utf8CPInfo; @@ -73,7 +74,9 @@ public class Utils /** * private constructor */ - private Utils() { } + private Utils() + { + } /** * return the class access flag as java modifiers @@ -231,7 +234,7 @@ public class Utils break; } } - String[] array = new String[params.size()]; + String[] array = new String[ params.size() ]; params.copyInto( array ); return array; } @@ -260,7 +263,7 @@ public class Utils */ public static String getUTF8Value( ConstantPool pool, int index ) { - return ( ( Utf8CPInfo )pool.getEntry( index ) ).getValue(); + return ( (Utf8CPInfo)pool.getEntry( index ) ).getValue(); } /** @@ -434,49 +437,49 @@ public class Utils dim.append( "[]" ); } // now get the type - switch ( descriptor.charAt( i ) ) + switch( descriptor.charAt( i ) ) { - case 'B': - sb.append( "byte" ); - break; - case 'C': - sb.append( "char" ); - break; - case 'D': - sb.append( "double" ); - break; - case 'F': - sb.append( "float" ); - break; - case 'I': - sb.append( "int" ); - break; - case 'J': - sb.append( "long" ); - break; - case 'S': - sb.append( "short" ); - break; - case 'Z': - sb.append( "boolean" ); - break; - case 'V': - sb.append( "void" ); - break; - case 'L': - // it is a class - int pos = descriptor.indexOf( ';', i + 1 ); - String classname = descriptor.substring( i + 1, pos ).replace( '/', '.' ); - sb.append( classname ); - i = pos; - break; - default: - //@todo, yeah this happens because I got things like: - // ()Ljava/lang/Object; and it will return and ) will be here - // think about it. + case 'B': + sb.append( "byte" ); + break; + case 'C': + sb.append( "char" ); + break; + case 'D': + sb.append( "double" ); + break; + case 'F': + sb.append( "float" ); + break; + case 'I': + sb.append( "int" ); + break; + case 'J': + sb.append( "long" ); + break; + case 'S': + sb.append( "short" ); + break; + case 'Z': + sb.append( "boolean" ); + break; + case 'V': + sb.append( "void" ); + break; + case 'L': + // it is a class + int pos = descriptor.indexOf( ';', i + 1 ); + String classname = descriptor.substring( i + 1, pos ).replace( '/', '.' ); + sb.append( classname ); + i = pos; + break; + default: + //@todo, yeah this happens because I got things like: + // ()Ljava/lang/Object; and it will return and ) will be here + // think about it. - //ooooops should never happen - //throw new IllegalArgumentException("Invalid descriptor symbol: '" + i + "' in '" + descriptor + "'"); + //ooooops should never happen + //throw new IllegalArgumentException("Invalid descriptor symbol: '" + i + "' in '" + descriptor + "'"); } sb.append( dim.toString() ); return ++i; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java index 64e1b8e88..a69f1086a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/AntSoundPlayer.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sound; + import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioFormat; @@ -14,17 +15,14 @@ import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; import javax.sound.sampled.DataLine; import javax.sound.sampled.Line; -import javax.sound.sampled.LineEvent;// imports for all the sound classes required -// note: comes with jmf or jdk1.3 + -// these can be obtained from http://java.sun.com/products/java-media/sound/ +import javax.sound.sampled.LineEvent; import javax.sound.sampled.LineListener; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.UnsupportedAudioFileException; -import org.apache.tools.ant.BuildEvent;// ant includes +import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.Project; - /** * This class is designed to be used by any AntTask that requires audio output. * It implements the BuildListener interface to listen for BuildEvents and could @@ -47,8 +45,9 @@ public class AntSoundPlayer implements LineListener, BuildListener private int loopsFail = 0; private Long durationFail = null; - public AntSoundPlayer() { } - + public AntSoundPlayer() + { + } /** * @param fileFail The feature to be added to the BuildFailedSound attribute @@ -98,13 +97,14 @@ public class AntSoundPlayer implements LineListener, BuildListener } } - /** * Fired before any targets are started. * * @param event Description of Parameter */ - public void buildStarted( BuildEvent event ) { } + public void buildStarted( BuildEvent event ) + { + } /** * Fired whenever a message is logged. @@ -113,7 +113,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @see BuildEvent#getMessage() * @see BuildEvent#getPriority() */ - public void messageLogged( BuildEvent event ) { } + public void messageLogged( BuildEvent event ) + { + } /** * Fired when a target has finished. This event will still be thrown if an @@ -122,7 +124,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @param event Description of Parameter * @see BuildEvent#getException() */ - public void targetFinished( BuildEvent event ) { } + public void targetFinished( BuildEvent event ) + { + } /** * Fired when a target is started. @@ -130,7 +134,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @param event Description of Parameter * @see BuildEvent#getTarget() */ - public void targetStarted( BuildEvent event ) { } + public void targetStarted( BuildEvent event ) + { + } /** * Fired when a task has finished. This event will still be throw if an @@ -139,7 +145,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @param event Description of Parameter * @see BuildEvent#getException() */ - public void taskFinished( BuildEvent event ) { } + public void taskFinished( BuildEvent event ) + { + } /** * Fired when a task is started. @@ -147,7 +155,9 @@ public class AntSoundPlayer implements LineListener, BuildListener * @param event Description of Parameter * @see BuildEvent#getTask() */ - public void taskStarted( BuildEvent event ) { } + public void taskStarted( BuildEvent event ) + { + } /** * This is implemented to listen for any line events and closes the clip if @@ -205,10 +215,10 @@ public class AntSoundPlayer implements LineListener, BuildListener { AudioFormat format = audioInputStream.getFormat(); DataLine.Info info = new DataLine.Info( Clip.class, format, - AudioSystem.NOT_SPECIFIED ); + AudioSystem.NOT_SPECIFIED ); try { - audioClip = ( Clip )AudioSystem.getLine( info ); + audioClip = (Clip)AudioSystem.getLine( info ); audioClip.addLineListener( this ); audioClip.open( audioInputStream ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java index 8854c4c0d..3f20c2c7c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.sound; + import java.io.File; import java.util.Random; 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; @@ -33,7 +34,9 @@ public class SoundTask extends Task private BuildAlert success = null; private BuildAlert fail = null; - public SoundTask() { } + public SoundTask() + { + } public BuildAlert createFail() { @@ -59,7 +62,7 @@ public class SoundTask extends Task else { soundPlayer.addBuildSuccessfulSound( success.getSource(), - success.getLoops(), success.getDuration() ); + success.getLoops(), success.getDuration() ); } if( fail == null ) @@ -69,14 +72,16 @@ public class SoundTask extends Task else { soundPlayer.addBuildFailedSound( fail.getSource(), - fail.getLoops(), fail.getDuration() ); + fail.getLoops(), fail.getDuration() ); } getProject().addBuildListener( soundPlayer ); } - public void init() { } + public void init() + { + } /** * A class to be extended by any BuildAlert's that require the output of @@ -158,7 +163,7 @@ public class SoundTask extends Task Vector files = new Vector(); for( int i = 0; i < entries.length; i++ ) { - File f = new File( source, entries[i] ); + File f = new File( source, entries[ i ] ); if( f.isFile() ) { files.addElement( f ); @@ -166,14 +171,14 @@ public class SoundTask extends Task } if( files.size() < 1 ) { - throw new BuildException( "No files found in directory " + source ); + throw new TaskException( "No files found in directory " + source ); } int numfiles = files.size(); // get a random number between 0 and the number of files Random rn = new Random(); int x = rn.nextInt( numfiles ); // set the source to the file at that location - this.source = ( File )files.elementAt( x ); + this.source = (File)files.elementAt( x ); } } else diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java index 63a63e54a..7dfcfdf5e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSS.java @@ -6,13 +6,14 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; -import org.apache.tools.ant.BuildException; + +import java.io.IOException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.taskdefs.Execute; import org.apache.tools.ant.taskdefs.LogStreamHandler; import org.apache.tools.ant.types.Commandline; -import java.io.IOException; /** * A base class for creating tasks for executing commands on Visual SourceSafe. @@ -203,8 +204,8 @@ public abstract class MSVSS extends Task try { Execute exe = new Execute( new LogStreamHandler( this, - Project.MSG_INFO, - Project.MSG_WARN ) ); + Project.MSG_INFO, + Project.MSG_WARN ) ); // If location of ss.ini is specified we need to set the // environment-variable SSDIR to this value @@ -213,14 +214,14 @@ public abstract class MSVSS extends Task String[] env = exe.getEnvironment(); if( env == null ) { - env = new String[0]; + env = new String[ 0 ]; } - String[] newEnv = new String[env.length + 1]; + String[] newEnv = new String[ env.length + 1 ]; for( int i = 0; i < env.length; i++ ) { - newEnv[i] = env[i]; + newEnv[ i ] = env[ i ]; } - newEnv[env.length] = "SSDIR=" + m_serverPath; + newEnv[ env.length ] = "SSDIR=" + m_serverPath; exe.setEnvironment( newEnv ); } @@ -232,7 +233,7 @@ public abstract class MSVSS extends Task } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java index c69dc33b1..7377accf3 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -134,6 +135,7 @@ public class MSVSSCHECKIN extends MSVSS * @param cmd Description of Parameter */ public void getLocalpathCommand( Commandline cmd ) + throws TaskException { if( m_LocalPath == null ) { @@ -150,7 +152,7 @@ public class MSVSSCHECKIN extends MSVSS { String msg = "Directory " + m_LocalPath + " creation was not " + "succesful for an unknown reason"; - throw new BuildException( msg ); + throw new TaskException( msg ); } project.log( "Created dir: " + dir.getAbsolutePath() ); } @@ -195,10 +197,10 @@ public class MSVSSCHECKIN extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -207,7 +209,7 @@ public class MSVSSCHECKIN extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -237,7 +239,7 @@ public class MSVSSCHECKIN extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java index e3f0124ee..3b5899173 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKOUT.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -161,6 +162,7 @@ public class MSVSSCHECKOUT extends MSVSS * @param cmd Description of Parameter */ public void getLocalpathCommand( Commandline cmd ) + throws TaskException { if( m_LocalPath == null ) { @@ -177,7 +179,7 @@ public class MSVSSCHECKOUT extends MSVSS { String msg = "Directory " + m_LocalPath + " creation was not " + "succesful for an unknown reason"; - throw new BuildException( msg ); + throw new TaskException( msg ); } project.log( "Created dir: " + dir.getAbsolutePath() ); } @@ -230,10 +232,10 @@ public class MSVSSCHECKOUT extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -242,7 +244,7 @@ public class MSVSSCHECKOUT extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -270,7 +272,7 @@ public class MSVSSCHECKOUT extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java index 8ec462510..82dad7363 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSGET.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; @@ -369,6 +370,7 @@ public class MSVSSGET extends MSVSS * @param cmd Description of Parameter */ public void getLocalpathCommand( Commandline cmd ) + throws TaskException { if( m_LocalPath == null ) { @@ -385,7 +387,7 @@ public class MSVSSGET extends MSVSS { String msg = "Directory " + m_LocalPath + " creation was not " + "successful for an unknown reason"; - throw new BuildException( msg ); + throw new TaskException( msg ); } project.log( "Created dir: " + dir.getAbsolutePath() ); } @@ -461,10 +463,10 @@ public class MSVSSGET extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -473,7 +475,7 @@ public class MSVSSGET extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -505,7 +507,7 @@ public class MSVSSGET extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java index 58b2d1e4f..dfea9efc5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSHISTORY.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; + import java.io.File; import java.text.DateFormat; import java.text.ParseException; @@ -13,7 +14,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.EnumeratedAttribute; @@ -160,7 +161,7 @@ public class MSVSSHISTORY extends MSVSS } else { - throw new BuildException( "Style " + attr + " unknown." ); + throw new TaskException( "Style " + attr + " unknown." ); } } @@ -214,10 +215,10 @@ public class MSVSSHISTORY extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -226,7 +227,7 @@ public class MSVSSHISTORY extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -272,7 +273,7 @@ public class MSVSSHISTORY extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } @@ -322,10 +323,10 @@ public class MSVSSHISTORY extends MSVSS * Builds the version date command. * * @param cmd the commandline the command is to be added to - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void getVersionDateCommand( Commandline cmd ) - throws BuildException + throws TaskException { if( m_FromDate == null && m_ToDate == null && m_NumDays == Integer.MIN_VALUE ) { @@ -346,7 +347,7 @@ public class MSVSSHISTORY extends MSVSS catch( ParseException ex ) { String msg = "Error parsing date: " + m_ToDate; - throw new BuildException( msg ); + throw new TaskException( msg ); } cmd.createArgument().setValue( FLAG_VERSION_DATE + m_ToDate + VALUE_FROMDATE + startDate ); } @@ -360,7 +361,7 @@ public class MSVSSHISTORY extends MSVSS catch( ParseException ex ) { String msg = "Error parsing date: " + m_FromDate; - throw new BuildException( msg ); + throw new TaskException( msg ); } cmd.createArgument().setValue( FLAG_VERSION_DATE + endDate + VALUE_FROMDATE + m_FromDate ); } @@ -381,10 +382,10 @@ public class MSVSSHISTORY extends MSVSS * Builds the version date command. * * @param cmd the commandline the command is to be added to - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ private void getVersionLabelCommand( Commandline cmd ) - throws BuildException + throws TaskException { if( m_FromLabel == null && m_ToLabel == null ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java index d9ac730f8..cc4b6c472 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.optional.vss; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.types.Commandline; /** @@ -316,10 +317,10 @@ public class MSVSSLABEL extends MSVSS * Builds a command line to execute ss and then calls Exec's run method to * execute the command line. * - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void execute() - throws BuildException + throws TaskException { Commandline commandLine = new Commandline(); int result = 0; @@ -328,12 +329,12 @@ public class MSVSSLABEL extends MSVSS if( getVsspath() == null ) { String msg = "vsspath attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } if( getLabel() == null ) { String msg = "label attribute must be set!"; - throw new BuildException( msg ); + throw new TaskException( msg ); } // now look for illegal combinations of things ... @@ -368,7 +369,7 @@ public class MSVSSLABEL extends MSVSS if( result != 0 ) { String msg = "Failed executing: " + commandLine.toString(); - throw new BuildException( msg ); + throw new TaskException( msg ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index 934d8e199..4ec600fbf 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -6,13 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; + import java.io.File; import java.util.Random; import java.util.Vector; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Rmic; import org.apache.tools.ant.types.Commandline; -import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.FileNameMapper; @@ -35,7 +35,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter private Rmic attributes; private FileNameMapper mapper; - public DefaultRmicAdapter() { } + public DefaultRmicAdapter() + { + } public void setRmic( Rmic attributes ) { @@ -93,7 +95,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { for( int i = 0; i < options.length; i++ ) { - cmd.createArgument().setValue( options[i] ); + cmd.createArgument().setValue( options[ i ] ); } } @@ -144,7 +146,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter if( attributes.getIiopopts() != null ) { attributes.log( "IIOP Options: " + attributes.getIiopopts(), - Project.MSG_INFO ); + Project.MSG_INFO ); cmd.createArgument().setValue( attributes.getIiopopts() ); } } @@ -157,7 +159,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { cmd.createArgument().setValue( attributes.getIdlopts() ); attributes.log( "IDL Options: " + attributes.getIdlopts(), - Project.MSG_INFO ); + Project.MSG_INFO ); } } @@ -237,7 +239,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter Vector compileList = attributes.getCompileList(); attributes.log( "Compilation args: " + cmd.toString(), - Project.MSG_VERBOSE ); + Project.MSG_VERBOSE ); StringBuffer niceSourceList = new StringBuffer( "File" ); if( compileList.size() != 1 ) @@ -248,7 +250,7 @@ public abstract class DefaultRmicAdapter implements RmicAdapter for( int i = 0; i < compileList.size(); i++ ) { - String arg = ( String )compileList.elementAt( i ); + String arg = (String)compileList.elementAt( i ); cmd.createArgument().setValue( arg ); niceSourceList.append( " " + arg ); } @@ -264,29 +266,35 @@ public abstract class DefaultRmicAdapter implements RmicAdapter private class RmicFileNameMapper implements FileNameMapper { - RmicFileNameMapper() { } + RmicFileNameMapper() + { + } /** * Empty implementation. * * @param s The new From value */ - public void setFrom( String s ) { } + public void setFrom( String s ) + { + } /** * Empty implementation. * * @param s The new To value */ - public void setTo( String s ) { } + public void setTo( String s ) + { + } public String[] mapFileName( String name ) { if( name == null - || !name.endsWith( ".class" ) - || name.endsWith( getStubClassSuffix() + ".class" ) - || name.endsWith( getSkelClassSuffix() + ".class" ) - || name.endsWith( getTieClassSuffix() + ".class" ) ) + || !name.endsWith( ".class" ) + || name.endsWith( getStubClassSuffix() + ".class" ) + || name.endsWith( getSkelClassSuffix() + ".class" ) + || name.endsWith( getTieClassSuffix() + ".class" ) ) { // Not a .class file or the one we'd generate return null; @@ -317,14 +325,14 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { target = new String[]{ base + getStubClassSuffix() + ".class" - }; + }; } else { target = new String[]{ base + getStubClassSuffix() + ".class", base + getSkelClassSuffix() + ".class", - }; + }; } } else if( !attributes.getIdl() ) @@ -358,8 +366,8 @@ public abstract class DefaultRmicAdapter implements RmicAdapter // only stub, no tie target = new String[]{ dirname + "_" + filename + getStubClassSuffix() - + ".class" - }; + + ".class" + }; } else { @@ -386,28 +394,28 @@ public abstract class DefaultRmicAdapter implements RmicAdapter target = new String[]{ dirname + "_" + filename + getTieClassSuffix() - + ".class", + + ".class", iDir + "_" + iName.substring( iIndex ) - + getStubClassSuffix() + ".class" - }; + + getStubClassSuffix() + ".class" + }; } } catch( ClassNotFoundException e ) { attributes.log( "Unable to verify class " + classname - + ". It could not be found.", - Project.MSG_WARN ); + + ". It could not be found.", + Project.MSG_WARN ); } catch( NoClassDefFoundError e ) { attributes.log( "Unable to verify class " + classname - + ". It is not defined.", Project.MSG_WARN ); + + ". It is not defined.", Project.MSG_WARN ); } catch( Throwable t ) { attributes.log( "Unable to verify class " + classname - + ". Loading caused Exception: " - + t.getMessage(), Project.MSG_WARN ); + + ". Loading caused Exception: " + + t.getMessage(), Project.MSG_WARN ); } } return target; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java index c835faf9f..cfc02497d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; + import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; @@ -21,7 +22,7 @@ public class KaffeRmic extends DefaultRmicAdapter { public boolean execute() - throws BuildException + throws TaskException { getRmic().log( "Using Kaffe rmic", Project.MSG_VERBOSE ); Commandline cmd = setupRmicCommand(); @@ -34,25 +35,25 @@ public class KaffeRmic extends DefaultRmicAdapter Object rmic = cons.newInstance( new Object[]{cmd.getArguments()} ); Method doRmic = c.getMethod( "run", null ); String str[] = cmd.getArguments(); - Boolean ok = ( Boolean )doRmic.invoke( rmic, null ); + Boolean ok = (Boolean)doRmic.invoke( rmic, null ); return ok.booleanValue(); } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use Kaffe rmic, as it is not available" + - " A common solution is to set the environment variable" + - " JAVA_HOME or CLASSPATH." ); + throw new TaskException( "Cannot use Kaffe rmic, as it is not available" + + " A common solution is to set the environment variable" + + " JAVA_HOME or CLASSPATH." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting Kaffe rmic: ", ex ); + throw new TaskException( "Error starting Kaffe rmic: ", ex ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java index 34491f984..0bfc26448 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/RmicAdapter.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.taskdefs.Rmic; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.FileNameMapper; @@ -38,10 +39,10 @@ public interface RmicAdapter * Executes the task. * * @return has the compilation been successful - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean execute() - throws BuildException; + throws TaskException; /** * Maps source class files to the files generated by this rmic diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java index a8b21d048..fa5000e98 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/RmicAdapterFactory.java @@ -6,9 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Task; +import org.apache.myrmidon.api.TaskException; +import org.apache.tools.ant.Task; /** * Creates the necessary rmic adapter, given basic criteria. @@ -22,7 +22,9 @@ public class RmicAdapterFactory /** * This is a singlton -- can't create instances!! */ - private RmicAdapterFactory() { } + private RmicAdapterFactory() + { + } /** * Based on the parameter passed in, this method creates the necessary @@ -39,11 +41,11 @@ public class RmicAdapterFactory * classname of the rmic's adapter. * @param task a task to log through. * @return The Rmic value - * @throws BuildException if the rmic type could not be resolved into a rmic + * @throws TaskException if the rmic type could not be resolved into a rmic * adapter. */ public static RmicAdapter getRmic( String rmicType, Task task ) - throws BuildException + throws TaskException { if( rmicType == null ) { @@ -66,7 +68,7 @@ public class RmicAdapterFactory } catch( ClassNotFoundException cnfk ) { - throw new BuildException( "Couldn\'t guess rmic implementation" ); + throw new TaskException( "Couldn\'t guess rmic implementation" ); } } } @@ -92,32 +94,32 @@ public class RmicAdapterFactory * * @param className The fully qualified classname to be created. * @return Description of the Returned Value - * @throws BuildException This is the fit that is thrown if className isn't + * @throws TaskException This is the fit that is thrown if className isn't * an instance of RmicAdapter. */ private static RmicAdapter resolveClassName( String className ) - throws BuildException + throws TaskException { try { Class c = Class.forName( className ); Object o = c.newInstance(); - return ( RmicAdapter )o; + return (RmicAdapter)o; } catch( ClassNotFoundException cnfe ) { - throw new BuildException( className + " can\'t be found.", cnfe ); + throw new TaskException( className + " can\'t be found.", cnfe ); } catch( ClassCastException cce ) { - throw new BuildException( className + " isn\'t the classname of " - + "a rmic adapter.", cce ); + throw new TaskException( className + " isn\'t the classname of " + + "a rmic adapter.", cce ); } catch( Throwable t ) { // for all other possibilities - throw new BuildException( className + " caused an interesting " - + "exception.", t ); + throw new TaskException( className + " caused an interesting " + + "exception.", t ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/SunRmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/SunRmic.java index c21c07c09..7826be65f 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/SunRmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/SunRmic.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; + import java.io.IOException; import java.io.OutputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.LogOutputStream; import org.apache.tools.ant.types.Commandline; @@ -24,7 +25,7 @@ public class SunRmic extends DefaultRmicAdapter { public boolean execute() - throws BuildException + throws TaskException { getRmic().log( "Using SUN rmic compiler", Project.MSG_VERBOSE ); Commandline cmd = setupRmicCommand(); @@ -37,30 +38,30 @@ public class SunRmic extends DefaultRmicAdapter { Class c = Class.forName( "sun.rmi.rmic.Main" ); Constructor cons = c.getConstructor( new Class[] - {OutputStream.class, String.class} ); + {OutputStream.class, String.class} ); Object rmic = cons.newInstance( new Object[]{logstr, "rmic"} ); Method doRmic = c.getMethod( "compile", - new Class[]{String[].class} ); - Boolean ok = ( Boolean )doRmic.invoke( rmic, - ( new Object[]{cmd.getArguments()} ) ); + new Class[]{String[].class} ); + Boolean ok = (Boolean)doRmic.invoke( rmic, + ( new Object[]{cmd.getArguments()} ) ); return ok.booleanValue(); } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use SUN rmic, as it is not available" + - " A common solution is to set the environment variable" + - " JAVA_HOME or CLASSPATH." ); + throw new TaskException( "Cannot use SUN rmic, as it is not available" + + " A common solution is to set the environment variable" + + " JAVA_HOME or CLASSPATH." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting SUN rmic: ", ex ); + throw new TaskException( "Error starting SUN rmic: ", ex ); } } finally @@ -71,7 +72,7 @@ public class SunRmic extends DefaultRmicAdapter } catch( IOException e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/WLRmic.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/WLRmic.java index fae6392a0..36e543908 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/WLRmic.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/taskdefs/rmic/WLRmic.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.taskdefs.rmic; + import java.lang.reflect.Method; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.types.Commandline; @@ -40,7 +41,7 @@ public class WLRmic extends DefaultRmicAdapter } public boolean execute() - throws BuildException + throws TaskException { getRmic().log( "Using WebLogic rmic", Project.MSG_VERBOSE ); Commandline cmd = setupRmicCommand( new String[]{"-noexit"} ); @@ -50,25 +51,25 @@ public class WLRmic extends DefaultRmicAdapter // Create an instance of the rmic Class c = Class.forName( "weblogic.rmic" ); Method doRmic = c.getMethod( "main", - new Class[]{String[].class} ); + new Class[]{String[].class} ); doRmic.invoke( null, new Object[]{cmd.getArguments()} ); return true; } catch( ClassNotFoundException ex ) { - throw new BuildException( "Cannot use WebLogic rmic, as it is not available" + - " A common solution is to set the environment variable" + - " CLASSPATH." ); + throw new TaskException( "Cannot use WebLogic rmic, as it is not available" + + " A common solution is to set the environment variable" + + " CLASSPATH." ); } catch( Exception ex ) { - if( ex instanceof BuildException ) + if( ex instanceof TaskException ) { - throw ( BuildException )ex; + throw (TaskException)ex; } else { - throw new BuildException( "Error starting WebLogic rmic: ", ex ); + throw new TaskException( "Error starting WebLogic rmic: ", ex ); } } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java index 226e992d0..5d700e333 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Commandline.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.StringTokenizer; import java.util.Vector; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.BuildException; /** * Commandline objects help handling command lines specifying processes to @@ -40,6 +39,7 @@ public class Commandline implements Cloneable private String executable = null; public Commandline( String to_process ) + throws TaskException { super(); String[] tmp = translateCommandline( to_process ); @@ -75,7 +75,7 @@ public class Commandline implements Cloneable { if( argument.indexOf( "\'" ) > -1 ) { - throw new BuildException( "Can\'t handle single and double quotes in same argument" ); + throw new TaskException( "Can\'t handle single and double quotes in same argument" ); } else { @@ -120,6 +120,7 @@ public class Commandline implements Cloneable } public static String[] translateCommandline( String to_process ) + throws TaskException { if( to_process == null || to_process.length() == 0 ) { @@ -193,7 +194,7 @@ public class Commandline implements Cloneable if( state == inQuote || state == inDoubleQuote ) { - throw new BuildException( "unbalanced quotes in " + to_process ); + throw new TaskException( "unbalanced quotes in " + to_process ); } String[] args = new String[ v.size() ]; @@ -356,6 +357,7 @@ public class Commandline implements Cloneable * @param line line to split into several commandline arguments */ public void setLine( String line ) + throws TaskException { parts = translateCommandline( line ); } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java index 489edcdc0..f0aef1e7e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/CommandlineJava.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.util.Enumeration; import java.util.Properties; import java.util.Vector; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; +import org.apache.myrmidon.api.TaskException; import org.apache.myrmidon.framework.Os; +import org.apache.tools.ant.Project; /** * A representation of a Java command line that is nothing more than a composite @@ -76,7 +77,7 @@ public class CommandlineJava implements Cloneable } public void setSystemProperties() - throws BuildException + throws TaskException { sysProperties.setSystem(); } @@ -116,17 +117,18 @@ public class CommandlineJava implements Cloneable * @return the list of all arguments necessary to run the vm. */ public String[] getCommandline() + throws TaskException { - String[] result = new String[size()]; + String[] result = new String[ size() ]; int pos = 0; String[] vmArgs = getActualVMCommand().getCommandline(); // first argument is the java.exe path... - result[pos++] = vmArgs[0]; + result[ pos++ ] = vmArgs[ 0 ]; // -jar must be the first option in the command line. if( executeJar ) { - result[pos++] = "-jar"; + result[ pos++ ] = "-jar"; } // next follows the vm options System.arraycopy( vmArgs, 1, result, pos, vmArgs.length - 1 ); @@ -135,20 +137,20 @@ public class CommandlineJava implements Cloneable if( sysProperties.size() > 0 ) { System.arraycopy( sysProperties.getVariables(), 0, - result, pos, sysProperties.size() ); + result, pos, sysProperties.size() ); pos += sysProperties.size(); } // classpath is a vm option too.. Path fullClasspath = classpath != null ? classpath.concatSystemClasspath( "ignore" ) : null; if( fullClasspath != null && fullClasspath.toString().trim().length() > 0 ) { - result[pos++] = "-classpath"; - result[pos++] = fullClasspath.toString(); + result[ pos++ ] = "-classpath"; + result[ pos++ ] = fullClasspath.toString(); } // this is the classname to run as well as its arguments. // in case of 'executeJar', the executable is a jar file. System.arraycopy( javaCommand.getCommandline(), 0, - result, pos, javaCommand.size() ); + result, pos, javaCommand.size() ); return result; } @@ -202,13 +204,13 @@ public class CommandlineJava implements Cloneable public Object clone() { CommandlineJava c = new CommandlineJava(); - c.vmCommand = ( Commandline )vmCommand.clone(); - c.javaCommand = ( Commandline )javaCommand.clone(); - c.sysProperties = ( SysProperties )sysProperties.clone(); + c.vmCommand = (Commandline)vmCommand.clone(); + c.javaCommand = (Commandline)javaCommand.clone(); + c.sysProperties = (SysProperties)sysProperties.clone(); c.maxMemory = maxMemory; if( classpath != null ) { - c.classpath = ( Path )classpath.clone(); + c.classpath = (Path)classpath.clone(); } c.vmVersion = vmVersion; c.executeJar = executeJar; @@ -235,7 +237,7 @@ public class CommandlineJava implements Cloneable } public void restoreSystemProperties() - throws BuildException + throws TaskException { sysProperties.restoreSystem(); } @@ -247,6 +249,7 @@ public class CommandlineJava implements Cloneable * @see #getCommandline() */ public int size() + throws TaskException { int size = getActualVMCommand().size() + javaCommand.size() + sysProperties.size(); // classpath is "-classpath " -> 2 args @@ -263,15 +266,21 @@ public class CommandlineJava implements Cloneable return size; } - public String toString() { - return Commandline.toString( getCommandline() ); + try + { + return Commandline.toString( getCommandline() ); + } + catch( TaskException e ) + { + return e.toString(); + } } private Commandline getActualVMCommand() { - Commandline actualVMCommand = ( Commandline )vmCommand.clone(); + Commandline actualVMCommand = (Commandline)vmCommand.clone(); if( maxMemory != null ) { if( vmVersion.startsWith( "1.1" ) ) @@ -298,7 +307,7 @@ public class CommandlineJava implements Cloneable // PATH. java.io.File jExecutable = new java.io.File( System.getProperty( "java.home" ) + - "/../bin/java" + extension ); + "/../bin/java" + extension ); if( jExecutable.exists() && !Os.isFamily( "netware" ) ) { @@ -323,27 +332,27 @@ public class CommandlineJava implements Cloneable Properties sys = null; public void setSystem() - throws BuildException + throws TaskException { try { Properties p = new Properties( sys = System.getProperties() ); - for( Enumeration e = variables.elements(); e.hasMoreElements(); ) + for( Enumeration e = variables.elements(); e.hasMoreElements(); ) { - Environment.Variable v = ( Environment.Variable )e.nextElement(); + Environment.Variable v = (Environment.Variable)e.nextElement(); p.put( v.getKey(), v.getValue() ); } System.setProperties( p ); } catch( SecurityException e ) { - throw new BuildException( "Cannot modify system properties", e ); + throw new TaskException( "Cannot modify system properties", e ); } } public String[] getVariables() - throws BuildException + throws TaskException { String props[] = super.getVariables(); @@ -352,7 +361,7 @@ public class CommandlineJava implements Cloneable for( int i = 0; i < props.length; i++ ) { - props[i] = "-D" + props[i]; + props[ i ] = "-D" + props[ i ]; } return props; } @@ -361,8 +370,8 @@ public class CommandlineJava implements Cloneable { try { - SysProperties c = ( SysProperties )super.clone(); - c.variables = ( Vector )variables.clone(); + SysProperties c = (SysProperties)super.clone(); + c.variables = (Vector)variables.clone(); return c; } catch( CloneNotSupportedException e ) @@ -372,10 +381,10 @@ public class CommandlineJava implements Cloneable } public void restoreSystem() - throws BuildException + throws TaskException { if( sys == null ) - throw new BuildException( "Unbalanced nesting of SysProperties" ); + throw new TaskException( "Unbalanced nesting of SysProperties" ); try { @@ -384,7 +393,7 @@ public class CommandlineJava implements Cloneable } catch( SecurityException e ) { - throw new BuildException( "Cannot modify system properties", e ); + throw new TaskException( "Cannot modify system properties", e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/DataType.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/DataType.java index 7ac037887..494b1b940 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/DataType.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/DataType.java @@ -9,7 +9,6 @@ package org.apache.tools.ant.types; import java.util.Stack; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.ProjectComponent; @@ -135,9 +134,9 @@ public abstract class DataType * * @return Description of the Returned Value */ - protected BuildException circularReference() + protected TaskException circularReference() { - return new BuildException( "This data type contains a circular reference." ); + return new TaskException( "This data type contains a circular reference." ); } /** @@ -145,7 +144,7 @@ public abstract class DataType * the Stack (which holds all DataType instances that directly or indirectly * reference this instance, including this instance itself).

* - * If one is included, throw a BuildException created by {@link + * If one is included, throw a TaskException created by {@link * #circularReference circularReference}.

* * This implementation is appropriate only for a DataType that cannot hold @@ -157,10 +156,10 @@ public abstract class DataType * * @param stk Description of Parameter * @param p Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void dieOnCircularReference( Stack stk, Project p ) - throws BuildException + throws TaskException { if( checked || !isReference() ) @@ -191,9 +190,9 @@ public abstract class DataType * * @return Description of the Returned Value */ - protected BuildException noChildrenAllowed() + protected TaskException noChildrenAllowed() { - return new BuildException( "You must not specify nested elements when using refid" ); + return new TaskException( "You must not specify nested elements when using refid" ); } /** @@ -202,9 +201,9 @@ public abstract class DataType * * @return Description of the Returned Value */ - protected BuildException tooManyAttributes() + protected TaskException tooManyAttributes() { - return new BuildException( "You must not specify more than one attribute" + - " when using refid" ); + return new TaskException( "You must not specify more than one attribute" + + " when using refid" ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Description.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Description.java index 861006aac..ab6727dab 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Description.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Description.java @@ -7,7 +7,6 @@ */ package org.apache.tools.ant.types; - /** * Description is used to provide a project-wide description element (that is, a * description that applies to a buildfile as a whole). If present, the diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/EnumeratedAttribute.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/EnumeratedAttribute.java index 24bd08bd3..17bc5467b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/EnumeratedAttribute.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/EnumeratedAttribute.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.types; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Helper class for attributes that can only take one of a fixed list of values. @@ -21,21 +22,23 @@ public abstract class EnumeratedAttribute protected String value; - public EnumeratedAttribute() { } + public EnumeratedAttribute() + { + } /** * Invoked by {@link org.apache.tools.ant.IntrospectionHelper * IntrospectionHelper}. * * @param value The new Value value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public final void setValue( String value ) - throws BuildException + throws TaskException { if( !containsValue( value ) ) { - throw new BuildException( value + " is not a legal value for this attribute" ); + throw new TaskException( value + " is not a legal value for this attribute" ); } this.value = value; } @@ -73,7 +76,7 @@ public abstract class EnumeratedAttribute for( int i = 0; i < values.length; i++ ) { - if( value.equals( values[i] ) ) + if( value.equals( values[ i ] ) ) { return true; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Environment.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Environment.java index ca2cd0260..dd7b63023 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Environment.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Environment.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.util.Vector; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Wrapper for environment variables. @@ -25,16 +26,16 @@ public class Environment } public String[] getVariables() - throws BuildException + throws TaskException { if( variables.size() == 0 ) { return null; } - String[] result = new String[variables.size()]; + String[] result = new String[ variables.size() ]; for( int i = 0; i < result.length; i++ ) { - result[i] = ( ( Variable )variables.elementAt( i ) ).getContent(); + result[ i ] = ( (Variable)variables.elementAt( i ) ).getContent(); } return result; } @@ -74,11 +75,11 @@ public class Environment } public String getContent() - throws BuildException + throws TaskException { if( key == null || value == null ) { - throw new BuildException( "key and value must be specified for environment variables." ); + throw new TaskException( "key and value must be specified for environment variables." ); } StringBuffer sb = new StringBuffer( key.trim() ); sb.append( "=" ).append( value.trim() ); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileList.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileList.java index 1d369eb8a..cd7432caf 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileList.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileList.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.io.File; import java.util.Stack; 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; /** @@ -41,7 +42,7 @@ public class FileList extends DataType } public void setDir( File dir ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -74,10 +75,10 @@ public class FileList extends DataType * if you make it a reference.

* * @param r The new Refid value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setRefid( Reference r ) - throws BuildException + throws TaskException { if( ( dir != null ) || ( filenames.size() != 0 ) ) { @@ -110,15 +111,15 @@ public class FileList extends DataType if( dir == null ) { - throw new BuildException( "No directory specified for filelist." ); + throw new TaskException( "No directory specified for filelist." ); } if( filenames.size() == 0 ) { - throw new BuildException( "No files specified for filelist." ); + throw new TaskException( "No files specified for filelist." ); } - String result[] = new String[filenames.size()]; + String result[] = new String[ filenames.size() ]; filenames.copyInto( result ); return result; } @@ -143,11 +144,11 @@ public class FileList extends DataType if( !( o instanceof FileList ) ) { String msg = ref.getRefId() + " doesn\'t denote a filelist"; - throw new BuildException( msg ); + throw new TaskException( msg ); } else { - return ( FileList )o; + return (FileList)o; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java index 372a1a765..fdab4b91e 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FileSet.java @@ -11,7 +11,6 @@ import java.io.File; import java.util.Stack; 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.FileScanner; import org.apache.tools.ant.Project; @@ -185,6 +184,7 @@ public class FileSet extends DataType implements Cloneable } public void setupDirectoryScanner( FileScanner ds, Project p ) + throws TaskException { if( ds == null ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java index 5e4a6bb48..ccc02ece5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/FilterSet.java @@ -15,7 +15,6 @@ import java.util.Hashtable; import java.util.Properties; import java.util.Vector; import org.apache.myrmidon.api.TaskException; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; /** @@ -105,10 +104,10 @@ public class FilterSet extends DataType implements Cloneable * * @param filtersFile sets the filter fil to read filters for this filter * set from. - * @exception BuildException if there is a problem reading the filters + * @exception TaskException if there is a problem reading the filters */ public void setFiltersfile( File filtersFile ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -253,11 +252,11 @@ public class FilterSet extends DataType implements Cloneable * Read the filters from the given file. * * @param filtersFile the file from which filters are read - * @exception BuildException Throw a build exception when unable to read the + * @exception TaskException Throw a build exception when unable to read the * file. */ public void readFiltersFromFile( File filtersFile ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -285,7 +284,7 @@ public class FilterSet extends DataType implements Cloneable } catch( Exception e ) { - throw new BuildException( "Could not read filters from file: " + filtersFile ); + throw new TaskException( "Could not read filters from file: " + filtersFile ); } finally { @@ -303,7 +302,7 @@ public class FilterSet extends DataType implements Cloneable } else { - throw new BuildException( "Must specify a file not a directory in the filtersfile attribute:" + filtersFile ); + throw new TaskException( "Must specify a file not a directory in the filtersfile attribute:" + filtersFile ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Mapper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Mapper.java index 28f126d29..98603bc32 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Mapper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Mapper.java @@ -9,10 +9,10 @@ package org.apache.tools.ant.types; import java.util.Properties; import java.util.Stack; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.AntClassLoader; import org.apache.tools.ant.Project; import org.apache.tools.ant.util.FileNameMapper; -import org.apache.myrmidon.api.TaskException; /** * Element to define a FileNameMapper. @@ -43,6 +43,7 @@ public class Mapper extends DataType implements Cloneable * @param classname The new Classname value */ public void setClassname( String classname ) + throws TaskException { if( isReference() ) { @@ -57,6 +58,7 @@ public class Mapper extends DataType implements Cloneable * @param classpath The new Classpath value */ public void setClasspath( Path classpath ) + throws TaskException { if( isReference() ) { @@ -79,6 +81,7 @@ public class Mapper extends DataType implements Cloneable * @param r The new ClasspathRef value */ public void setClasspathRef( Reference r ) + throws TaskException { if( isReference() ) { @@ -93,6 +96,7 @@ public class Mapper extends DataType implements Cloneable * @param from The new From value */ public void setFrom( String from ) + throws TaskException { if( isReference() ) { @@ -125,6 +129,7 @@ public class Mapper extends DataType implements Cloneable * @param to The new To value */ public void setTo( String to ) + throws TaskException { if( isReference() ) { @@ -139,6 +144,7 @@ public class Mapper extends DataType implements Cloneable * @param type The new Type value */ public void setType( MapperType type ) + throws TaskException { if( isReference() ) { @@ -219,6 +225,7 @@ public class Mapper extends DataType implements Cloneable * @return Description of the Returned Value */ public Path createClasspath() + throws TaskException { if( isReference() ) { @@ -238,6 +245,7 @@ public class Mapper extends DataType implements Cloneable * @return The Ref value */ protected Mapper getRef() + throws TaskException { if( !checked ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java index 94dbee1ac..428acbd92 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Path.java @@ -13,7 +13,6 @@ import java.util.Locale; import java.util.Stack; 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.PathTokenizer; import org.apache.tools.ant.Project; @@ -193,6 +192,7 @@ public class Path * @return Description of the Returned Value */ private static String resolveFile( Project project, String relativeName ) + throws TaskException { if( project != null ) { @@ -208,10 +208,10 @@ public class Path * * @param location the location of the element to add (must not be null * nor empty. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setLocation( File location ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -224,10 +224,10 @@ public class Path * Parses a path definition and creates single PathElements. * * @param path the path definition. - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setPath( String path ) - throws BuildException + throws TaskException { if( isReference() ) { @@ -243,7 +243,7 @@ public class Path * if you make it a reference.

* * @param r The new Refid value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setRefid( Reference r ) throws TaskException @@ -326,7 +326,7 @@ public class Path * Adds a nested <fileset> element. * * @param fs The feature to be added to the Fileset attribute - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void addFileset( FileSet fs ) throws TaskException @@ -427,9 +427,17 @@ public class Path */ public Object clone() { - Path p = new Path( getProject() ); - p.append( this ); - return p; + try + { + Path p = new Path( getProject() ); + p.append( this ); + return p; + } + catch( TaskException e ) + { + throw new IllegalStateException( e.getMessage() ); + } + } /** @@ -439,6 +447,7 @@ public class Path * @return Description of the Returned Value */ public Path concatSystemClasspath() + throws TaskException { return concatSystemClasspath( "last" ); } @@ -505,10 +514,10 @@ public class Path * Creates a nested <path> element. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Path createPath() - throws BuildException + throws TaskException { if( isReference() ) { @@ -524,10 +533,10 @@ public class Path * Creates the nested <pathelement> element. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public PathElement createPathElement() - throws BuildException + throws TaskException { if( isReference() ) { @@ -668,10 +677,10 @@ public class Path * * @param stk Description of Parameter * @param p Description of Parameter - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected void dieOnCircularReference( Stack stk, Project p ) - throws BuildException + throws TaskException { if( checked ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Reference.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Reference.java index 11cb33915..9b3faac71 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Reference.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Reference.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.types; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -41,17 +42,17 @@ public class Reference } public Object getReferencedObject( Project project ) - throws BuildException + throws TaskException { if( refid == null ) { - throw new BuildException( "No reference specified" ); + throw new TaskException( "No reference specified" ); } Object o = project.getReference( refid ); if( o == null ) { - throw new BuildException( "Reference " + refid + " not found." ); + throw new TaskException( "Reference " + refid + " not found." ); } return o; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/RegularExpression.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/RegularExpression.java index 6f0d31451..a89fccdf4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/RegularExpression.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/RegularExpression.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.util.Stack; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; import org.apache.tools.ant.util.regexp.Regexp; import org.apache.tools.ant.util.regexp.RegexpFactory; @@ -51,11 +52,13 @@ public class RegularExpression extends DataType private Regexp regexp; public RegularExpression() + throws TaskException { this.regexp = factory.newRegexp(); } public void setPattern( String pattern ) + throws TaskException { this.regexp.setPattern( pattern ); } @@ -67,6 +70,7 @@ public class RegularExpression extends DataType * @return The Pattern value */ public String getPattern( Project p ) + throws TaskException { if( isReference() ) return getRef( p ).getPattern( p ); @@ -82,6 +86,7 @@ public class RegularExpression extends DataType * @return The Ref value */ public RegularExpression getRef( Project p ) + throws TaskException { if( !checked ) { @@ -94,11 +99,11 @@ public class RegularExpression extends DataType if( !( o instanceof RegularExpression ) ) { String msg = ref.getRefId() + " doesn\'t denote a regularexpression"; - throw new BuildException( msg ); + throw new TaskException( msg ); } else { - return ( RegularExpression )o; + return (RegularExpression)o; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Substitution.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Substitution.java index c640c0466..726d9f8ff 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Substitution.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/Substitution.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.util.Stack; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; -import org.apache.tools.ant.types.DataType; /** * A regular expression substitution datatype. It is an expression that is meant @@ -72,11 +72,11 @@ public class Substitution extends DataType if( !( o instanceof Substitution ) ) { String msg = ref.getRefId() + " doesn\'t denote a substitution"; - throw new BuildException( msg ); + throw new TaskException( msg ); } else { - return ( Substitution )o; + return (Substitution)o; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipFileSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipFileSet.java index c98d28ac7..fe0d01c1b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipFileSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipFileSet.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.io.File; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Project; @@ -39,14 +40,14 @@ public class ZipFileSet extends FileSet * being specified. * * @param dir The new Dir value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setDir( File dir ) - throws BuildException + throws TaskException { if( srcFile != null ) { - throw new BuildException( "Cannot set both dir and src attributes" ); + throw new TaskException( "Cannot set both dir and src attributes" ); } else { @@ -86,7 +87,7 @@ public class ZipFileSet extends FileSet { if( hasDir ) { - throw new BuildException( "Cannot set both dir and src attributes" ); + throw new TaskException( "Cannot set both dir and src attributes" ); } this.srcFile = srcFile; } @@ -100,6 +101,7 @@ public class ZipFileSet extends FileSet * @return The DirectoryScanner value */ public DirectoryScanner getDirectoryScanner( Project p ) + throws TaskException { if( isReference() ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipScanner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipScanner.java index 4ed9fec95..2493a234d 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipScanner.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/ZipScanner.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.types; + import java.io.File; import org.apache.tools.ant.DirectoryScanner; @@ -46,7 +47,7 @@ public class ZipScanner extends DirectoryScanner */ public String[] getIncludedDirectories() { - return new String[0]; + return new String[ 0 ]; } /** @@ -58,8 +59,8 @@ public class ZipScanner extends DirectoryScanner */ public String[] getIncludedFiles() { - String[] result = new String[1]; - result[0] = srcFile.getAbsolutePath(); + String[] result = new String[ 1 ]; + result[ 0 ] = srcFile.getAbsolutePath(); return result; } @@ -71,12 +72,12 @@ public class ZipScanner extends DirectoryScanner if( includes == null ) { // No includes supplied, so set it to 'matches all' - includes = new String[1]; - includes[0] = "**"; + includes = new String[ 1 ]; + includes[ 0 ] = "**"; } if( excludes == null ) { - excludes = new String[0]; + excludes = new String[ 0 ]; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/optional/depend/ClassfileSet.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/optional/depend/ClassfileSet.java index 287d945ac..ef77cceb9 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/optional/depend/ClassfileSet.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/optional/depend/ClassfileSet.java @@ -6,15 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.types.optional.depend; -import java.io.File; + import java.util.ArrayList; import java.util.List; -import java.util.Stack; -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; -import org.apache.tools.ant.util.depend.Dependencies; /** * A DepSet is a FileSet, that enlists all classes that depend on a certain @@ -35,7 +33,7 @@ public class ClassfileSet extends FileSet } public void setRootClass( String rootClass ) - throws BuildException + throws TaskException { rootClasses.add( rootClass ); } @@ -64,7 +62,7 @@ public class ClassfileSet extends FileSet { if( isReference() ) { - return new ClassfileSet( ( ClassfileSet )getRef( getProject() ) ); + return new ClassfileSet( (ClassfileSet)getRef( getProject() ) ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/optional/depend/DependScanner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/optional/depend/DependScanner.java index 4144487dc..be84607f6 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/types/optional/depend/DependScanner.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/types/optional/depend/DependScanner.java @@ -6,8 +6,15 @@ * the LICENSE file. */ package org.apache.tools.ant.types.optional.depend; -import java.io.*; -import java.util.*; + +import java.io.File; +import java.io.IOException; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; import org.apache.bcel.*; import org.apache.bcel.classfile.*; import org.apache.tools.ant.DirectoryScanner; @@ -50,11 +57,17 @@ public class DependScanner extends DirectoryScanner this.basedir = basedir; } - public void setCaseSensitive( boolean isCaseSensitive ) { } + public void setCaseSensitive( boolean isCaseSensitive ) + { + } - public void setExcludes( String[] excludes ) { } + public void setExcludes( String[] excludes ) + { + } - public void setIncludes( String[] includes ) { } + public void setIncludes( String[] includes ) + { + } /** * Sets the domain, where dependant classes are searched @@ -88,7 +101,7 @@ public class DependScanner extends DirectoryScanner public String[] getIncludedDirectories() { - return new String[0]; + return new String[ 0 ]; } /** @@ -99,10 +112,10 @@ public class DependScanner extends DirectoryScanner public String[] getIncludedFiles() { int count = included.size(); - String[] files = new String[count]; + String[] files = new String[ count ]; for( int i = 0; i < count; i++ ) { - files[i] = included.get( i ) + ".class"; + files[ i ] = included.get( i ) + ".class"; //System.err.println(" " + files[i]); } return files; @@ -118,7 +131,9 @@ public class DependScanner extends DirectoryScanner return null; } - public void addDefaultExcludes() { } + public void addDefaultExcludes() + { + } /** * Scans the base directory for files that baseClass depends on @@ -140,10 +155,10 @@ public class DependScanner extends DirectoryScanner throw new IllegalArgumentException( e.getMessage() ); } - for( Iterator rootClassIterator = rootClasses.iterator(); rootClassIterator.hasNext(); ) + for( Iterator rootClassIterator = rootClasses.iterator(); rootClassIterator.hasNext(); ) { Set newSet = new HashSet(); - String start = ( String )rootClassIterator.next(); + String start = (String)rootClassIterator.next(); start = start.replace( '.', '/' ); newSet.add( start ); @@ -154,7 +169,7 @@ public class DependScanner extends DirectoryScanner Iterator i = newSet.iterator(); while( i.hasNext() ) { - String fileName = base + ( ( String )i.next() ).replace( '/', File.separatorChar ) + ".class"; + String fileName = base + ( (String)i.next() ).replace( '/', File.separatorChar ) + ".class"; try { @@ -171,17 +186,17 @@ public class DependScanner extends DirectoryScanner visitor.clearDependencies(); Dependencies.applyFilter( newSet, - new Filter() - { - public boolean accept( Object object ) - { - String fileName = base + ( ( String )object ).replace( '/', File.separatorChar ) + ".class"; - return new File( fileName ).exists(); - } - } ); + new Filter() + { + public boolean accept( Object object ) + { + String fileName = base + ( (String)object ).replace( '/', File.separatorChar ) + ".class"; + return new File( fileName ).exists(); + } + } ); newSet.removeAll( set ); set.addAll( newSet ); - }while ( newSet.size() > 0 ); + } while( newSet.size() > 0 ); } included.clear(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/DOMElementWriter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/DOMElementWriter.java index ca4d1b867..18c2da6c4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/DOMElementWriter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/DOMElementWriter.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.util; + import java.io.IOException; import java.io.Writer; import org.w3c.dom.Attr; @@ -81,7 +82,7 @@ public class DOMElementWriter String name = ent.substring( 1, ent.length() - 1 ); for( int i = 0; i < knownEntities.length; i++ ) { - if( name.equals( knownEntities[i] ) ) + if( name.equals( knownEntities[ i ] ) ) { return true; } @@ -101,35 +102,35 @@ public class DOMElementWriter for( int i = 0; i < value.length(); i++ ) { char c = value.charAt( i ); - switch ( c ) + switch( c ) { - case '<': - sb.append( "<" ); - break; - case '>': - sb.append( ">" ); - break; - case '\'': - sb.append( "'" ); - break; - case '\"': - sb.append( """ ); - break; - case '&': - int nextSemi = value.indexOf( ";", i ); - if( nextSemi < 0 - || !isReference( value.substring( i, nextSemi + 1 ) ) ) - { - sb.append( "&" ); - } - else - { - sb.append( '&' ); - } - break; - default: - sb.append( c ); - break; + case '<': + sb.append( "<" ); + break; + case '>': + sb.append( ">" ); + break; + case '\'': + sb.append( "'" ); + break; + case '\"': + sb.append( """ ); + break; + case '&': + int nextSemi = value.indexOf( ";", i ); + if( nextSemi < 0 + || !isReference( value.substring( i, nextSemi + 1 ) ) ) + { + sb.append( "&" ); + } + else + { + sb.append( '&' ); + } + break; + default: + sb.append( c ); + break; } } return sb.toString(); @@ -164,7 +165,7 @@ public class DOMElementWriter NamedNodeMap attrs = element.getAttributes(); for( int i = 0; i < attrs.getLength(); i++ ) { - Attr attr = ( Attr )attrs.item( i ); + Attr attr = (Attr)attrs.item( i ); out.write( " " ); out.write( attr.getName() ); out.write( "=\"" ); @@ -180,41 +181,41 @@ public class DOMElementWriter { Node child = children.item( i ); - switch ( child.getNodeType() ) + switch( child.getNodeType() ) { - case Node.ELEMENT_NODE: - if( !hasChildren ) - { - out.write( lSep ); - hasChildren = true; - } - write( ( Element )child, out, indent + 1, indentWith ); - break; - case Node.TEXT_NODE: - out.write( encode( child.getNodeValue() ) ); - break; - case Node.CDATA_SECTION_NODE: - out.write( "" ); - break; - case Node.ENTITY_REFERENCE_NODE: - out.write( '&' ); - out.write( child.getNodeName() ); - out.write( ';' ); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - out.write( " 0 ) - { - out.write( ' ' ); - out.write( data ); - } - out.write( "?>" ); - break; + case Node.ELEMENT_NODE: + if( !hasChildren ) + { + out.write( lSep ); + hasChildren = true; + } + write( (Element)child, out, indent + 1, indentWith ); + break; + case Node.TEXT_NODE: + out.write( encode( child.getNodeValue() ) ); + break; + case Node.CDATA_SECTION_NODE: + out.write( "" ); + break; + case Node.ENTITY_REFERENCE_NODE: + out.write( '&' ); + out.write( child.getNodeName() ); + out.write( ';' ); + break; + case Node.PROCESSING_INSTRUCTION_NODE: + out.write( " 0 ) + { + out.write( ' ' ); + out.write( data ); + } + out.write( "?>" ); + break; } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/FileUtils.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/FileUtils.java index 75d33d52a..68309453a 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/FileUtils.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/FileUtils.java @@ -65,7 +65,7 @@ public class FileUtils * * @param file The new FileLastModified value * @param time The new FileLastModified value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setFileLastModified( File file, long time ) throws TaskException diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/FlatFileNameMapper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/FlatFileNameMapper.java index 37c6e5bad..a02730dc1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/FlatFileNameMapper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/FlatFileNameMapper.java @@ -24,14 +24,18 @@ public class FlatFileNameMapper implements FileNameMapper * * @param from The new From value */ - public void setFrom( String from ) { } + public void setFrom( String from ) + { + } /** * Ignored. * * @param to The new To value */ - public void setTo( String to ) { } + public void setTo( String to ) + { + } /** * Returns an one-element array containing the source file name without any diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/GlobPatternMapper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/GlobPatternMapper.java index f9cb24277..6ca42d3b4 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/GlobPatternMapper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/GlobPatternMapper.java @@ -103,14 +103,14 @@ public class GlobPatternMapper implements FileNameMapper public String[] mapFileName( String sourceFileName ) { if( fromPrefix == null - || !sourceFileName.startsWith( fromPrefix ) - || !sourceFileName.endsWith( fromPostfix ) ) + || !sourceFileName.startsWith( fromPrefix ) + || !sourceFileName.endsWith( fromPostfix ) ) { return null; } return new String[]{toPrefix - + extractVariablePart( sourceFileName ) - + toPostfix}; + + extractVariablePart( sourceFileName ) + + toPostfix}; } /** @@ -123,6 +123,6 @@ public class GlobPatternMapper implements FileNameMapper protected String extractVariablePart( String name ) { return name.substring( prefixLength, - name.length() - postfixLength ); + name.length() - postfixLength ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/IdentityMapper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/IdentityMapper.java index a93007e83..d94a5ecd3 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/IdentityMapper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/IdentityMapper.java @@ -23,14 +23,18 @@ public class IdentityMapper implements FileNameMapper * * @param from The new From value */ - public void setFrom( String from ) { } + public void setFrom( String from ) + { + } /** * Ignored. * * @param to The new To value */ - public void setTo( String to ) { } + public void setTo( String to ) + { + } /** * Returns an one-element array containing the source file name. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/MergingMapper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/MergingMapper.java index d9c0b866e..b9b27bdec 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/MergingMapper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/MergingMapper.java @@ -24,7 +24,9 @@ public class MergingMapper implements FileNameMapper * * @param from The new From value */ - public void setFrom( String from ) { } + public void setFrom( String from ) + { + } /** * Sets the name of the merged file. diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/RegexpPatternMapper.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/RegexpPatternMapper.java index df29877a4..d2382c5a5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/RegexpPatternMapper.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/RegexpPatternMapper.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.util; + import java.util.Vector; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.util.regexp.RegexpMatcher; import org.apache.tools.ant.util.regexp.RegexpMatcherFactory; @@ -23,7 +24,7 @@ public class RegexpPatternMapper implements FileNameMapper protected StringBuffer result = new StringBuffer(); public RegexpPatternMapper() - throws BuildException + throws TaskException { reg = ( new RegexpMatcherFactory() ).newRegexpMatcher(); } @@ -32,10 +33,10 @@ public class RegexpPatternMapper implements FileNameMapper * Sets the "from" pattern. Required. * * @param from The new From value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public void setFrom( String from ) - throws BuildException + throws TaskException { try { @@ -45,8 +46,8 @@ public class RegexpPatternMapper implements FileNameMapper { // depending on the implementation the actual RE won't // get instantiated in the constructor. - throw new BuildException( "Cannot load regular expression matcher", - e ); + throw new TaskException( "Cannot load regular expression matcher", + e ); } } @@ -70,7 +71,7 @@ public class RegexpPatternMapper implements FileNameMapper public String[] mapFileName( String sourceFileName ) { if( reg == null || to == null - || !reg.matches( sourceFileName ) ) + || !reg.matches( sourceFileName ) ) { return null; } @@ -91,18 +92,18 @@ public class RegexpPatternMapper implements FileNameMapper result.setLength( 0 ); for( int i = 0; i < to.length; i++ ) { - if( to[i] == '\\' ) + if( to[ i ] == '\\' ) { if( ++i < to.length ) { - int value = Character.digit( to[i], 10 ); + int value = Character.digit( to[ i ], 10 ); if( value > -1 ) { - result.append( ( String )v.elementAt( value ) ); + result.append( (String)v.elementAt( value ) ); } else { - result.append( to[i] ); + result.append( to[ i ] ); } } else @@ -113,7 +114,7 @@ public class RegexpPatternMapper implements FileNameMapper } else { - result.append( to[i] ); + result.append( to[ i ] ); } } return result.toString(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java index 4106357ac..f0aa9447c 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/SourceFileScanner.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.util; + import java.io.File; import java.util.Vector; +import org.apache.myrmidon.framework.Os; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; -import org.apache.myrmidon.framework.Os; /** * Utility class that collects the functionality of the various scanDir methods @@ -74,40 +75,40 @@ public class SourceFileScanner for( int i = 0; i < files.length; i++ ) { - String[] targets = mapper.mapFileName( files[i] ); + String[] targets = mapper.mapFileName( files[ i ] ); if( targets == null || targets.length == 0 ) { - task.log( files[i] + " skipped - don\'t know how to handle it", - Project.MSG_VERBOSE ); + task.log( files[ i ] + " skipped - don\'t know how to handle it", + Project.MSG_VERBOSE ); continue; } - File src = fileUtils.resolveFile( srcDir, files[i] ); + File src = fileUtils.resolveFile( srcDir, files[ i ] ); if( src.lastModified() > now ) { - task.log( "Warning: " + files[i] + " modified in the future.", - Project.MSG_WARN ); + task.log( "Warning: " + files[ i ] + " modified in the future.", + Project.MSG_WARN ); } boolean added = false; targetList.setLength( 0 ); for( int j = 0; !added && j < targets.length; j++ ) { - File dest = fileUtils.resolveFile( destDir, targets[j] ); + File dest = fileUtils.resolveFile( destDir, targets[ j ] ); if( !dest.exists() ) { - task.log( files[i] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.", - Project.MSG_VERBOSE ); - v.addElement( files[i] ); + task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " doesn\'t exist.", + Project.MSG_VERBOSE ); + v.addElement( files[ i ] ); added = true; } else if( src.lastModified() > dest.lastModified() ) { - task.log( files[i] + " added as " + dest.getAbsolutePath() + " is outdated.", - Project.MSG_VERBOSE ); - v.addElement( files[i] ); + task.log( files[ i ] + " added as " + dest.getAbsolutePath() + " is outdated.", + Project.MSG_VERBOSE ); + v.addElement( files[ i ] ); added = true; } else @@ -122,13 +123,13 @@ public class SourceFileScanner if( !added ) { - task.log( files[i] + " omitted as " + targetList.toString() - + ( targets.length == 1 ? " is" : " are " ) - + " up to date.", Project.MSG_VERBOSE ); + task.log( files[ i ] + " omitted as " + targetList.toString() + + ( targets.length == 1 ? " is" : " are " ) + + " up to date.", Project.MSG_VERBOSE ); } } - String[] result = new String[v.size()]; + String[] result = new String[ v.size() ]; v.copyInto( result ); return result; } @@ -147,10 +148,10 @@ public class SourceFileScanner FileNameMapper mapper ) { String[] res = restrict( files, srcDir, destDir, mapper ); - File[] result = new File[res.length]; + File[] result = new File[ res.length ]; for( int i = 0; i < res.length; i++ ) { - result[i] = new File( srcDir, res[i] ); + result[ i ] = new File( srcDir, res[ i ] ); } return result; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/StringUtils.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/StringUtils.java index 6881490c0..6e131df20 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/StringUtils.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/StringUtils.java @@ -6,6 +6,7 @@ * the LICENSE file. */ package org.apache.tools.ant.util; + import java.io.PrintWriter; import java.io.StringWriter; diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/depend/Dependencies.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/depend/Dependencies.java index b7808ff0c..cda32fbb5 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/depend/Dependencies.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/depend/Dependencies.java @@ -6,12 +6,17 @@ * the LICENSE file. */ package org.apache.tools.ant.util.depend; -import java.io.*; -import java.util.*; + +import java.io.File; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeSet; import org.apache.bcel.*; import org.apache.bcel.classfile.*; - public class Dependencies implements Visitor { private boolean verbose = false; @@ -44,9 +49,9 @@ public class Dependencies implements Visitor int o = 0; String arg = null; - if( "-base".equals( args[0] ) ) + if( "-base".equals( args[ 0 ] ) ) { - arg = args[1]; + arg = args[ 1 ]; if( !arg.endsWith( File.separator ) ) { arg = arg + File.separator; @@ -57,7 +62,7 @@ public class Dependencies implements Visitor for( int i = o; i < args.length; i++ ) { - String fileName = args[i].substring( 0, args[i].length() - ".class".length() ); + String fileName = args[ i ].substring( 0, args[ i ].length() - ".class".length() ); if( base != null && fileName.startsWith( base ) ) fileName = fileName.substring( base.length() ); newSet.add( fileName ); @@ -84,19 +89,19 @@ public class Dependencies implements Visitor visitor.clearDependencies(); applyFilter( newSet, - new Filter() - { - public boolean accept( Object object ) - { - String fileName = object + ".class"; - if( base != null ) - fileName = base + fileName; - return new File( fileName ).exists(); - } - } ); + new Filter() + { + public boolean accept( Object object ) + { + String fileName = object + ".class"; + if( base != null ) + fileName = base + fileName; + return new File( fileName ).exists(); + } + } ); newSet.removeAll( set ); set.addAll( newSet ); - }while ( newSet.size() > 0 ); + } while( newSet.size() > 0 ); Iterator i = set.iterator(); while( i.hasNext() ) @@ -121,9 +126,13 @@ public class Dependencies implements Visitor dependencies.clear(); } - public void visitCode( Code obj ) { } + public void visitCode( Code obj ) + { + } - public void visitCodeException( CodeException obj ) { } + public void visitCodeException( CodeException obj ) + { + } public void visitConstantClass( ConstantClass obj ) { @@ -135,21 +144,37 @@ public class Dependencies implements Visitor dependencies.add( "" + obj.getConstantValue( constantPool ) ); } - public void visitConstantDouble( ConstantDouble obj ) { } + public void visitConstantDouble( ConstantDouble obj ) + { + } - public void visitConstantFieldref( ConstantFieldref obj ) { } + public void visitConstantFieldref( ConstantFieldref obj ) + { + } - public void visitConstantFloat( ConstantFloat obj ) { } + public void visitConstantFloat( ConstantFloat obj ) + { + } - public void visitConstantInteger( ConstantInteger obj ) { } + public void visitConstantInteger( ConstantInteger obj ) + { + } - public void visitConstantInterfaceMethodref( ConstantInterfaceMethodref obj ) { } + public void visitConstantInterfaceMethodref( ConstantInterfaceMethodref obj ) + { + } - public void visitConstantLong( ConstantLong obj ) { } + public void visitConstantLong( ConstantLong obj ) + { + } - public void visitConstantMethodref( ConstantMethodref obj ) { } + public void visitConstantMethodref( ConstantMethodref obj ) + { + } - public void visitConstantNameAndType( ConstantNameAndType obj ) { } + public void visitConstantNameAndType( ConstantNameAndType obj ) + { + } public void visitConstantPool( ConstantPool obj ) { @@ -168,15 +193,25 @@ public class Dependencies implements Visitor } } - public void visitConstantString( ConstantString obj ) { } + public void visitConstantString( ConstantString obj ) + { + } - public void visitConstantUtf8( ConstantUtf8 obj ) { } + public void visitConstantUtf8( ConstantUtf8 obj ) + { + } - public void visitConstantValue( ConstantValue obj ) { } + public void visitConstantValue( ConstantValue obj ) + { + } - public void visitDeprecated( Deprecated obj ) { } + public void visitDeprecated( Deprecated obj ) + { + } - public void visitExceptionTable( ExceptionTable obj ) { } + public void visitExceptionTable( ExceptionTable obj ) + { + } public void visitField( Field obj ) { @@ -188,9 +223,13 @@ public class Dependencies implements Visitor addClasses( obj.getSignature() ); } - public void visitInnerClass( InnerClass obj ) { } + public void visitInnerClass( InnerClass obj ) + { + } - public void visitInnerClasses( InnerClasses obj ) { } + public void visitInnerClasses( InnerClasses obj ) + { + } public void visitJavaClass( JavaClass obj ) { @@ -209,24 +248,32 @@ public class Dependencies implements Visitor Field[] fields = obj.getFields(); for( int i = 0; i < fields.length; i++ ) { - fields[i].accept( this ); + fields[ i ].accept( this ); } // visit methods Method[] methods = obj.getMethods(); for( int i = 0; i < methods.length; i++ ) { - methods[i].accept( this ); + methods[ i ].accept( this ); } } - public void visitLineNumber( LineNumber obj ) { } + public void visitLineNumber( LineNumber obj ) + { + } - public void visitLineNumberTable( LineNumberTable obj ) { } + public void visitLineNumberTable( LineNumberTable obj ) + { + } - public void visitLocalVariable( LocalVariable obj ) { } + public void visitLocalVariable( LocalVariable obj ) + { + } - public void visitLocalVariableTable( LocalVariableTable obj ) { } + public void visitLocalVariableTable( LocalVariableTable obj ) + { + } public void visitMethod( Method obj ) { @@ -241,15 +288,25 @@ public class Dependencies implements Visitor addClasses( signature.substring( pos + 1 ) ); } - public void visitSourceFile( SourceFile obj ) { } + public void visitSourceFile( SourceFile obj ) + { + } - public void visitStackMap( StackMap obj ) { } + public void visitStackMap( StackMap obj ) + { + } - public void visitStackMapEntry( StackMapEntry obj ) { } + public void visitStackMapEntry( StackMapEntry obj ) + { + } - public void visitSynthetic( Synthetic obj ) { } + public void visitSynthetic( Synthetic obj ) + { + } - public void visitUnknown( Unknown obj ) { } + public void visitUnknown( Unknown obj ) + { + } void addClass( String string ) { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/depend/Filter.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/depend/Filter.java index 2cd26d2aa..62bda990b 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/depend/Filter.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/depend/Filter.java @@ -6,7 +6,6 @@ * the LICENSE file. */ package org.apache.tools.ant.util.depend; -import java.util.*; public interface Filter { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java index 1c6d57994..a0d26dbed 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaOroMatcher.java @@ -6,12 +6,13 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.oro.text.regex.MatchResult; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.Perl5Compiler; import org.apache.oro.text.regex.Perl5Matcher; -import org.apache.tools.ant.BuildException; /** * Implementation of RegexpMatcher for Jakarta-ORO. @@ -26,7 +27,9 @@ public class JakartaOroMatcher implements RegexpMatcher private String pattern; - public JakartaOroMatcher() { } + public JakartaOroMatcher() + { + } /** * Set the regexp pattern from the String description. @@ -46,10 +49,10 @@ public class JakartaOroMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String argument ) - throws BuildException + throws TaskException { return getGroups( argument, MATCH_DEFAULT ); } @@ -63,10 +66,10 @@ public class JakartaOroMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String input, int options ) - throws BuildException + throws TaskException { if( !matches( input, options ) ) { @@ -97,10 +100,10 @@ public class JakartaOroMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String argument ) - throws BuildException + throws TaskException { return matches( argument, MATCH_DEFAULT ); } @@ -111,10 +114,10 @@ public class JakartaOroMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String input, int options ) - throws BuildException + throws TaskException { Pattern p = getCompiledPattern( options ); return matcher.contains( input, p ); @@ -125,10 +128,10 @@ public class JakartaOroMatcher implements RegexpMatcher * * @param options Description of Parameter * @return The CompiledPattern value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ protected Pattern getCompiledPattern( int options ) - throws BuildException + throws TaskException { try { @@ -138,7 +141,7 @@ public class JakartaOroMatcher implements RegexpMatcher } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java index 88e8f31f6..a7fdc0855 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaOroRegexp.java @@ -6,11 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + +import org.apache.myrmidon.api.TaskException; import org.apache.oro.text.regex.Perl5Substitution; import org.apache.oro.text.regex.Substitution; import org.apache.oro.text.regex.Util; -import org.apache.tools.ant.BuildException; - /** * Regular expression implementation using the Jakarta Oro package @@ -27,7 +27,7 @@ public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp } public String substitute( String input, String argument, int options ) - throws BuildException + throws TaskException { // translate \1 to $1 so that the Perl5Substitution will work StringBuffer subst = new StringBuffer(); @@ -64,12 +64,12 @@ public class JakartaOroRegexp extends JakartaOroMatcher implements Regexp // Do the substitution Substitution s = new Perl5Substitution( subst.toString(), - Perl5Substitution.INTERPOLATE_ALL ); + Perl5Substitution.INTERPOLATE_ALL ); return Util.substitute( matcher, - getCompiledPattern( options ), - s, - input, - getSubsOptions( options ) ); + getCompiledPattern( options ), + s, + input, + getSubsOptions( options ) ); } protected int getSubsOptions( int options ) diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java index a51a8ff3a..de9c49807 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java @@ -6,10 +6,11 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.regexp.RE; import org.apache.regexp.RESyntaxException; -import org.apache.tools.ant.BuildException; /** * Implementation of RegexpMatcher for Jakarta-Regexp. @@ -41,16 +42,16 @@ public class JakartaRegexpMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String argument ) - throws BuildException + throws TaskException { return getGroups( argument, MATCH_DEFAULT ); } public Vector getGroups( String input, int options ) - throws BuildException + throws TaskException { RE reg = getCompiledPattern( options ); if( !matches( input, reg ) ) @@ -81,10 +82,10 @@ public class JakartaRegexpMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String argument ) - throws BuildException + throws TaskException { return matches( argument, MATCH_DEFAULT ); } @@ -95,16 +96,16 @@ public class JakartaRegexpMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String input, int options ) - throws BuildException + throws TaskException { return matches( input, getCompiledPattern( options ) ); } protected RE getCompiledPattern( int options ) - throws BuildException + throws TaskException { int cOptions = getCompilerOptions( options ); try @@ -115,7 +116,7 @@ public class JakartaRegexpMatcher implements RegexpMatcher } catch( RESyntaxException e ) { - throw new BuildException( e ); + throw new TaskException( e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java index 3f41e50e5..de5c807ca 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/JakartaRegexpRegexp.java @@ -6,9 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; +import org.apache.myrmidon.api.TaskException; import org.apache.regexp.RE; -import org.apache.tools.ant.BuildException; /** * Regular expression implementation using the Jakarta Regexp package @@ -25,7 +26,7 @@ public class JakartaRegexpRegexp extends JakartaRegexpMatcher implements Regexp } public String substitute( String input, String argument, int options ) - throws BuildException + throws TaskException { Vector v = getGroups( input, options ); @@ -42,7 +43,7 @@ public class JakartaRegexpRegexp extends JakartaRegexpMatcher implements Regexp int value = Character.digit( c, 10 ); if( value > -1 ) { - result.append( ( String )v.elementAt( value ) ); + result.append( (String)v.elementAt( value ) ); } else { diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java index a58796880..b6c509819 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java @@ -6,11 +6,12 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Implementation of RegexpMatcher for the built-in regexp matcher of JDK 1.4. @@ -24,7 +25,9 @@ public class Jdk14RegexpMatcher implements RegexpMatcher private String pattern; - public Jdk14RegexpMatcher() { } + public Jdk14RegexpMatcher() + { + } /** * Set the regexp pattern from the String description. @@ -44,10 +47,10 @@ public class Jdk14RegexpMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String argument ) - throws BuildException + throws TaskException { return getGroups( argument, MATCH_DEFAULT ); } @@ -61,10 +64,10 @@ public class Jdk14RegexpMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Vector getGroups( String input, int options ) - throws BuildException + throws TaskException { Pattern p = getCompiledPattern( options ); Matcher matcher = p.matcher( input ); @@ -96,10 +99,10 @@ public class Jdk14RegexpMatcher implements RegexpMatcher * * @param argument Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String argument ) - throws BuildException + throws TaskException { return matches( argument, MATCH_DEFAULT ); } @@ -110,10 +113,10 @@ public class Jdk14RegexpMatcher implements RegexpMatcher * @param input Description of Parameter * @param options Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public boolean matches( String input, int options ) - throws BuildException + throws TaskException { try { @@ -122,12 +125,12 @@ public class Jdk14RegexpMatcher implements RegexpMatcher } catch( Exception e ) { - throw new BuildException( "Error", e ); + throw new TaskException( "Error", e ); } } protected Pattern getCompiledPattern( int options ) - throws BuildException + throws TaskException { int cOptions = getCompilerOptions( options ); try @@ -137,7 +140,7 @@ public class Jdk14RegexpMatcher implements RegexpMatcher } catch( PatternSyntaxException e ) { - throw new BuildException( e ); + throw new TaskException( e ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java index 23998f0e6..1a2973626 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Jdk14RegexpRegexp.java @@ -6,10 +6,10 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.apache.tools.ant.BuildException; - +import org.apache.myrmidon.api.TaskException; /** * Regular expression implementation using the JDK 1.4 regular expression @@ -27,7 +27,7 @@ public class Jdk14RegexpRegexp extends Jdk14RegexpMatcher implements Regexp } public String substitute( String input, String argument, int options ) - throws BuildException + throws TaskException { // translate \1 to $(1) so that the Matcher will work StringBuffer subst = new StringBuffer(); diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Regexp.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Regexp.java index 2acaeda47..b5901beab 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Regexp.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/Regexp.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; /** * Interface which represents a regular expression, and the operations that can @@ -35,8 +36,8 @@ public interface Regexp extends RegexpMatcher * @param options The list of options for the match and replace. See the * MATCH_ and REPLACE_ constants above. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ String substitute( String input, String argument, int options ) - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpFactory.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpFactory.java index 559bdf958..5e9015a00 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpFactory.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpFactory.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -20,18 +21,20 @@ import org.apache.tools.ant.Project; */ public class RegexpFactory extends RegexpMatcherFactory { - public RegexpFactory() { } + public RegexpFactory() + { + } /** * Create a new regular expression matcher instance. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Regexp newRegexp() - throws BuildException + throws TaskException { - return ( Regexp )newRegexp( null ); + return (Regexp)newRegexp( null ); } /** @@ -39,10 +42,10 @@ public class RegexpFactory extends RegexpMatcherFactory * * @param p Project whose ant.regexp.regexpimpl property will be used. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public Regexp newRegexp( Project p ) - throws BuildException + throws TaskException { String systemDefault = null; if( p == null ) @@ -51,7 +54,7 @@ public class RegexpFactory extends RegexpMatcherFactory } else { - systemDefault = ( String )p.getProperties().get( "ant.regexp.regexpimpl" ); + systemDefault = (String)p.getProperties().get( "ant.regexp.regexpimpl" ); } if( systemDefault != null ) @@ -65,24 +68,27 @@ public class RegexpFactory extends RegexpMatcherFactory { return createRegexpInstance( "org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } try { return createRegexpInstance( "org.apache.tools.ant.util.regexp.JakartaOroRegexp" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } try { return createRegexpInstance( "org.apache.tools.ant.util.regexp.JakartaRegexpRegexp" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } - throw new BuildException( "No supported regular expression matcher found" ); + throw new TaskException( "No supported regular expression matcher found" ); } /** @@ -91,21 +97,21 @@ public class RegexpFactory extends RegexpMatcherFactory * * @param classname Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception * @since 1.3 */ protected Regexp createRegexpInstance( String classname ) - throws BuildException + throws TaskException { RegexpMatcher m = createInstance( classname ); if( m instanceof Regexp ) { - return ( Regexp )m; + return (Regexp)m; } else { - throw new BuildException( classname + " doesn't implement the Regexp interface" ); + throw new TaskException( classname + " doesn't implement the Regexp interface" ); } } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpMatcher.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpMatcher.java index 26ef487c0..83b9a8bc1 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpMatcher.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpMatcher.java @@ -6,8 +6,9 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; + import java.util.Vector; -import org.apache.tools.ant.BuildException; +import org.apache.myrmidon.api.TaskException; /** * Interface describing a regular expression matcher. @@ -39,34 +40,33 @@ public interface RegexpMatcher */ int MATCH_SINGLELINE = 0x00010000; - /** * Set the regexp pattern from the String description. * * @param pattern The new Pattern value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ void setPattern( String pattern ) - throws BuildException; + throws TaskException; /** * Get a String representation of the regexp pattern * * @return The Pattern value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ String getPattern() - throws BuildException; + throws TaskException; /** * Does the given argument match the pattern? * * @param argument Description of Parameter * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean matches( String argument ) - throws BuildException; + throws TaskException; /** * Returns a Vector of matched groups found in the argument.

@@ -76,10 +76,10 @@ public interface RegexpMatcher * * @param argument Description of Parameter * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ Vector getGroups( String argument ) - throws BuildException; + throws TaskException; /** * Does this regular expression match the input, given certain options @@ -88,10 +88,10 @@ public interface RegexpMatcher * @param options The list of options for the match. See the MATCH_ * constants above. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ boolean matches( String input, int options ) - throws BuildException; + throws TaskException; /** * Get the match groups from this regular expression. The return type of the @@ -101,9 +101,9 @@ public interface RegexpMatcher * @param options The list of options for the match. See the MATCH_ * constants above. * @return The Groups value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ Vector getGroups( String input, int options ) - throws BuildException; + throws TaskException; } diff --git a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java index 5620b9b70..22f8f2cc7 100644 --- a/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java +++ b/proposal/myrmidon/src/todo/org/apache/tools/ant/util/regexp/RegexpMatcherFactory.java @@ -6,7 +6,8 @@ * the LICENSE file. */ package org.apache.tools.ant.util.regexp; -import org.apache.tools.ant.BuildException; + +import org.apache.myrmidon.api.TaskException; import org.apache.tools.ant.Project; /** @@ -22,16 +23,18 @@ import org.apache.tools.ant.Project; public class RegexpMatcherFactory { - public RegexpMatcherFactory() { } + public RegexpMatcherFactory() + { + } /** * Create a new regular expression instance. * * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public RegexpMatcher newRegexpMatcher() - throws BuildException + throws TaskException { return newRegexpMatcher( null ); } @@ -41,10 +44,10 @@ public class RegexpMatcherFactory * * @param p Project whose ant.regexp.regexpimpl property will be used. * @return Description of the Returned Value - * @exception BuildException Description of Exception + * @exception TaskException Description of Exception */ public RegexpMatcher newRegexpMatcher( Project p ) - throws BuildException + throws TaskException { String systemDefault = null; if( p == null ) @@ -53,7 +56,7 @@ public class RegexpMatcherFactory } else { - systemDefault = ( String )p.getProperties().get( "ant.regexp.regexpimpl" ); + systemDefault = (String)p.getProperties().get( "ant.regexp.regexpimpl" ); } if( systemDefault != null ) @@ -67,37 +70,40 @@ public class RegexpMatcherFactory { return createInstance( "org.apache.tools.ant.util.regexp.Jdk14RegexpMatcher" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } try { return createInstance( "org.apache.tools.ant.util.regexp.JakartaOroMatcher" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } try { return createInstance( "org.apache.tools.ant.util.regexp.JakartaRegexpMatcher" ); } - catch( BuildException be ) - {} + catch( TaskException be ) + { + } - throw new BuildException( "No supported regular expression matcher found" ); + throw new TaskException( "No supported regular expression matcher found" ); } protected RegexpMatcher createInstance( String className ) - throws BuildException + throws TaskException { try { Class implClass = Class.forName( className ); - return ( RegexpMatcher )implClass.newInstance(); + return (RegexpMatcher)implClass.newInstance(); } catch( Throwable t ) { - throw new BuildException( "Error", t ); + throw new TaskException( "Error", t ); } } }