From: aclement Date: Fri, 27 Jan 2006 12:30:21 +0000 (+0000) Subject: fix for 121395 - error message on stupid aspectpath X-Git-Tag: POST_MEMORY_CHANGES~141 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=551b446bec83bef0f7df1f57353fdb4297bc14a6;p=aspectj.git fix for 121395 - error message on stupid aspectpath --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java index ebdd735c5..4d2d06d28 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AjBuildManager.java @@ -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(); diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index 36a7c2c1d..3af1d2fb2 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -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) { diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 8eb84ceee..939902b9e 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -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