Permalink
Browse files

MWEBSTART-91 slight refactor for more readability

git-svn-id: http://svn.codehaus.org/mojo/trunk/mojo/webstart-maven-plugin@5931 52ab4f32-60fc-0310-b215-8acea882cd1b
  • Loading branch information...
1 parent 65944ff commit d7846db506f2513a91d151911e14bd25445d06c3 lacostej committed Jan 14, 2008
Showing with 14 additions and 10 deletions.
  1. +14 −10 plugin/src/main/java/org/codehaus/mojo/webstart/AbstractBaseJnlpMojo.java
@@ -733,30 +733,24 @@ protected int removeExistingSignatures(File workDirectory, FileFilter updatedJar
// process jars
File[] jarFiles = workDirectory.listFiles( updatedJarFileFilter );
- JarUnsignMojo unsignJar = new JarUnsignMojo();
- unsignJar.setTempDir( tempDir );
- unsignJar.setVerbose( isVerbose() );
- unsignJar.setArchiverManager( archiverManager );
-
for ( int i = 0; i < jarFiles.length; i++ )
{
- if (isJarSigned(jarFiles[i]))
+ if ( isJarSigned( jarFiles[i] ) )
{
- unsignJar.setJarPath(jarFiles[i]);
- unsignJar.execute();
+ unsignJarFile( jarFiles[i], tempDir );
}
}
// cleanup tempDir
removeDirectory(tempDir);
- return jarFiles.length;
+ return jarFiles.length; // FIXME this is wrong. Not all jars are signed.
}
private boolean isJarSigned(File jarFile)
{
JarSignVerifyMojo verifyMojo = setupVerifyMojo();
- verifyMojo.setJarPath(jarFile);
+ verifyMojo.setJarPath( jarFile );
try {
verifyMojo.execute();
return true;
@@ -765,6 +759,16 @@ private boolean isJarSigned(File jarFile)
}
}
+ private void unsignJarFile(File jarFile, File tempDir) throws MojoExecutionException
+ {
+ JarUnsignMojo unsignJar = new JarUnsignMojo();
+ unsignJar.setTempDir( tempDir );
+ unsignJar.setVerbose( isVerbose() );
+ unsignJar.setArchiverManager( archiverManager );
+ unsignJar.setJarPath( jarFile );
+ unsignJar.execute();
+ }
+
/**
* Returns a configured instance of the JarSignVerifyMojo to test whether a
* jar is already signed. The Mojo throws an exception to indicate that a

0 comments on commit d7846db

Please sign in to comment.