]> source.dussan.org Git - aspectj.git/commitdiff
fix for 121395 - error message on stupid aspectpath
authoraclement <aclement>
Fri, 27 Jan 2006 12:30:21 +0000 (12:30 +0000)
committeraclement <aclement>
Fri, 27 Jan 2006 12:30:21 +0000 (12:30 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java
tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index ebdd735c58341f9fdf642ed2153a15c62b299c69..4d2d06d282e09ca2fd6aded7a6daedba90724362 100644 (file)
@@ -628,7 +628,12 @@ public class AjBuildManager implements IOutputClassFileNameProvider,IBinarySourc
                
                for (Iterator i = buildConfig.getAspectpath().iterator(); i.hasNext();) {
                        File f = (File) i.next();
-                       bcelWeaver.addLibraryJarFile(f);
+                       if (!f.exists()) {
+                               IMessage message = new Message("invalid aspectpath entry: "+f.getName(),null,true);
+                               handler.handleMessage(message);
+                       } else {
+                               bcelWeaver.addLibraryJarFile(f);
+                       }
                }
                
 //             String lintMode = buildConfig.getLintMode();
index 36a7c2c1da7f8ac71b89b72faf6fa367b75f33a4..3af1d2fb290cb25b6ec185cf206d9bd47ac678a6 100644 (file)
@@ -69,6 +69,10 @@ public class AjdeInteractionTestbed extends TestCase {
        public static void configureNonStandardCompileOptions(String options) {
                MyBuildOptionsAdapter.setNonStandardOptions(options);
        }
+       
+       public static void configureAspectPath(Set aspectpath) {
+               MyProjectPropertiesAdapter.setAspectpath(aspectpath);
+       } 
        // End of methods for configuring the build
        
        
@@ -79,6 +83,7 @@ public class AjdeInteractionTestbed extends TestCase {
                MyStateListener.reset();
                MyBuildProgressMonitor.reset();
                MyTaskListManager.reset();
+               MyProjectPropertiesAdapter.reset();
                
                // Create a sandbox in which to work
                createEmptySandbox();
@@ -364,8 +369,13 @@ public class AjdeInteractionTestbed extends TestCase {
                        return _instance;
                }
                
+               public static void reset() {
+                       _instance.aspectPath=null;
+               }
+               
                private String projectName = null;
                private String classPath = "";
+               private Set aspectPath = null;
                
                public static void setActiveProject(String n) {
                        _instance.projectName = n;
@@ -388,6 +398,10 @@ public class AjdeInteractionTestbed extends TestCase {
                        this.classPath = path;
                }
                
+               public static void setAspectpath(Set path) {
+                       _instance.aspectPath = path;
+               }
+               
                // interface impl below
                
                // DOESSOMETHING
@@ -503,8 +517,8 @@ public class AjdeInteractionTestbed extends TestCase {
                }
 
                public Set getAspectPath() {
-                       log("MyProjectProperties.getAspectPath()");
-                       return null;
+                       log("MyProjectProperties.getAspectPath("+aspectPath+")");
+                       return aspectPath;
                }
                
                public static void log(String s) {
index 8eb84ceee912abaaf3a3c8f07d01648691298e08..939902b9eba66f452c7f0ace420d7aa00f9f6d40 100644 (file)
@@ -16,8 +16,10 @@ import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import org.aspectj.ajdt.internal.core.builder.AjState;
 import org.aspectj.ajdt.internal.core.builder.IncrementalStateManager;
@@ -61,6 +63,17 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed {
                checkWasntFullBuild();
                checkCompileWeaveCount(0,0);
        }
+
+       // source code doesnt matter, we are checking invalid path handling
+       public void testInvalidAspectpath_pr121395() {
+               initialiseProject("P1");
+               File f = new File("foo.jar");
+               Set s = new HashSet();
+               s.add(f);
+               configureAspectPath(s);
+               build("P1"); // This first build will be batch
+               checkForError("invalid aspectpath entry");
+       }
        
        
        // Make simple changes to a project, adding a class