summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ajde/testdata/bug-36071a/input1bin0 -> 1895 bytes
-rw-r--r--ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java7
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java23
-rw-r--r--ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java2
-rw-r--r--loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java31
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java14
-rw-r--r--org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/aspectJar.filebin0 -> 1370 bytes
-rw-r--r--org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/jarChildbin0 -> 724 bytes
-rw-r--r--org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/parent.zipbin0 -> 630 bytes
-rw-r--r--org.aspectj.ajdt.core/testdata/ajc/abc.jarbin0 -> 176 bytes
-rw-r--r--org.aspectj.ajdt.core/testdata/ajc/myextdir/dummy.jarbin0 -> 176 bytes
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java66
-rw-r--r--org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjcTestCase.java8
-rw-r--r--taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java8
-rw-r--r--taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java11
-rw-r--r--testing/newsrc/org/aspectj/testing/CompileSpec.java3
-rw-r--r--testing/newsrc/org/aspectj/testing/RunSpec.java51
-rw-r--r--testing/src/org/aspectj/testing/harness/bridge/Sandbox.java2
-rw-r--r--tests/bugs152/pr137235/directory.jar/Before.java5
-rw-r--r--tests/bugs152/pr137235/directory.jar/BeforeExec.aj5
-rw-r--r--tests/bugs152/pr137235/directory.jar/Hello.java6
-rw-r--r--tests/bugs152/pr137235/directory.jar/Rename.aj5
-rw-r--r--tests/ltw/folder.jar/Aspect1.aj19
-rw-r--r--tests/ltw/folder.jar/Aspect2.aj19
-rw-r--r--tests/ltw/folder.jar/Main.java41
-rw-r--r--tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml5
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java19
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml130
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java2
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/ajc152.xml26
-rw-r--r--util/src/org/aspectj/util/FileUtil.java19
-rw-r--r--util/src/org/aspectj/util/Reflection.java2
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java19
-rw-r--r--weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java3
-rw-r--r--weaver/testdata/WeavingURLClassLoaderTest/builtLibs/aspectNoExtbin0 -> 1379 bytes
-rw-r--r--weaver/testdata/WeavingURLClassLoaderTest/builtLibs/test.jar/main.filebin0 -> 698 bytes
36 files changed, 501 insertions, 50 deletions
diff --git a/ajde/testdata/bug-36071a/input1 b/ajde/testdata/bug-36071a/input1
new file mode 100644
index 000000000..cc7183fdd
--- /dev/null
+++ b/ajde/testdata/bug-36071a/input1
Binary files differ
diff --git a/ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java b/ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java
index 406e7e5bf..233933a7a 100644
--- a/ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java
+++ b/ajde/testsrc/org/aspectj/ajde/NullIdeProperties.java
@@ -33,6 +33,7 @@ public class NullIdeProperties implements ProjectPropertiesAdapter {
private Set sourceRoots;
private Set aspectPath;
private String outJar;
+ private String outputPath = "bin";
public NullIdeProperties(String testProjectPath) {
this.testProjectPath = testProjectPath;
@@ -75,7 +76,11 @@ public class NullIdeProperties implements ProjectPropertiesAdapter {
}
public String getOutputPath() {
- return testProjectPath + "/bin";
+ return testProjectPath + "/" + outputPath;
+ }
+
+ public void setOutputPath(String outputPath) {
+ this.outputPath = outputPath;
}
public String getAjcWorkingDir() {
diff --git a/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java b/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java
index cb7ca236d..657963510 100644
--- a/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java
+++ b/ajde/testsrc/org/aspectj/ajde/ResourceCopyTestCase.java
@@ -98,6 +98,29 @@ public class ResourceCopyTestCase extends AjdeTestCase {
assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
compareInjarsToBin(injar1,"src","bin");
}
+
+ public void testInjarsToOddBin () {
+ Set injars = new HashSet();
+ File injar1 = openFile(injar1Name);
+ injars.add(injar1);
+ ideManager.getProjectProperties().setOutputPath("crazy.jar");
+ ideManager.getProjectProperties().setInJars(injars);
+ assertTrue("Build failed",doSynchronousBuild("config2.lst"));
+ assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
+ compareInjarsToBin(injar1,"src","crazy.jar");
+ }
+
+ public void testInjarsToOutjarOddNames () {
+ Set injars = new HashSet();
+ File injar1 = openFile("input1");
+ File outjar = openFile(outjarName+".fozout");
+ injars.add(injar1);
+ ideManager.getProjectProperties().setInJars(injars);
+ ideManager.getProjectProperties().setOutJar(outjar.getAbsolutePath());
+ assertTrue("Build failed",doSynchronousBuild("config2.lst"));
+ assertTrue("Build warnings",ideManager.getCompilationSourceLineTasks().isEmpty());
+ compareJars(injar1,"src",outjar);
+ }
/*
* Ensure bin contains all non-Java resouces from source and injars
diff --git a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
index aca06e87e..19d04b8ca 100644
--- a/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/internal/LstBuildConfigManagerTest.java
@@ -54,7 +54,7 @@ public class LstBuildConfigManagerTest extends AjdeTestCase {
doSynchronousBuild("bad-injar.lst");
messages = NullIdeManager.getIdeManager().getCompilationSourceLineTasks();
message = (NullIdeTaskListManager.SourceLineTask)messages.get(0);
- assertTrue(message.getContainedMessage().getMessage().indexOf("bad inpath") != -1);
+ assertTrue(message.getContainedMessage().getMessage().indexOf("skipping missing, empty or corrupt inpath entry") != -1);
}
public void testErrorMessages() throws IOException {
diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java
index 71a00ad2f..13c22cc84 100644
--- a/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java
+++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/WeavingURLClassLoaderTest.java
@@ -30,8 +30,6 @@ import org.aspectj.weaver.tools.WeavingAdaptor;
/**
* @author websterm
*
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
*/
public class WeavingURLClassLoaderTest extends TestCase {
@@ -432,6 +430,35 @@ public class WeavingURLClassLoaderTest extends TestCase {
}
}
+ public void testWeavingURLClassLoaderOddJars() throws Exception {
+ URL classes = FileUtil.getFileURL(new File(TEST_BASE+"/test.jar/main.file"));
+ URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT));
+ URL aspects = FileUtil.getFileURL(new File(TEST_BASE+"/aspectNoExt"));
+ URL[] classURLs = new URL[] { aspects, classes, aspectjrt };
+ URL[] aspectURLs = new URL[] { aspects };
+ WeavingURLClassLoader loader = new WeavingURLClassLoader(classURLs,aspectURLs,getClass().getClassLoader());
+
+ Class clazz = loader.loadClass("packag.Main");
+ invokeMain(clazz,new String[] { });
+ }
+
+ public void testWeavingURLClassLoaderMissingJars() throws Exception {
+ try {
+ URL classes = FileUtil.getFileURL(new File(TEST_BASE+"/test.jar/main.file"));
+ URL aspectjrt = FileUtil.getFileURL(new File(ASPECTJRT));
+ URL aspects = FileUtil.getFileURL(new File(TEST_BASE+"/MissingFile"));
+ URL[] classURLs = new URL[] { aspects, classes, aspectjrt };
+ URL[] aspectURLs = new URL[] { aspects };
+ WeavingURLClassLoader loader = new WeavingURLClassLoader(classURLs,aspectURLs,getClass().getClassLoader());
+
+ Class clazz = loader.loadClass("packag.Main");
+ invokeMain(clazz,new String[] { });
+ fail("Should reject bad aspect MissingFile");
+ } catch (AbortException ae) {
+ assertTrue("Unexpected cause: "+ae.getMessage(), ae.getMessage().indexOf("bad aspect library")!=-1);
+ }
+ }
+
private void doTestZipAspects(String aspectLib) throws Exception {
File classZip = new File(TEST_BASE + "/main.zip");
File zipLib = new File(aspectLib);
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
index f2749997d..e3f3c6ff1 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/ajc/BuildArgParser.java
@@ -397,14 +397,14 @@ public class BuildArgParser extends Main {
while (st.hasMoreTokens()) {
String filename = st.nextToken();
File file = makeFile(filename);
- if (file.exists() && FileUtil.hasZipSuffix(filename)) {
+ if (FileUtil.isZipFile(file)) {
inPath.add(file);
} else {
if (file.isDirectory()) {
inPath.add(file);
} else
- showError("bad inpath component: " + filename);
+ showWarning("skipping missing, empty or corrupt inpath entry: " + filename);
}
}
buildConfig.setInPath(inPath);
@@ -420,7 +420,7 @@ public class BuildArgParser extends Main {
while (st.hasMoreTokens()) {
String filename = st.nextToken();
File jarFile = makeFile(filename);
- if (jarFile.exists() && FileUtil.hasZipSuffix(filename)) {
+ if (FileUtil.isZipFile(jarFile)) {
buildConfig.getInJars().add(jarFile);
} else {
File dirFile = makeFile(filename);
@@ -428,7 +428,7 @@ public class BuildArgParser extends Main {
buildConfig.getInJars().add(dirFile);
} else
- showError("bad injar: " + filename);
+ showWarning("skipping missing, empty or corrupt injar: " + filename);
}
}
@@ -442,10 +442,10 @@ public class BuildArgParser extends Main {
while (st.hasMoreTokens()) {
String filename = st.nextToken();
File jarFile = makeFile(filename);
- if (jarFile.exists() && (FileUtil.hasZipSuffix(filename) || jarFile.isDirectory())) {
+ if (FileUtil.isZipFile(jarFile) || jarFile.isDirectory()) {
buildConfig.getAspectpath().add(jarFile);
} else {
- showError("bad aspectpath: " + filename);
+ showWarning("skipping missing, empty or corrupt aspectpath entry: " + filename);
}
}
@@ -476,7 +476,7 @@ public class BuildArgParser extends Main {
if (args.size() > nextArgIndex) {
// buildConfig.getAjOptions().put(AjCompilerOptions.OPTION_OutJAR, CompilerOptions.GENERATE);
File jarFile = makeFile(((ConfigParser.Arg)args.get(nextArgIndex)).getValue());
- if (FileUtil.hasZipSuffix(jarFile)) {
+ if (!jarFile.isDirectory()) {
try {
if (!jarFile.exists()) {
jarFile.createNewFile();
diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/aspectJar.file b/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/aspectJar.file
new file mode 100644
index 000000000..8cf7a60f5
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/aspectJar.file
Binary files differ
diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/jarChild b/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/jarChild
new file mode 100644
index 000000000..675ddbca3
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/jarChild
Binary files differ
diff --git a/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/parent.zip b/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/parent.zip
new file mode 100644
index 000000000..9814c1a42
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/OutjarTest/folder.jar/parent.zip
Binary files differ
diff --git a/org.aspectj.ajdt.core/testdata/ajc/abc.jar b/org.aspectj.ajdt.core/testdata/ajc/abc.jar
new file mode 100644
index 000000000..d62a61c4d
--- /dev/null
+++ b/org.aspectj.ajdt.core/testdata/ajc/abc.jar
Binary files differ
diff --git a/org.aspectj.ajdt.core/testdata/ajc/myextdir/dummy.jar b/org.aspectj.ajdt.core/testdata/ajc/myextdir/dummy.jar
index e69de29bb..d62a61c4d 100644
--- a/org.aspectj.ajdt.core/testdata/ajc/myextdir/dummy.jar
+++ b/org.aspectj.ajdt.core/testdata/ajc/myextdir/dummy.jar
Binary files differ
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
index e207fe91c..8481e762f 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/ajc/BuildArgParserTestCase.java
@@ -115,6 +115,7 @@ public class BuildArgParserTestCase extends TestCase {
String FILE_PATH = "@" + TEST_DIR + "configWithClasspathExtdirsBootCPArgs.lst";
AjBuildConfig config = genBuildConfig(new String[] { FILE_PATH }, messageWriter);
List classpath = config.getFullClasspath();
+ // note that empty or corrupt jars are NOT included in the classpath
// should have three entries, resolved relative to location of .lst file
assertEquals("Three entries in classpath",3,classpath.size());
Iterator cpIter = classpath.iterator();
@@ -507,6 +508,71 @@ public class BuildArgParserTestCase extends TestCase {
assertEquals("Wrong outxml","custom/aop.xml",config.getOutxmlName());
assertTrue("Following option currupted",config.getShowWeavingInformation());
}
+
+ public void testNonstandardInjars() {
+ AjBuildConfig config = setupNonstandardPath("-injars");
+ assertEquals("bad path: " + config.getInJars(), 3, config.getInJars().size());
+ }
+
+ public void testNonstandardInpath() {
+ AjBuildConfig config = setupNonstandardPath("-inpath");
+ assertEquals("bad path: " + config.getInpath(), 3, config.getInpath().size());
+ }
+
+ public void testNonstandardAspectpath() {
+ AjBuildConfig config = setupNonstandardPath("-aspectpath");
+ assertEquals("bad path: " + config.getAspectpath(), 3, config.getAspectpath().size());
+ }
+
+ public void testNonstandardClasspath() throws IOException {
+ AjBuildConfig config = setupNonstandardPath("-classpath");
+ checkPathSubset(config.getClasspath());
+ }
+
+ public void testNonstandardBootpath() throws IOException {
+ AjBuildConfig config = setupNonstandardPath("-bootclasspath");
+ checkPathSubset(config.getBootclasspath());
+ }
+
+ private void checkPathSubset(List path) throws IOException {
+ String files[] = { "aspectjJar.file", "jarChild", "parent.zip" };
+ for (int i = 0; i < files.length; i++) {
+ File file = new File(NONSTANDARD_JAR_DIR+files[i]);
+ assertTrue("bad path: " + path, path.contains(file.getCanonicalPath()));
+ }
+ }
+
+ public void testNonstandardOutjar() {
+ final String OUT_JAR = NONSTANDARD_JAR_DIR + File.pathSeparator + "outputFile";
+
+ AjBuildConfig config = genBuildConfig(new String[] {
+ "-outjar", OUT_JAR },
+ messageWriter);
+
+ File newJar = new File(OUT_JAR);
+ assertEquals(
+ getCanonicalPath(newJar),config.getOutputJar().getAbsolutePath());
+
+ newJar.delete();
+ }
+
+ public void testNonstandardOutputDirectorySetting() throws InvalidInputException {
+ String filePath = AjdtAjcTests.TESTDATA_PATH + File.separator + "ajc.jar" + File.separator;
+ File testDir = new File(filePath);
+ AjBuildConfig config = genBuildConfig(new String[] { "-d", filePath }, messageWriter);
+
+ assertEquals(testDir.getAbsolutePath(), config.getOutputDir().getAbsolutePath());
+ }
+
+ private static final String NONSTANDARD_JAR_DIR = AjdtAjcTests.TESTDATA_PATH + "/OutjarTest/folder.jar/";
+
+ private AjBuildConfig setupNonstandardPath(String pathType) {
+ String NONSTANDARD_PATH_ENTRY = NONSTANDARD_JAR_DIR+"aspectjJar.file" + File.pathSeparator + NONSTANDARD_JAR_DIR+"aspectJar.file" + File.pathSeparator + NONSTANDARD_JAR_DIR+"jarChild" + File.pathSeparator + NONSTANDARD_JAR_DIR+"parent.zip";
+
+ return genBuildConfig(new String[] {
+ pathType, NONSTANDARD_PATH_ENTRY },
+ messageWriter);
+ }
protected void setUp() throws Exception {
super.setUp();
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjcTestCase.java
index c9f275841..3d70759c8 100644
--- a/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjcTestCase.java
+++ b/org.aspectj.ajdt.core/testsrc/org/aspectj/tools/ajc/AjcTestCase.java
@@ -558,7 +558,8 @@ public class AjcTestCase extends TestCase {
lastRunResult = null;
StringBuffer cp = new StringBuffer();
if (classpath != null) {
- cp.append(classpath);
+ // allow replacing this special variable, rather than copying all files to allow tests of jars that don't end in .jar
+ cp.append(substituteSandbox(classpath));
cp.append(File.pathSeparator);
}
cp.append(ajc.getSandboxDirectory().getAbsolutePath());
@@ -622,6 +623,10 @@ public class AjcTestCase extends TestCase {
}
return lastRunResult;
}
+
+ private String substituteSandbox(String classpath) {
+ return classpath.replace("$sandbox", ajc.getSandboxDirectory().getAbsolutePath());
+ }
/**
* Any central pre-processing of args.
@@ -639,6 +644,7 @@ public class AjcTestCase extends TestCase {
args[i] = adaptToPlatform(args[i]);
if ("-classpath".equals(args[i])) {
cpIndex = i;
+ args[i+1] = substituteSandbox(args[i+1]);
String next = args[i+1];
hasruntime = ((null != next)
&& (-1 != next.indexOf("aspectjrt.jar")));
diff --git a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
index 86434732f..19b440f55 100644
--- a/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
+++ b/taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java
@@ -1106,12 +1106,8 @@ public class AjcTask extends MatchingTask {
|| (null != inpathDirCopyFilter)) {
String path = outjar.getAbsolutePath();
int len = FileUtil.zipSuffixLength(path);
- if (len < 1) {
- this.logger.info("not copying resources - weird outjar: " + path);
- } else {
- path = path.substring(0, path.length()-len) + ".tmp.jar";
- tmpOutjar = new File(path);
- }
+ path = path.substring(0, path.length()-len) + ".tmp.jar";
+ tmpOutjar = new File(path);
}
if (null == tmpOutjar) {
cmd.addFlagged("-outjar", outjar.getAbsolutePath());
diff --git a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java
index 1545d52b2..788422bd9 100644
--- a/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java
+++ b/taskdefs/testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java
@@ -359,13 +359,22 @@ public class AjcTaskTest extends TestCase {
}
public void testInpathDirCopyFilterWithJar() throws IOException {
+ checkInpathCopy("testInpathDirCopyFilterWithJar-out.jar");
+ }
+
+ // test resource copying for oddball jar files that don't end in .jar
+ public void testInpathDirCopyFilterWithOddjar() throws IOException {
+ checkInpathCopy("testInpathDirCopyFilterWithJar-outJarFile");
+ }
+
+ private void checkInpathCopy(String outjarFileStr) throws IOException {
// inpathDirCopyFilter works with output jar
File destDir = getTempDir();
assertTrue(
"unable to create " + destDir,
destDir.canRead() || destDir.mkdirs());
AjcTask task = getTask(NOFILE, null);
- File destJar = new File(destDir, "testInpathDirCopyFilterWithJar-out.jar");
+ File destJar = new File(destDir, outjarFileStr);
task.setOutjar(destJar);
Project p = task.getProject();
Path indirs = new Path(p);
diff --git a/testing/newsrc/org/aspectj/testing/CompileSpec.java b/testing/newsrc/org/aspectj/testing/CompileSpec.java
index 6b98a6822..0d4d230eb 100644
--- a/testing/newsrc/org/aspectj/testing/CompileSpec.java
+++ b/testing/newsrc/org/aspectj/testing/CompileSpec.java
@@ -134,8 +134,7 @@ public class CompileSpec implements ITestStep {
* @param inpath The inpath to set.
*/
public void setInpath(String inpath) {
- this.inpath = inpath.replace(',',File.pathSeparatorChar);
- this.inpath = inpath.replace(';',File.pathSeparatorChar);
+ this.inpath = inpath.replace(',',File.pathSeparatorChar).replace(';',File.pathSeparatorChar);
}
/**
* @return Returns the options.
diff --git a/testing/newsrc/org/aspectj/testing/RunSpec.java b/testing/newsrc/org/aspectj/testing/RunSpec.java
index b879c95a2..485012104 100644
--- a/testing/newsrc/org/aspectj/testing/RunSpec.java
+++ b/testing/newsrc/org/aspectj/testing/RunSpec.java
@@ -14,7 +14,9 @@ package org.aspectj.testing;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Enumeration;
import java.util.List;
+import java.util.Properties;
import java.util.StringTokenizer;
import org.aspectj.tools.ajc.AjcTestCase;
@@ -53,12 +55,49 @@ public class RunSpec implements ITestStep {
// System.err.println("? execute() inTestCase='" + inTestCase + "', ltwFile=" + ltwFile);
boolean useLtw = copyLtwFile(inTestCase.getSandboxDirectory());
copyXlintFile(inTestCase.getSandboxDirectory());
- AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(),args,getClasspath(),useLtw);
- if (stdErrSpec != null) {
- stdErrSpec.matchAgainst(rr.getStdErr());
+ try {
+ setSystemProperty("test.base.dir", inTestCase.getSandboxDirectory().getAbsolutePath());
+
+ AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(),args,getClasspath(),useLtw);
+
+ if (stdErrSpec != null) {
+ stdErrSpec.matchAgainst(rr.getStdErr());
+ }
+ if (stdOutSpec != null) {
+ stdOutSpec.matchAgainst(rr.getStdOut());
+ }
+ } finally {
+ restoreProperties();
}
- if (stdOutSpec != null) {
- stdOutSpec.matchAgainst(rr.getStdOut());
+ }
+
+ /*
+ * Logic to save/restore system properties. Copied from LTWTests.
+ * As Matthew noted, need to refactor LTWTests to use this
+ */
+
+ private Properties savedProperties = new Properties();
+
+ public void setSystemProperty (String key, String value) {
+ Properties systemProperties = System.getProperties();
+ copyProperty(key,systemProperties,savedProperties);
+ systemProperties.setProperty(key,value);
+ }
+
+ private static void copyProperty (String key, Properties from, Properties to) {
+ String value = from.getProperty(key,NULL);
+ to.setProperty(key,value);
+ }
+
+ private final static String NULL = "null";
+
+ protected void restoreProperties() {
+ Properties systemProperties = System.getProperties();
+ for (Enumeration enu = savedProperties.keys(); enu.hasMoreElements(); ) {
+ String key = (String)enu.nextElement();
+ String value = savedProperties.getProperty(key);
+ if (value == NULL) systemProperties.remove(key);
+ else systemProperties.setProperty(key,value);
}
}
@@ -84,7 +123,7 @@ public class RunSpec implements ITestStep {
public String getClasspath() {
if (cpath == null) return null;
- return this.cpath.replace('/', File.separatorChar);
+ return this.cpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar);
}
public void setClasspath(String cpath) {
diff --git a/testing/src/org/aspectj/testing/harness/bridge/Sandbox.java b/testing/src/org/aspectj/testing/harness/bridge/Sandbox.java
index 9388cf84e..c72d09285 100644
--- a/testing/src/org/aspectj/testing/harness/bridge/Sandbox.java
+++ b/testing/src/org/aspectj/testing/harness/bridge/Sandbox.java
@@ -510,7 +510,7 @@ public class Sandbox {
int len = (null == paths ? 0 : paths.length);
for (int j = 0; j < len; j++) {
File f = paths[j];
- if (FileUtil.hasZipSuffix(f) && (!readable || f.canRead())) {
+ if (FileUtil.isZipFile(f) && (!readable || f.canRead())) {
result.add(f);
}
}
diff --git a/tests/bugs152/pr137235/directory.jar/Before.java b/tests/bugs152/pr137235/directory.jar/Before.java
new file mode 100644
index 000000000..cf2f1b4cb
--- /dev/null
+++ b/tests/bugs152/pr137235/directory.jar/Before.java
@@ -0,0 +1,5 @@
+public aspect Before {
+ before() : call(* getName()) {
+ System.out.println("Before call");
+ }
+}
diff --git a/tests/bugs152/pr137235/directory.jar/BeforeExec.aj b/tests/bugs152/pr137235/directory.jar/BeforeExec.aj
new file mode 100644
index 000000000..35d12cd86
--- /dev/null
+++ b/tests/bugs152/pr137235/directory.jar/BeforeExec.aj
@@ -0,0 +1,5 @@
+public aspect BeforeExec {
+ before() : execution(* getName()) {
+ System.out.println("Before execution");
+ }
+}
diff --git a/tests/bugs152/pr137235/directory.jar/Hello.java b/tests/bugs152/pr137235/directory.jar/Hello.java
new file mode 100644
index 000000000..30008d603
--- /dev/null
+++ b/tests/bugs152/pr137235/directory.jar/Hello.java
@@ -0,0 +1,6 @@
+public class Hello {
+ public static void main(String argz[]) {
+ System.out.println("Hello "+getName());
+ }
+ public static String getName() { return "Java"; }
+}
diff --git a/tests/bugs152/pr137235/directory.jar/Rename.aj b/tests/bugs152/pr137235/directory.jar/Rename.aj
new file mode 100644
index 000000000..fb89dfca5
--- /dev/null
+++ b/tests/bugs152/pr137235/directory.jar/Rename.aj
@@ -0,0 +1,5 @@
+public aspect Rename {
+ String around() : call(* getName()) {
+ return "AspectJ not just "+proceed();
+ }
+}
diff --git a/tests/ltw/folder.jar/Aspect1.aj b/tests/ltw/folder.jar/Aspect1.aj
new file mode 100644
index 000000000..173cb8603
--- /dev/null
+++ b/tests/ltw/folder.jar/Aspect1.aj
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ *******************************************************************************/
+import org.aspectj.lang.JoinPoint;
+
+public aspect Aspect1 {
+
+ before () : execution(void Main.test1()) {
+ System.err.println("Aspect1.before_" + thisJoinPoint.getSignature().getName());
+ }
+}
diff --git a/tests/ltw/folder.jar/Aspect2.aj b/tests/ltw/folder.jar/Aspect2.aj
new file mode 100644
index 000000000..519a47eeb
--- /dev/null
+++ b/tests/ltw/folder.jar/Aspect2.aj
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ *******************************************************************************/
+import org.aspectj.lang.JoinPoint;
+
+public aspect Aspect2 {
+
+ before () : execution(void Main.test2()){
+ System.err.println("Aspect2.before_" + thisJoinPoint.getSignature().getName());
+ }
+}
diff --git a/tests/ltw/folder.jar/Main.java b/tests/ltw/folder.jar/Main.java
new file mode 100644
index 000000000..9e53bfb4d
--- /dev/null
+++ b/tests/ltw/folder.jar/Main.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Matthew Webster initial implementation
+ *******************************************************************************/
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+
+public class Main {
+
+ public void test1 () {
+ System.out.println("Main.test1");
+ }
+
+ public void test2 () {
+ System.out.println("Main.test2");
+ }
+
+ public void invokeDeclaredMethods () throws Exception {
+ Method[] methods = getClass().getDeclaredMethods();
+ for (int i = 0; i < methods.length; i++) {
+ Method method = methods[i];
+ int modifiers = method.getModifiers();
+ if (!Modifier.isStatic(modifiers) && !method.getName().equals("invokeDeclaredMethods")) {
+ method.invoke(this,new Object[] {});
+ }
+ }
+ }
+
+ public static void main (String[] args) throws Exception {
+ System.out.println("Main.main");
+ new Main().test1();
+ new Main().test2();
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml b/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
index 096a7daa9..80c234fda 100644
--- a/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
+++ b/tests/src/org/aspectj/systemtest/ajc120/ajc120-tests.xml
@@ -467,13 +467,16 @@
<ajc-test dir="bugs" pr="43714"
title="weaving using an empty jar in -injars" >
<compile files="notAJar.jar" outjar="outJar.jar">
- <message kind="error" line="0"/>
+ <message kind="warning" text="build config error: skipping missing, empty or corrupt inpath entry"/>
+ <message kind="error" text="no sources specified"/>
+ <message kind="fail"/>
</compile>
</ajc-test>
<ajc-test dir="bugs" pr="43714"
title="weaving using an empty jar in -aspectpath" >
<compile files="WeaveLocal.java" aspectpath="notAJar.jar" outjar="outJar.jar" >
+ <message kind="warning" text="build config error: skipping missing, empty or corrupt aspectpath entry"/>
</compile>
</ajc-test>
\ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java
index 57ca49810..6516af53d 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/LTWTests.java
@@ -89,6 +89,25 @@ public class LTWTests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("Override suppressing of warning when advice doesn't match using -Xlint:warning");
}
+ public void testNonstandardJarFiles() {
+ runTest("Nonstandard jar file extensions");
+ }
+
+ public void testOddzipOnClasspath() {
+ runTest("Odd zip on classpath");
+ }
+
+ // separate bugzilla patch has this one... commented out
+// public void testSeparateCompilationDeclareParentsCall() {
+// runTest("Separate compilation with ltw: declare parents and call");
+// }
+//
+// public void testChildAspectDoesntWeaveParentDeclareParentsCall() {
+// setSystemProperty(WeavingAdaptor.WEAVING_ADAPTOR_VERBOSE,"true");
+// setSystemProperty(WeavingAdaptor.SHOW_WEAVE_INFO_PROPERTY,"true");
+// runTest("Child loader aspect won't weave parent loader: declare parents and call");
+// }
+
/*
* Allow system properties to be set and restored
* TODO maw move to XMLBasedAjcTestCase or RunSpec
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml
index 8e6233fca..f56e49925 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ltw/ltw-tests.xml
@@ -1,6 +1,5 @@
<!-- Load-time weaving tests -->
-
<ajc-test dir="ltw"
title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
keywords="reweavable">
@@ -339,4 +338,133 @@
</stderr>
</run>
</ajc-test>
+
+ <!-- based on "Ensure 1st aspect is rewoven when weaving 2nd aspect" -->
+ <ajc-test dir="ltw"
+ title="Nonstandard jar file extensions" pr="137235">
+ <compile
+ files="folder.jar/Main.java, folder.jar/Aspect1.aj"
+ outjar="folder.jar/main1.zip"
+ options="-showWeaveInfo"
+ >
+ <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
+ </compile>
+ <compile
+ classpath="$sandbox/folder.jar/main1.zip"
+ files="Aspect2.aj"
+ outjar="aspect2Jar"
+ options="-showWeaveInfo"
+ >
+ </compile>
+ <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.zip,$sandbox/aspect2Jar">
+ <stdout>
+ <line text="Main.main"/>
+ <line text="Main.test1"/>
+ <line text="Main.test2"/>
+ </stdout>
+ <stderr>
+ <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
+ <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
+ <line text="Aspect1.before_test1"/>
+ <line text="Aspect2.before_test2"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="ltw"
+ title="Odd zip on classpath" pr="137235">
+ <compile
+ files="folder.jar/Main.java, folder.jar/Aspect1.aj"
+ outjar="folder.jar/main1.archive"
+ options="-showWeaveInfo"
+ >
+ <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
+ </compile>
+ <compile
+ classpath="$sandbox/folder.jar/main1.archive"
+ files="Aspect2.aj"
+ outjar="aspect2Jar"
+ options="-showWeaveInfo"
+ >
+ </compile>
+ <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.archive,$sandbox/aspect2Jar">
+ <stdout>
+ <line text="Main.main"/>
+ <line text="Main.test1"/>
+ <line text="Main.test2"/>
+ </stdout>
+ <stderr>
+ <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
+ <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
+ <line text="Aspect1.before_test1"/>
+ <line text="Aspect2.before_test2"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+<!--
+commented out: reported in another bugzilla bug...
+
+ <ajc-test dir="ltw/hier"
+ title="Separate compilation with ltw: declare parents and call"
+ keywords="ltw">
+ <compile
+ files="util/A.aj,util/T.aj"
+ />
+ <compile
+ files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj"
+ >
+ <message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
+ </compile>
+ <run class="top.SimpleMain" ltw="aop-single.xml">
+ <stdout>
+ <line text="T call"/>
+ </stdout>
+ <stderr>
+ <line text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)"/>
+ < - - TODO: fix up any errors in the expected output when the join point actually matches - - >
+ <line text="weaveinfo Join point 'method-call(void A.foo())' in Type 'child.Executor' (Executor.aj:19) advised by before advice from 'child.Advisor' (Advisor.aj:20)"/>
+ </stderr>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="ltw/hier"
+ title="Child loader aspect won't weave parent loader: declare parents and call"
+ keywords="ltw">
+ <compile
+ files="top/HierMain.aj"
+ />
+ <compile
+ files="util/A.aj,util/T.aj"
+ outjar="util.jar"
+ />
+ <compile
+ files="child/Executor.aj,child/Advisor.aj"
+ classpath="util.jar"
+ options="-outxml"
+ outjar="child.zip"
+ >
+ <message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
+ </compile>
+ < - - limitation: to turn on load-time weaving we HAVE to have a top-level aop.xml file
+ since we don't want any top-level aspects, we deploy an empty one!
+ the important aop.xml file in this test was created with -outxml and lives in child.jar - - >
+ <run class="top.HierMain" ltw="null-aop.xml">
+ <stdout/>
+ <stderr>
+ <line text="info AspectJ Weaver Version"/>
+ <line text="info register classloader"/>
+ <line text="info using"/>
+ <line text="info weaving 'top.HierMain'"/>
+ <line text="info AspectJ Weaver Version"/>
+ <line text="info register classloader"/>
+ <line text="info using"/>
+ <line text="info using file:"/>
+ <line text="info register aspect child.Advisor"/>
+ <line text="info weaving 'child.Executor'"/>
+ <line text="info weaving 'util.A'"/>
+ </stderr>
+ </run>
+ </ajc-test>
+-->
diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
index 0cd43ed2d..362d107a5 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
@@ -45,6 +45,8 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
// this next one reported as a bug by Rob Harrop, but I can't reproduce the failure yet...
//public void testAtAspectWithReferencePCPerClause_pr138220() { runTest("@Aspect with reference pointcut in perclause");}
+ public void testJarChecking_pr137235_1() { runTest("directory with .jar extension: source and outjar"); }
+ public void testJarChecking_pr137235_2() { runTest("directory with .jar extension"); }
/////////////////////////////////////////
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Ajc152Tests.class);
diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
index 600c318ae..9e193b67e 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
+++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
@@ -197,4 +197,30 @@
</compile>
<run class="a.b.c.AroundAdvicePassingPjpAsArgToSuper"/>
</ajc-test>
+
+ <ajc-test dir="bugs152/pr137235" pr="137235"
+ title="directory with .jar extension: source and outjar">
+ <compile files="directory.jar/Hello.java" outjar="directory.jar/run.custom"/>
+ <run class="Hello" classpath="$sandbox/directory.jar/run.custom">
+ <stdout>
+ <line text="Hello Java"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr137235" pr="137235"
+ title="directory with .jar extension" >
+ <compile files="directory.jar/Before.java" outjar="directory.jar/inOne.custom"/>
+ <compile files="directory.jar/BeforeExec.aj" outjar="directory.jar/inTwo"/>
+ <compile files="directory.jar/Rename.aj" outjar="directory.jar/weave.jar"/>
+ <compile files="directory.jar/Hello.java" inpath="directory.jar/inOne.custom,directory.jar/inTwo" aspectpath="directory.jar/weave.jar" outjar="directory.jar/outJar.jar"/>
+ <run class="Hello" classpath="$sandbox/directory.jar/outJar.jar,$sandbox/directory.jar/weave.jar">
+ <stdout>
+ <line text="Before call"/>
+ <line text="Before execution"/>
+ <line text="Hello AspectJ not just Java"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
</suite> \ No newline at end of file
diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java
index a0f0a9021..b3fb3742d 100644
--- a/util/src/org/aspectj/util/FileUtil.java
+++ b/util/src/org/aspectj/util/FileUtil.java
@@ -17,7 +17,6 @@ import java.io.*;
import java.net.*;
import java.util.*;
import java.util.zip.*;
-import java.util.zip.ZipFile;
/**
@@ -33,7 +32,7 @@ public class FileUtil {
public static final FileFilter ZIP_FILTER = new FileFilter() {
public boolean accept(File file) {
- return hasZipSuffix(file);
+ return isZipFile(file);
}
public String toString() {
return "ZIP_FILTER";
@@ -70,15 +69,19 @@ public class FileUtil {
PERMIT_CVS = LangUtil.getBoolean(name, false);
}
- /** @return true if file path has a zip/jar suffix */
- public static boolean hasZipSuffix(File file) {
- return ((null != file) && hasZipSuffix(file.getPath()));
+ /** @return true if file exists and is a zip file */
+ public static boolean isZipFile(File file) {
+ try {
+ return (null != file) && new ZipFile(file) != null;
+ } catch (IOException e) {
+ return false;
+ }
}
/** @return true if path ends with .zip or .jar */
- public static boolean hasZipSuffix(String path) {
- return ((null != path) && (0 != zipSuffixLength(path)));
- }
+// public static boolean hasZipSuffix(String path) {
+// return ((null != path) && (0 != zipSuffixLength(path)));
+// }
/** @return 0 if file has no zip/jar suffix or 4 otherwise */
public static int zipSuffixLength(File file) {
diff --git a/util/src/org/aspectj/util/Reflection.java b/util/src/org/aspectj/util/Reflection.java
index 10bcc1583..3610eb7f4 100644
--- a/util/src/org/aspectj/util/Reflection.java
+++ b/util/src/org/aspectj/util/Reflection.java
@@ -136,7 +136,7 @@ public class Reflection {
// if (!file.canRead()) {
// throw new IllegalArgumentException("cannot read " + file);
// }
- if (FileUtil.hasZipSuffix(file)) {
+ if (FileUtil.isZipFile(file)) {
libs.add(file);
} else if (file.isDirectory()) {
dirs.add(file);
diff --git a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java b/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
index 2b3b120e3..6876d0a50 100644
--- a/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
+++ b/weaver/src/org/aspectj/weaver/bcel/ClassPathManager.java
@@ -65,22 +65,23 @@ public class ClassPathManager {
public void addPath (String name, IMessageHandler handler) {
File f = new File(name);
String lc = name.toLowerCase();
- if (lc.endsWith(".jar") || lc.endsWith(".zip")) {
+ if (!f.isDirectory()) {
if (!f.isFile()) {
- MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_MISSING,name));
- return;
+ if (!lc.endsWith(".jar") || lc.endsWith(".zip")) {
+ // heuristic-only: ending with .jar or .zip means probably a zip file
+ MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_MISSING,name));
+ } else {
+ MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.DIRECTORY_ENTRY_MISSING,name));
+ }
+ return;
}
try {
entries.add(new ZipFileEntry(f));
} catch (IOException ioe) {
- MessageUtil.warn(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_INVALID,name,ioe.getMessage()));
- return;
+ MessageUtil.warn(handler, WeaverMessages.format(WeaverMessages.ZIPFILE_ENTRY_INVALID,name,ioe.getMessage()));
+ return;
}
} else {
- if (!f.isDirectory()) {
- MessageUtil.info(handler, WeaverMessages.format(WeaverMessages.DIRECTORY_ENTRY_MISSING,name));
- return;
- }
entries.add(new DirEntry(f));
}
}
diff --git a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
index 75ffc5de6..ff280aab9 100644
--- a/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
+++ b/weaver/src/org/aspectj/weaver/tools/WeavingAdaptor.java
@@ -317,8 +317,7 @@ public class WeavingAdaptor {
private void addAspectLibrary(String aspectLibraryName) {
File aspectLibrary = new File(aspectLibraryName);
if (aspectLibrary.isDirectory()
- || (aspectLibrary.isFile()
- && FileUtil.hasZipSuffix(aspectLibraryName))) {
+ || (FileUtil.isZipFile(aspectLibrary))) {
try {
info("adding aspect library: '" + aspectLibrary + "'");
weaver.addLibraryJarFile(aspectLibrary);
diff --git a/weaver/testdata/WeavingURLClassLoaderTest/builtLibs/aspectNoExt b/weaver/testdata/WeavingURLClassLoaderTest/builtLibs/aspectNoExt
new file mode 100644
index 000000000..77469d6f0
--- /dev/null
+++ b/weaver/testdata/WeavingURLClassLoaderTest/builtLibs/aspectNoExt
Binary files differ
diff --git a/weaver/testdata/WeavingURLClassLoaderTest/builtLibs/test.jar/main.file b/weaver/testdata/WeavingURLClassLoaderTest/builtLibs/test.jar/main.file
new file mode 100644
index 000000000..e0204709e
--- /dev/null
+++ b/weaver/testdata/WeavingURLClassLoaderTest/builtLibs/test.jar/main.file
Binary files differ