summaryrefslogtreecommitdiff
path: root/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
diff options
context:
space:
mode:
authorMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-17 16:33:28 +0100
committerMark Donszelmann <Mark.Donszelmann@gmail.com>2009-11-17 16:33:28 +0100
commit0975240ce6b505db32a87233f31c8d1377b14c54 (patch)
treeedf3933a3bd151673c3ab1bb9338c4411bab89c2 /src/main/java/org/apache/maven/plugin/nar/NarUtil.java
parentbb9f382d1024e60f672b9c484031f40772a54a4b (diff)
downloadmaven-nar-plugin-0975240ce6b505db32a87233f31c8d1377b14c54.tar.gz
maven-nar-plugin-0975240ce6b505db32a87233f31c8d1377b14c54.tar.bz2
maven-nar-plugin-0975240ce6b505db32a87233f31c8d1377b14c54.tar.xz
maven-nar-plugin-0975240ce6b505db32a87233f31c8d1377b14c54.zip
Cleanup
Diffstat (limited to 'src/main/java/org/apache/maven/plugin/nar/NarUtil.java')
-rw-r--r--src/main/java/org/apache/maven/plugin/nar/NarUtil.java37
1 files changed, 22 insertions, 15 deletions
diff --git a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
index a18c97c..3dae4de 100644
--- a/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
+++ b/src/main/java/org/apache/maven/plugin/nar/NarUtil.java
@@ -30,7 +30,6 @@ import java.util.Map;
import java.util.Properties;
import java.util.regex.Pattern;
-import org.apache.bcel.classfile.ClassFormatException;
import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.JavaClass;
import org.apache.maven.plugin.MojoExecutionException;
@@ -43,9 +42,13 @@ import org.codehaus.plexus.util.cli.Commandline;
/**
* @author Mark Donszelmann
*/
-public class NarUtil
+public final class NarUtil
{
+ private NarUtil() {
+ // never instantiate
+ }
+
private static Properties defaults;
public static Properties getDefaults()
@@ -189,7 +192,7 @@ public class NarUtil
runRanlib( files[i], log );
}
}
- if ( file.isFile() && file.canRead() && file.canWrite() && !file.isHidden() && file.getName().endsWith( ".a" ) )
+ if ( file.isFile() && file.canWrite() && !file.isHidden() && file.getName().endsWith( ".a" ) )
{
// ranlib file
int result = runCommand( "ranlib", new String[] { file.getPath() }, null, null, log );
@@ -206,10 +209,10 @@ public class NarUtil
*
* @param filename the absolute file name of the class
* @return the Bcel Class.
- * @throws IOException, ClassFormatException
+ * @throws IOException
*/
- public static final JavaClass getBcelClass( String filename )
- throws IOException, ClassFormatException
+ public static JavaClass getBcelClass( String filename )
+ throws IOException
{
ClassParser parser = new ClassParser( filename );
return parser.parse();
@@ -221,7 +224,7 @@ public class NarUtil
* @param filename the absolute file name of the class
* @return the header file name.
*/
- public static final String getHeaderName( String base, String filename )
+ public static String getHeaderName( String base, String filename )
{
base = base.replaceAll( "\\\\", "/" );
filename = filename.replaceAll( "\\\\", "/" );
@@ -492,8 +495,9 @@ public class NarUtil
outputGobbler.start();
process.waitFor();
dbg.println( "ExitValue: " + process.exitValue() );
- errorGobbler.join( 5000 );
- outputGobbler.join( 5000 );
+ final int timeout = 5000;
+ errorGobbler.join( timeout );
+ outputGobbler.join( timeout );
return process.exitValue();
}
catch ( Exception e )
@@ -502,14 +506,13 @@ public class NarUtil
}
}
- static class StreamGobbler
+ private final static class StreamGobbler
extends Thread
{
- InputStream is;
+ private InputStream is;
+ private TextStream ts;
- TextStream ts;
-
- StreamGobbler( InputStream is, TextStream ts )
+ private StreamGobbler( InputStream is, TextStream ts )
{
this.is = is;
this.ts = ts;
@@ -529,7 +532,11 @@ public class NarUtil
}
catch ( IOException e )
{
- e.printStackTrace();
+ // e.printStackTrace()
+ StackTraceElement[] stackTrace = e.getStackTrace();
+ for (int i=0; i<stackTrace.length; i++) {
+ ts.println( stackTrace[i].toString());
+ }
}
}
}