From 5a01932b9dbdf81fe41e029fa56ede17364a2c2e Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 4 May 2006 07:14:47 +0000 Subject: fixes for 137235 (contributed by Ron): more intelligent logic for determining if a path entry is a jar/zip (don't just rely on suffix, some new .bndl files seem to be becoming popular...) --- taskdefs/src/org/aspectj/tools/ant/taskdefs/AjcTask.java | 8 ++------ .../testsrc/org/aspectj/tools/ant/taskdefs/AjcTaskTest.java | 11 ++++++++++- 2 files changed, 12 insertions(+), 7 deletions(-) (limited to 'taskdefs') 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); -- cgit v1.2.3