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:35:26 UTC
cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata AbstractMetamataTask.java MAudit.java MAuditStreamHandler.java MMetrics.java MMetricsStreamHandler.java MParse.java
donaldp 01/12/15 16:35:26
Modified: proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata
AbstractMetamataTask.java MAudit.java
MAuditStreamHandler.java MMetrics.java
MMetricsStreamHandler.java MParse.java
Log:
BuildException -> TaskException
Removed uneeded imports.
Processed code through style formatter.
Revision Changes Path
1.3 +24 -24 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java
Index: AbstractMetamataTask.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/AbstractMetamataTask.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractMetamataTask.java 2001/12/15 14:55:59 1.2
+++ AbstractMetamataTask.java 2001/12/16 00:35:26 1.3
@@ -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.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 @@
// 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 @@
this.metamataHome = metamataHome;
}
-
/**
* The java files or directory to be audited
*
@@ -189,10 +191,10 @@
/**
* 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 @@
/**
* 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 @@
return new File( new File( home.getAbsolutePath() ), "lib/metamata.jar" );
}
-
protected Hashtable getFileMapping()
{
return includedFiles;
@@ -266,21 +267,21 @@
/**
* 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 @@
*/
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 @@
{
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 @@
}
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 @@
fw.close();
}
catch( IOException ignored )
- {}
+ {
+ }
}
}
}
@@ -373,18 +373,18 @@
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.
1.3 +8 -7 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java
Index: MAudit.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAudit.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MAudit.java 2001/12/15 14:55:59 1.2
+++ MAudit.java 2001/12/16 00:35:26 1.3
@@ -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 @@
}
// 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 @@
}
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 @@
}
protected void cleanUp()
- throws BuildException
+ throws TaskException
{
super.cleanUp();
// at this point if -list is used, we should move
@@ -220,7 +221,7 @@
}
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 @@
}
catch( IOException e )
{
- throw new BuildException( "Error", e );
+ throw new TaskException( "Error", e );
}
}
return handler;
1.2 +17 -12 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java
Index: MAuditStreamHandler.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MAuditStreamHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MAuditStreamHandler.java 2001/12/15 12:06:29 1.1
+++ MAuditStreamHandler.java 2001/12/16 00:35:26 1.2
@@ -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.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 @@
*
* @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 @@
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 @@
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 @@
wri.close();
}
catch( IOException e )
- {}
+ {
+ }
}
}
}
@@ -218,7 +223,7 @@
*/
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 @@
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
1.2 +20 -19 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java
Index: MMetrics.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetrics.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MMetrics.java 2001/12/15 12:06:29 1.1
+++ MMetrics.java 2001/12/16 00:35:26 1.2
@@ -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 @@
return path;
}
-
protected Vector getOptions()
{
Vector options = new Vector( 512 );
@@ -158,7 +158,7 @@
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 @@
// 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 @@
}
protected void execute0( ExecuteStreamHandler handler )
- throws BuildException
+ throws TaskException
{
super.execute0( handler );
transformFile();
@@ -243,11 +242,11 @@
* 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 @@
}
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 @@
}
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 @@
xmlStream.close();
}
catch( IOException ignored )
- {}
+ {
+ }
}
if( tmpStream != null )
{
@@ -289,7 +289,8 @@
tmpStream.close();
}
catch( IOException ignored )
- {}
+ {
+ }
}
}
}
1.2 +22 -16 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java
Index: MMetricsStreamHandler.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MMetricsStreamHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MMetricsStreamHandler.java 2001/12/15 12:06:29 1.1
+++ MMetricsStreamHandler.java 2001/12/16 00:35:26 1.2
@@ -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 @@
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 @@
* @exception IOException Description of Exception
*/
public void setProcessErrorStream( InputStream p1 )
- throws IOException { }
+ throws IOException
+ {
+ }
/**
* Ignore.
@@ -126,7 +129,9 @@
* @exception IOException Description of Exception
*/
public void setProcessInputStream( OutputStream p1 )
- throws IOException { }
+ throws IOException
+ {
+ }
/**
* Set the inputstream
@@ -152,7 +157,7 @@
}
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 @@
// 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 @@
// 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 @@
return PACKAGE;
}
-
/**
* Create all attributes of a MetricsElement skipping those who have an
* empty string
@@ -264,15 +268,15 @@
{
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 @@
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 @@
{
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 @@
private int indent;
private Vector metrics;
+
static
{
METAMATA_NF = NumberFormat.getInstance();
@@ -411,7 +417,7 @@
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 @@
// 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( '/' );
1.3 +25 -26 jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java
Index: MParse.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/metamata/MParse.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MParse.java 2001/12/15 14:55:59 1.2
+++ MParse.java 2001/12/16 00:35:26 1.3
@@ -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 @@
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 @@
/**
* 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 @@
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 @@
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 @@
}
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 @@
{
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 @@
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 @@
*
* @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 @@
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 @@
fw.close();
}
catch( IOException ignored )
- {}
+ {
+ }
}
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>