You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by do...@apache.org on 2001/12/16 01:33:55 UTC
cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional ANTLR.java Cab.java IContract.java Javah.java ManifestFile.java Native2Ascii.java NetRexxC.java PropertyFile.java ReplaceRegExp.java Rpm.java Script.java StyleBook.java TraXLiaison.java XalanLiaison.java
donaldp 01/12/15 16:33:55
Modified: proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional
ANTLR.java Cab.java IContract.java Javah.java
ManifestFile.java Native2Ascii.java NetRexxC.java
PropertyFile.java ReplaceRegExp.java Rpm.java
Script.java StyleBook.java TraXLiaison.java
XalanLiaison.java
Log:
BuildException -> TaskException
Removed uneeded imports.
Processed code through style formatter.
Revision Changes Path
1.3 +14 -14 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java
Index: ANTLR.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ANTLR.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ANTLR.java 2001/12/15 14:55:57 1.2
+++ ANTLR.java 2001/12/16 00:33:54 1.3
@@ -12,7 +12,7 @@
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 void execute()
- throws BuildException
+ throws TaskException
{
validateAttributes();
@@ -127,7 +127,7 @@
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 @@
* 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 @@
}
private File getGeneratedFile()
- throws BuildException
+ throws TaskException
{
String generatedFileName = null;
try
@@ -216,11 +216,11 @@
}
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 @@
*
* @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 @@
}
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 @@
}
if( !outputDirectory.isDirectory() )
{
- throw new BuildException( "Invalid output directory: " + outputDirectory );
+ throw new TaskException( "Invalid output directory: " + outputDirectory );
}
}
}
1.2 +18 -17 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java
Index: Cab.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Cab.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Cab.java 2001/12/15 12:06:24 1.1
+++ Cab.java 2001/12/16 00:33:54 1.2
@@ -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.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 void execute()
- throws BuildException
+ throws TaskException
{
checkConfiguration();
@@ -144,7 +144,7 @@
catch( IOException ex )
{
String msg = "Problem creating " + cabFile + " " + ex.getMessage();
- throw new BuildException( msg );
+ throw new TaskException( msg );
}
}
else
@@ -178,7 +178,7 @@
catch( IOException ioe )
{
String msg = "Problem creating " + cabFile + " " + ioe.getMessage();
- throw new BuildException( msg );
+ throw new TaskException( msg );
}
}
}
@@ -189,10 +189,10 @@
* 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 @@
// 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 @@
for( int i = 0; i < dsfiles.length; i++ )
{
- files.addElement( dsfiles[i] );
+ files.addElement( dsfiles[ i ] );
}
}
@@ -258,19 +258,19 @@
* 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 @@
* @return Description of the Returned Value
*/
protected Commandline createCommand( File listFile )
+ throws TaskException
{
Commandline command = new Commandline();
command.setExecutable( "cabarc" );
@@ -310,12 +311,12 @@
* 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() );
1.3 +51 -37 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java
Index: IContract.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/IContract.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- IContract.java 2001/12/15 14:55:57 1.2
+++ IContract.java 2001/12/16 00:33:54 1.3
@@ -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.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 @@
/**
* 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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
}
}
-
/**
* Creates the -m option based on the values of controlFile, pre, post and
* invariant.
@@ -890,34 +890,34 @@
/**
* 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 @@
* 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 @@
}
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 @@
}
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 @@
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 @@
}
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 @@
}
// dummy implementation. Never called
- public void setJavac( Javac javac ) { }
+ public void setJavac( Javac javac )
+ {
+ }
public boolean execute()
{
@@ -1082,9 +1084,13 @@
*/
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 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 )
+ {
+ }
}
}
1.3 +25 -22 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
Index: Javah.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Javah.java 2001/12/15 14:55:57 1.2
+++ Javah.java 2001/12/16 00:33:54 1.3
@@ -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 @@
/**
* 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 @@
{
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 @@
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 @@
{
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 @@
* 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 @@
* 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 @@
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 @@
{
private String name;
- public ClassArgument() { }
+ public ClassArgument()
+ {
+ }
public void setName( String name )
{
1.3 +33 -36 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java
Index: ManifestFile.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ManifestFile.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ManifestFile.java 2001/12/15 14:55:57 1.2
+++ ManifestFile.java 2001/12/16 00:33:54 1.3
@@ -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.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: <pre>
* <taskdef name="manifest" classname="ManifestFile"/>
@@ -86,10 +86,10 @@
/**
* 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 @@
return method.equals( REPLACEALL_.toUpperCase() );
}
-
private boolean isUpdate( String method )
{
return method.equals( UPDATE_.toUpperCase() );
@@ -125,7 +124,6 @@
entry.addTo( container );
}
-
private StringBuffer buildBuffer()
{
StringBuffer buffer = new StringBuffer();
@@ -134,10 +132,10 @@
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 @@
}
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 @@
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 @@
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 @@
}
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 @@
private String val = null;
private String key = null;
- public Entry() { }
+ public Entry()
+ {
+ }
public void setValue( String value )
{
@@ -298,8 +297,8 @@
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 @@
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 @@
}
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 @@
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();
}
}
1.3 +25 -21 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
Index: Native2Ascii.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Native2Ascii.java 2001/12/15 14:55:57 1.2
+++ Native2Ascii.java 2001/12/16 00:33:54 1.3
@@ -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 @@
private Mapper mapper;
-
/**
* Set the destination dirctory to place converted files into.
*
@@ -93,21 +93,21 @@
* 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 @@
// 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 @@
// 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 @@
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 @@
*
* @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 @@
// 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 @@
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 )
{
1.3 +32 -32 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
Index: NetRexxC.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NetRexxC.java 2001/12/15 14:55:57 1.2
+++ NetRexxC.java 2001/12/16 00:33:54 1.3
@@ -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.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 @@
private boolean time;
private boolean utf8;
-
/**
* Set whether literals are treated as binary, rather than NetRexx types
*
@@ -263,7 +263,6 @@
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 @@
this.strictprops = strictprops;
}
-
/**
* Whether the compiler should force catching of exceptions by explicitly
* named types
@@ -438,15 +436,15 @@
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 @@
/**
* 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 @@
* @return The CompileClasspath value
*/
private String getCompileClasspath()
+ throws TaskException
{
StringBuffer classpath = new StringBuffer();
@@ -567,7 +566,7 @@
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 @@
* @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 @@
else
{
log( "Dropping from classpath: " +
- f.getAbsolutePath(), Project.MSG_VERBOSE );
+ f.getAbsolutePath(), Project.MSG_VERBOSE );
}
}
@@ -616,8 +616,8 @@
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 @@
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 @@
/**
* 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 @@
// 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 @@
{// 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 @@
{
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 @@
{
File classFile =
new File( destDir,
- filename.substring( 0, filename.lastIndexOf( '.' ) ) + ".class" );
+ filename.substring( 0, filename.lastIndexOf( '.' ) ) + ".class" );
if( !compile || srcFile.lastModified() > classFile.lastModified() )
{
1.3 +39 -38 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
Index: PropertyFile.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PropertyFile.java 2001/12/15 14:55:57 1.2
+++ PropertyFile.java 2001/12/16 00:33:54 1.3
@@ -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.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 @@
* Methods
*/
public void execute()
- throws BuildException
+ throws TaskException
{
checkParameters();
readFile();
@@ -200,26 +201,26 @@
}
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 @@
else
{
log( "Creating new property file: " +
- m_propertyfile.getAbsolutePath() );
+ m_propertyfile.getAbsolutePath() );
FileOutputStream out = null;
try
{
@@ -264,12 +265,12 @@
}
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 @@
// 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 @@
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 @@
bos.close();
}
catch( IOException ioex )
- {}
+ {
+ }
}
}
}
@@ -385,7 +387,7 @@
}
protected void executeOn( Properties props )
- throws BuildException
+ throws TaskException
{
checkParameters();
@@ -394,19 +396,19 @@
{
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 @@
/**
* 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 @@
* @param oldValue the current value read from the property file or
* <code>null</code> if the <code>key</code> 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 @@
}
}
-
/**
* Handle operations for type <code>int</code>.
*
* @param oldValue the current value read from the property file or
* <code>null</code> if the <code>key</code> 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 @@
* @param oldValue the current value read from the property file or
* <code>null</code> if the <code>key</code> 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 = "";
1.2 +31 -26 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java
Index: ReplaceRegExp.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReplaceRegExp.java 2001/12/15 12:06:24 1.1
+++ ReplaceRegExp.java 2001/12/16 00:33:54 1.2
@@ -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.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 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 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 @@
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 @@
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 @@
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 @@
}
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 @@
r.close();
}
catch( Exception e )
- {}
+ {
+ }
;
try
@@ -351,7 +355,8 @@
r.close();
}
catch( Exception e )
- {}
+ {
+ }
;
}
}
1.3 +12 -9 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java
Index: Rpm.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Rpm.java 2001/12/15 14:55:57 1.2
+++ Rpm.java 2001/12/16 00:33:54 1.3
@@ -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 @@
{
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 void execute()
- throws BuildException
+ throws TaskException
{
Commandline toExecute = new Commandline();
@@ -148,7 +149,7 @@
if( error == null && output == null )
{
streamhandler = new LogStreamHandler( this, Project.MSG_INFO,
- Project.MSG_WARN );
+ Project.MSG_WARN );
}
else
{
@@ -160,7 +161,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
else
@@ -175,7 +176,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
else
@@ -200,7 +201,7 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
finally
{
@@ -211,7 +212,8 @@
outputstream.close();
}
catch( IOException e )
- {}
+ {
+ }
}
if( error != null )
{
@@ -220,7 +222,8 @@
errorstream.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
1.3 +15 -14 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Script.java
Index: Script.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Script.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Script.java 2001/12/15 14:55:57 1.2
+++ Script.java 2001/12/16 00:33:54 1.3
@@ -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.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 @@
{
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 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
script += new String( data );
@@ -78,10 +79,10 @@
/**
* 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 @@
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 @@
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 @@
*/
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 ) );
1.2 +7 -6 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/StyleBook.java
Index: StyleBook.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/StyleBook.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StyleBook.java 2001/12/15 12:06:24 1.1
+++ StyleBook.java 2001/12/16 00:33:54 1.2
@@ -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 @@
* Börger</a>
*/
public class StyleBook
- extends Java
+ extends Java
{
protected File m_book;
protected String m_loaderConfig;
@@ -53,22 +54,22 @@
}
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 );
1.2 +8 -5 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
Index: TraXLiaison.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TraXLiaison.java 2001/12/15 12:06:24 1.1
+++ TraXLiaison.java 2001/12/16 00:33:54 1.2
@@ -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 @@
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 @@
}
}
catch( IOException ignored )
- {}
+ {
+ }
try
{
if( fis != null )
@@ -150,7 +151,8 @@
}
}
catch( IOException ignored )
- {}
+ {
+ }
try
{
if( fos != null )
@@ -159,7 +161,8 @@
}
}
catch( IOException ignored )
- {}
+ {
+ }
}
}
1.2 +9 -5 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java
Index: XalanLiaison.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/XalanLiaison.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanLiaison.java 2001/12/15 12:06:24 1.1
+++ XalanLiaison.java 2001/12/16 00:33:54 1.2
@@ -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 @@
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 @@
}
}
catch( IOException ignored )
- {}
+ {
+ }
try
{
if( fis != null )
@@ -95,7 +97,8 @@
}
}
catch( IOException ignored )
- {}
+ {
+ }
try
{
if( fos != null )
@@ -104,7 +107,8 @@
}
}
catch( IOException ignored )
- {}
+ {
+ }
}
}
}//-- XalanLiaison
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>