You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ba...@apache.org on 2008/12/17 01:42:05 UTC

svn commit: r727235 - in /maven/plugins/trunk/maven-eclipse-plugin/src/main: java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java resources/org/apache/maven/plugin/eclipse/messages.properties

Author: baerrach
Date: Tue Dec 16 16:42:05 2008
New Revision: 727235

URL: http://svn.apache.org/viewvc?rev=727235&view=rev
Log:
The dynamic workspace test has invalid JRE paths in the workspace.

This was causing an IOException which incorrectly displayed the Xpp3Dom array instead of the element that was the problem.

Once fixed the next problem was that the construction of the rtJar fails if the file does not exist.  The code now protects against this.

Modified:
    maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
    maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java?rev=727235&r1=727234&r2=727235&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/reader/ReadWorkspaceLocations.java Tue Dec 16 16:42:05 2008
@@ -31,6 +31,7 @@
 import java.util.Set;
 import java.util.jar.JarFile;
 
+import org.apache.maven.plugin.eclipse.Messages;
 import org.apache.maven.plugin.eclipse.WorkspaceConfiguration;
 import org.apache.maven.plugin.ide.IdeDependency;
 import org.apache.maven.plugin.ide.IdeUtils;
@@ -464,7 +465,12 @@
                         MessageFormat.format( ReadWorkspaceLocations.CLASSPATHENTRY_FORMAT,
                                               new Object[] { typeId, name } );
                     String jrePath = new File( path ).getCanonicalPath();
-                    JarFile rtJar = new JarFile( new File( new File( jrePath ), "jre/lib/rt.jar" ) );
+                    File rtJarFile = new File( new File( jrePath ), "jre/lib/rt.jar" );
+                    if ( !rtJarFile.exists() ) {
+                        logger.warn( Messages.getString( "EclipsePlugin.invalidvminworkspace", jrePath ) );
+                        continue;
+                    }
+                    JarFile rtJar = new JarFile( rtJarFile );
                     String version = rtJar.getManifest().getMainAttributes().getValue( "Specification-Version" );
                     if ( defaultJRE.endsWith( "," + vmId ) )
                     {
@@ -490,7 +496,7 @@
                 }
                 catch ( IOException e )
                 {
-                    logger.warn( "Could not interpret entry: " + vm.toString() );
+                    logger.warn( "Could not interpret entry: " + vm[vmIndex].toString() );
                 }
             }
         }

Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties?rev=727235&r1=727234&r2=727235&view=diff
==============================================================================
--- maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties (original)
+++ maven/plugins/trunk/maven-eclipse-plugin/src/main/resources/org/apache/maven/plugin/eclipse/messages.properties Tue Dec 16 16:42:05 2008
@@ -20,6 +20,7 @@
 EclipsePlugin.workspace=Using Eclipse Workspace: {0}
 EclipsePlugin.cantcanonicalize=Can't canonicalize system path: {0}
 EclipsePlugin.unchangedmanifest=Not writing Manifest file as it is unchanged: {0}
+EclipsePlugin.invalidvminworkspace=Workspace defines a VM that does not contain a valid jre/lib/rt.jar: {0}
 
 EclipseSettingsWriter.wrotesettings=Wrote settings to {0}
 EclipseSettingsWriter.cannotcreatesettings=Cannot create settings file