Repository: ant Updated Branches: refs/heads/master e2dd6ec79 -> ec70921a9
Revert a regression, improve tests Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/ec70921a Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/ec70921a Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/ec70921a Branch: refs/heads/master Commit: ec70921a964be0c38fbceff8a01c16bcad9ebd40 Parents: e2dd6ec Author: Gintas Grigelionis <gin...@apache.org> Authored: Sun Nov 4 10:23:51 2018 +0100 Committer: Gintas Grigelionis <gin...@apache.org> Committed: Sun Nov 4 10:23:51 2018 +0100 ---------------------------------------------------------------------- src/main/org/apache/tools/ant/taskdefs/Java.java | 9 ++++----- src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/ec70921a/src/main/org/apache/tools/ant/taskdefs/Java.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java index 5600027..58fcffb 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -56,9 +56,6 @@ public class Java extends Task { private static final String WRONG_ATTRIBUTES_MESSAGE = "Cannot use combination of 'classname', 'jar', 'module', 'sourcefile' attributes in same command"; - private static final String WRONG_CLASSNAME_ATTRIBUTES_MESSAGE = - "Cannot use combination of 'classname', 'jar', 'sourcefile' attributes in same command"; - private CommandlineJava cmdl = new CommandlineJava(); private Environment env = new Environment(); private boolean fork = false; @@ -385,7 +382,8 @@ public class Java extends Task { */ public void setClassname(String s) throws BuildException { if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) { - throw new BuildException(WRONG_CLASSNAME_ATTRIBUTES_MESSAGE); + throw new BuildException( + "Cannot use combination of 'classname', 'jar', 'sourcefile' attributes in same command"); } getCommandLine().setClassname(s); } @@ -400,7 +398,8 @@ public class Java extends Task { */ public void setModule(String module) throws BuildException { if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) { - throw new BuildException(WRONG_CLASSNAME_ATTRIBUTES_MESSAGE); + throw new BuildException( + "Cannot use combination of 'jar', 'module', 'sourcefile' attributes in same command"); } getCommandLine().setModule(module); } http://git-wip-us.apache.org/repos/asf/ant/blob/ec70921a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java index 1406600..c661a0d 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java @@ -108,28 +108,28 @@ public class JavaTest { @Test public void testJarAndClassName() { thrown.expect(BuildException.class); - thrown.expectMessage("Cannot use combination of "); + thrown.expectMessage("Cannot use combination of 'classname', 'jar', 'sourcefile'"); buildRule.executeTarget("testJarAndClassName"); } @Test public void testClassnameAndJar() { thrown.expect(BuildException.class); - thrown.expectMessage("Cannot use combination of "); + thrown.expectMessage("Cannot use combination of 'classname', 'jar', 'module'"); buildRule.executeTarget("testClassnameAndJar"); } @Test public void testJarAndModule() { thrown.expect(BuildException.class); - thrown.expectMessage("Cannot use combination of "); + thrown.expectMessage("Cannot use combination of 'jar', 'module', 'sourcefile'"); buildRule.executeTarget("testJarAndModule"); } @Test public void testModuleAndJar() { thrown.expect(BuildException.class); - thrown.expectMessage("Cannot use combination of "); + thrown.expectMessage("Cannot use combination of 'classname', 'jar', 'module'"); buildRule.executeTarget("testModuleAndJar"); }