Exception handling in removeExistingSignatures hides errors during unsigning
----------------------------------------------------------------------------

                 Key: MWEBSTART-91
                 URL: http://jira.codehaus.org/browse/MWEBSTART-91
             Project: Maven 2.x Webstart Plugin
          Issue Type: Bug
          Components: sign
    Affects Versions: 1.0-alpha-2
            Reporter: Havard Bjastad


The following code snippet from removeExistingSignatures hides errors that may 
occur in unsignJar.execute():

        for ( int i = 0; i < jarFiles.length; i++ )
        {
            verifyMojo.setJarPath(jarFiles[i]);
            // if the jar 
            try {
                verifyMojo.execute();
                /*
                 * if no exception is thrown, the jar is already signed and must
                 * be unsigned.
                 */
                unsignJar.setJarPath(jarFiles[i]);
                // long lastModified = jarFiles[i].lastModified();
                unsignJar.execute();
                // jarFiles[i].setLastModified( lastModified );
            } catch (MojoExecutionException e) {
                /*
                 * exception is thrown if jar is not signed, so unsigning is 
not required.
                 */
                continue;
            }
        }

This can be solved by simply moving the unsigning outside the try statement:

        for ( int i = 0; i < jarFiles.length; i++ )
        {
            verifyMojo.setJarPath(jarFiles[i]);
            // if the jar 
            try {
                verifyMojo.execute();
                /*
                 * if no exception is thrown, the jar is already signed and must
                 * be unsigned.
                 */
            } catch (MojoExecutionException e) {
                /*
                 * exception is thrown if jar is not signed, so unsigning is 
not required.
                 */
                continue;
            }
        }
                unsignJar.setJarPath(jarFiles[i]);
                // long lastModified = jarFiles[i].lastModified();
                unsignJar.execute();
                // jarFiles[i].setLastModified( lastModified );


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to