From: jhugunin Date: Mon, 12 Jan 2004 11:37:20 +0000 (+0000) Subject: Fix for: Bugzilla Bug 49814 X-Git-Tag: mostlyLastEclipse2xTree_20040112~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a4a12342a16145ee4ac835c77827d8e16f6078cb;p=aspectj.git Fix for: Bugzilla Bug 49814 ConfigParser.java:132 --- 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 fa541febf..3ad2a7166 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 @@ -18,6 +18,8 @@ import java.util.*; import junit.framework.TestCase; import org.aspectj.ajdt.internal.core.builder.*; +import org.aspectj.bridge.CountingMessageHandler; +import org.aspectj.bridge.IMessage; import org.aspectj.bridge.MessageWriter; import org.aspectj.testing.util.TestUtil; import org.eclipse.jdt.core.compiler.InvalidInputException; @@ -147,6 +149,12 @@ public class BuildArgParserTestCase extends TestCase { assertTrue("size: " + config.getInJars().size(), config.getInJars().size() == 1); } + public void testBadPathToSourceFiles() { + CountingMessageHandler countingHandler = new CountingMessageHandler(messageWriter); + AjBuildConfig config = parser.genBuildConfig(new String[]{ "inventedDir/doesntexist/*.java"},countingHandler); + assertTrue("Expected an error for the invalid path.",countingHandler.numMessages(IMessage.ERROR,false)==1); + } + public void testMultipleSourceRoots() throws InvalidInputException, IOException { final String SRCROOT_1 = AjdtAjcTests.TESTDATA_PATH + "/src1/p1"; final String SRCROOT_2 = AjdtAjcTests.TESTDATA_PATH + "/ajc"; diff --git a/util/src/org/aspectj/util/ConfigParser.java b/util/src/org/aspectj/util/ConfigParser.java index 36ed31edc..59ce90b94 100644 --- a/util/src/org/aspectj/util/ConfigParser.java +++ b/util/src/org/aspectj/util/ConfigParser.java @@ -126,15 +126,16 @@ public class ConfigParser { if (!dir.isDirectory()) { showError("can't find " + dir.getPath()); - } + } else { - File[] files = dir.listFiles(filter); - if (files.length == 0) { + File[] files = dir.listFiles(filter); + if (files.length == 0) { showWarning("no matching files found in: " + dir); - } + } - for (int i = 0; i < files.length; i++) { + for (int i = 0; i < files.length; i++) { addFile(files[i]); + } } }