donaldp 01/12/15 16:34:35
Modified:
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka
CovMerge.java CovReport.java Coverage.java
Filters.java ReportFilters.java StringUtil.java
Triggers.java XMLReport.java
proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode
ClassFile.java ClassPathLoader.java MethodInfo.java
Utils.java
Log:
BuildException -> TaskException
Removed uneeded imports.
Processed code through style formatter.
Revision Changes Path
1.3 +22 -19
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java
Index: CovMerge.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovMerge.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CovMerge.java 2001/12/15 14:55:59 1.2
+++ CovMerge.java 2001/12/16 00:34:34 1.3
@@ -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 @@
//---------------- 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 @@
/**
* 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 @@
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 @@
* @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 @@
/**
* 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 @@
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 @@
}
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
{
1.3 +21 -22
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java
Index: CovReport.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/CovReport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CovReport.java 2001/12/15 14:55:59 1.2
+++ CovReport.java 2001/12/16 00:34:34 1.3
@@ -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.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.Path;
import org.w3c.dom.Document;
-
/**
* Convenient task to run the snapshot merge utility for JProbe Coverage 3.0.
*
@@ -118,8 +118,9 @@
*/
private Reference reference = null;
-
- public CovReport() { }
+ public CovReport()
+ {
+ }
/**
* set the filters
@@ -141,7 +142,6 @@
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 void execute()
- throws BuildException
+ throws TaskException
{
checkOptions();
try
@@ -238,7 +238,7 @@
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 @@
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 @@
}
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 @@
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 @@
/**
* 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 Reference
{
protected Path classPath;
@@ -380,18 +379,18 @@
}
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 @@
}
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 );
}
}
}
1.3 +22 -19
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java
Index: Coverage.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Coverage.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Coverage.java 2001/12/15 14:55:59 1.2
+++ Coverage.java 2001/12/16 00:34:34 1.3
@@ -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.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 @@
//---------------- the tedious job begins here
- public Coverage() { }
+ public Coverage()
+ {
+ }
/**
* default to false unless file is htm or html
@@ -267,10 +270,10 @@
/**
* 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 @@
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 @@
* @return The Parameters value
*/
protected String[] getParameters()
+ throws TaskException
{
Vector params = new Vector();
params.addElement( "-jp_function=" + function );
@@ -358,7 +362,7 @@
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 @@
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 @@
/**
* 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 @@
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 @@
}
}
-
/**
* 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 @@
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 @@
}
catch( IOException e )
{
- throw new BuildException( "Could not write parameter file " +
file, e );
+ throw new TaskException( "Could not write parameter file " +
file, e );
}
finally
{
1.2 +4 -1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java
Index: Filters.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Filters.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Filters.java 2001/12/15 12:06:30 1.1
+++ Filters.java 2001/12/16 00:34:34 1.2
@@ -6,6 +6,7 @@
* the LICENSE file.
*/
package org.apache.tools.ant.taskdefs.optional.sitraka;
+
import java.util.Vector;
/**
@@ -31,7 +32,9 @@
*/
protected Vector filters = new Vector();
- public Filters() { }
+ public Filters()
+ {
+ }
public void setDefaultExclude( boolean value )
{
1.2 +7 -5
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java
Index: ReportFilters.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/ReportFilters.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReportFilters.java 2001/12/15 12:06:30 1.1
+++ ReportFilters.java 2001/12/16 00:34:34 1.2
@@ -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 @@
*/
protected Vector matchers = null;
- public ReportFilters() { }
+ public ReportFilters()
+ {
+ }
/**
* Check whether a given <classname><method>() is accepted by
@@ -51,8 +54,8 @@
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 @@
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 );
@@ -111,7 +114,6 @@
public static class Exclude extends FilterElement
{
}
-
/**
* default abstract filter element class
1.2 +3 -1
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java
Index: StringUtil.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/StringUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- StringUtil.java 2001/12/15 12:06:30 1.1
+++ StringUtil.java 2001/12/16 00:34:34 1.2
@@ -17,7 +17,9 @@
/**
* private constructor, it's a utility class
*/
- private StringUtil() { }
+ private StringUtil()
+ {
+ }
/**
* Replaces all occurences of <tt>find</tt> with <tt>replacement</tt> in
the
1.2 +8 -6
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java
Index: Triggers.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/Triggers.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Triggers.java 2001/12/15 12:06:30 1.1
+++ Triggers.java 2001/12/16 00:34:34 1.2
@@ -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 @@
eventMap.put( "exit", "X" );
}
- public Triggers() { }
+ public Triggers()
+ {
+ }
public void addMethod( Method method )
{
@@ -67,7 +70,6 @@
return buf.toString();
}
-
public static class Method
{
protected String action;
@@ -76,11 +78,11 @@
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 @@
{
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;
}
1.2 +25 -26
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java
Index: XMLReport.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/XMLReport.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XMLReport.java 2001/12/15 12:06:30 1.1
+++ XMLReport.java 2001/12/16 00:34:34 1.2
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
else
{
-// log("discarding " + signature);
+ // log("discarding " + signature);
}
}
return methods;
@@ -274,17 +275,17 @@
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 @@
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 @@
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 @@
return methodElem;
}
-
/**
* create node maps so that we can access node faster by their name
*/
@@ -417,7 +417,7 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
//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 )
{
1.2 +6 -6
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java
Index: ClassFile.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassFile.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClassFile.java 2001/12/15 12:06:30 1.1
+++ ClassFile.java 2001/12/16 00:34:35 1.2
@@ -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.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 @@
// 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 @@
// 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 @@
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
{
1.2 +18 -16
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java
Index: ClassPathLoader.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/ClassPathLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClassPathLoader.java 2001/12/15 12:06:30 1.1
+++ ClassPathLoader.java 2001/12/16 00:34:35 1.2
@@ -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 @@
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 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 @@
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 @@
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 @@
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 @@
{
throw new NoSuchElementException();
}
- File file = files[index++];
+ File file = files[ index++ ];
if( !file.exists() )
{
return new NullLoader( file );
@@ -240,7 +241,7 @@
public ClassFile[] getClasses()
throws IOException
{
- return new ClassFile[0];
+ return new ClassFile[ 0 ];
}
public File getFile()
@@ -273,7 +274,7 @@
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 @@
v.addElement( classFile );
}
}
- ClassFile[] classes = new ClassFile[v.size()];
+ ClassFile[] classes = new ClassFile[ v.size() ];
v.copyInto( classes );
return classes;
}
@@ -346,7 +347,7 @@
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 @@
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 @@
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 @@
is.close();
}
catch( IOException ignored )
- {}
+ {
+ }
}
}
}
- ClassFile[] classes = new ClassFile[v.size()];
+ ClassFile[] classes = new ClassFile[ v.size() ];
v.copyInto( classes );
return classes;
}
1.2 +5 -2
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java
Index: MethodInfo.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/MethodInfo.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MethodInfo.java 2001/12/15 12:06:30 1.1
+++ MethodInfo.java 2001/12/16 00:34:35 1.2
@@ -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 @@
private String descriptor;
private String name;
- public MethodInfo() { }
+ public MethodInfo()
+ {
+ }
public String getAccess()
{
@@ -73,7 +76,7 @@
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( ", " );
1.2 +47 -44
jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java
Index: Utils.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/sitraka/bytecode/Utils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Utils.java 2001/12/15 12:06:30 1.1
+++ Utils.java 2001/12/16 00:34:35 1.2
@@ -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 @@
/**
* private constructor
*/
- private Utils() { }
+ private Utils()
+ {
+ }
/**
* return the class access flag as java modifiers
@@ -231,7 +234,7 @@
break;
}
}
- String[] array = new String[params.size()];
+ String[] array = new String[ params.size() ];
params.copyInto( array );
return array;
}
@@ -260,7 +263,7 @@
*/
public static String getUTF8Value( ConstantPool pool, int index )
{
- return ( ( Utf8CPInfo )pool.getEntry( index ) ).getValue();
+ return ( (Utf8CPInfo)pool.getEntry( index ) ).getValue();
}
/**
@@ -434,49 +437,49 @@
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;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>