]> source.dussan.org Git - aspectj.git/commitdiff
fix for pr112830, tolerate variations on "aspectjrt.jar" for Maven.
authoracolyer <acolyer>
Tue, 8 Nov 2005 16:41:54 +0000 (16:41 +0000)
committeracolyer <acolyer>
Tue, 8 Nov 2005 16:41:54 +0000 (16:41 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java

index 004ab65343cefb384badf2f40bf446d7506b0694..622eb02d9ce3d81d4279b5196bc3971f267d11fe 100644 (file)
@@ -992,16 +992,20 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
                }
                
                if (buildConfig == null || buildConfig.getFullClasspath() == null) return "no classpath specified";
+               
+               String ret = null;
                for (Iterator it = buildConfig.getFullClasspath().iterator(); it.hasNext(); ) {
                        File p = new File( (String)it.next() );
-                       if (p.isFile() && p.getName().equals("aspectjrt.jar")) {
+                       // pr112830, allow variations on aspectjrt.jar of the form aspectjrtXXXXXX.jar
+                       if (p.isFile() && p.getName().startsWith("aspectjrt") && p.getName().endsWith(".jar")) {
 
                                try {
                     String version = null;
                     Manifest manifest = new JarFile(p).getManifest();
                     if (manifest == null) {
-                       return "no manifest found in " + p.getAbsolutePath() + 
+                       ret = "no manifest found in " + p.getAbsolutePath() + 
                                                                ", expected " + Version.text;
+                       continue;
                     }
                     Attributes attr = manifest.getAttributes("org/aspectj/lang/");
                     if (null != attr) {
@@ -1017,18 +1021,21 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
 //                                                     p.getAbsolutePath());
                         return null;
                                        } else if (!Version.text.equals(version)) {
-                                               return "bad version number found in " + p.getAbsolutePath() + 
+                                               ret =  "bad version number found in " + p.getAbsolutePath() + 
                                                                " expected " + Version.text + " found " + version;
+                                               continue;
                                        }
                                } catch (IOException ioe) {
-                                       return "bad jar file found in " + p.getAbsolutePath() + " error: " + ioe;
+                                       ret = "bad jar file found in " + p.getAbsolutePath() + " error: " + ioe;
                                }
-                               return null;
+                               return null; // this is the "OK" return value!
                        } else {
                                // might want to catch other classpath errors
                        }
                }
                
+               if (ret != null) return ret; // last error found in potentially matching jars...
+               
                return "couldn't find aspectjrt.jar on classpath, checked: " + makeClasspathString(buildConfig);
        }