Repository: ant Updated Branches: refs/heads/master 6c860479a -> e2dd6ec79
Checkstyle: dangling operators Project: http://git-wip-us.apache.org/repos/asf/ant/repo Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/2977bb59 Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/2977bb59 Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/2977bb59 Branch: refs/heads/master Commit: 2977bb596c7f8f0b3f81258d04d1c1ef0b3848b7 Parents: 6c86047 Author: Gintas Grigelionis <gin...@apache.org> Authored: Sun Nov 4 10:01:43 2018 +0100 Committer: Gintas Grigelionis <gin...@apache.org> Committed: Sun Nov 4 10:01:43 2018 +0100 ---------------------------------------------------------------------- .../org/apache/tools/ant/AntClassLoader.java | 6 +-- .../org/apache/tools/ant/DirectoryScanner.java | 4 +- src/main/org/apache/tools/ant/Main.java | 6 +-- .../apache/tools/ant/helper/ProjectHelper2.java | 6 +-- .../org/apache/tools/ant/taskdefs/Delete.java | 8 +-- .../org/apache/tools/ant/taskdefs/Java.java | 24 ++++----- .../tools/ant/taskdefs/email/MimeMailer.java | 3 +- .../optional/javah/JavahAdapterFactory.java | 8 +-- .../ant/taskdefs/optional/junit/JUnitTask.java | 11 ++-- .../optional/junitlauncher/LauncherSupport.java | 13 +++-- .../confined/JUnitLauncherTask.java | 8 +-- .../taskdefs/optional/net/FTPConfigurator.java | 4 +- .../ant/taskdefs/optional/unix/Symlink.java | 10 ++-- .../ant/taskdefs/rmic/DefaultRmicAdapter.java | 7 ++- src/main/org/apache/tools/tar/TarUtils.java | 4 +- .../ant/taskdefs/ExecStreamRedirectorTest.java | 4 +- .../junitlauncher/JUnitLauncherTaskTest.java | 53 ++++++++++++-------- .../apache/tools/ant/types/XMLCatalogTest.java | 9 ++-- .../ant/util/regexp/RegexpMatcherTest.java | 8 +-- 19 files changed, 98 insertions(+), 98 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/AntClassLoader.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/AntClassLoader.java b/src/main/org/apache/tools/ant/AntClassLoader.java index db4df96..bf5bffc 100644 --- a/src/main/org/apache/tools/ant/AntClassLoader.java +++ b/src/main/org/apache/tools/ant/AntClassLoader.java @@ -127,7 +127,7 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo * enumeration; <code>false</code> otherwise. */ public boolean hasMoreElements() { - return (this.nextResource != null); + return this.nextResource != null; } /** @@ -369,8 +369,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo } catch (final BuildException e) { // ignore path elements which are invalid // relative to the project - log("Ignoring path element " + pathElement + " from " + - "classpath due to exception " + e, Project.MSG_DEBUG); + log("Ignoring path element " + pathElement + " from " + + "classpath due to exception " + e, Project.MSG_DEBUG); } } } http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/DirectoryScanner.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/DirectoryScanner.java b/src/main/org/apache/tools/ant/DirectoryScanner.java index 289239b..295079b 100644 --- a/src/main/org/apache/tools/ant/DirectoryScanner.java +++ b/src/main/org/apache/tools/ant/DirectoryScanner.java @@ -1245,8 +1245,8 @@ public class DirectoryScanner continue; } } catch (IOException e) { - System.err.println("Failed to determine if " + file + " causes a " + - "filesystem loop due to symbolic link; continuing"); + System.err.println("Failed to determine if " + file + " causes a " + + "filesystem loop due to symbolic link; continuing"); } final String[] children = file.list(); http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/Main.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java index 4e078e0..5dd4f68 100644 --- a/src/main/org/apache/tools/ant/Main.java +++ b/src/main/org/apache/tools/ant/Main.java @@ -1066,10 +1066,8 @@ public class Main implements AntMain { props.load(in); in.close(); shortAntVersion = props.getProperty("VERSION"); - antVersion = "Apache Ant(TM) version " + - shortAntVersion + - " compiled on " + - props.getProperty("DATE"); + antVersion = "Apache Ant(TM) version " + shortAntVersion + + " compiled on " + props.getProperty("DATE"); } catch (final IOException ioe) { throw new BuildException("Could not load the version information:" + ioe.getMessage()); http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/helper/ProjectHelper2.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java index 22ebee0..42f2b36 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java @@ -1019,10 +1019,8 @@ public class ProjectHelper2 extends ProjectHelper { project.addOrReplaceTarget(newName, newTarget); } if (extensionPointMissing != null && extensionPoint == null) { - throw new BuildException("onMissingExtensionPoint attribute cannot " + - "be specified unless extensionOf is specified", - target.getLocation()); - + throw new BuildException("onMissingExtensionPoint attribute cannot " + + "be specified unless extensionOf is specified", target.getLocation()); } if (extensionPoint != null) { ProjectHelper helper = http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/Delete.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java index bf810e8..35fb993 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -819,12 +819,12 @@ public class Delete extends MatchingTask { boolean isFsLoop = false; try { - isFsLoop = Files.isSymbolicLink(f.toPath()) && - FileUtils.getFileUtils().isLeadingPath(f.getAbsoluteFile(), + isFsLoop = Files.isSymbolicLink(f.toPath()) + && FileUtils.getFileUtils().isLeadingPath(f.getAbsoluteFile(), d.getAbsoluteFile(), true); } catch (IOException e) { - log("Failed to check if " + f + " causes a filesystem loop due to " + - "symbolic link; continuing"); + log("Failed to check if " + f + " causes a filesystem loop due to " + + "symbolic link; continuing"); } if (f.isDirectory() && !isFsLoop) { http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/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 6e3e54d..5600027 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -53,6 +53,12 @@ public class Java extends Task { private static final String TIMEOUT_MESSAGE = "Timeout: killed the sub-process"; + 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; @@ -365,8 +371,7 @@ public class Java extends Task { public void setJar(File jarfile) throws BuildException { if (getCommandLine().getClassname() != null || getCommandLine().getModule() != null || getCommandLine().getSourceFile() != null) { - throw new BuildException( - "Cannot use combination of 'jar', 'sourcefile', 'classname', 'module' attributes in same command"); + throw new BuildException(WRONG_ATTRIBUTES_MESSAGE); } getCommandLine().setJar(jarfile.getAbsolutePath()); } @@ -380,8 +385,7 @@ public class Java extends Task { */ public void setClassname(String s) throws BuildException { if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) { - throw new BuildException( - "Cannot use combination of 'jar', 'classname', sourcefile attributes in same command"); + throw new BuildException(WRONG_CLASSNAME_ATTRIBUTES_MESSAGE); } getCommandLine().setClassname(s); } @@ -396,8 +400,7 @@ public class Java extends Task { */ public void setModule(String module) throws BuildException { if (getCommandLine().getJar() != null || getCommandLine().getSourceFile() != null) { - throw new BuildException( - "Cannot use combination of 'jar', 'module', sourcefile attributes in same command"); + throw new BuildException(WRONG_CLASSNAME_ATTRIBUTES_MESSAGE); } getCommandLine().setModule(module); } @@ -412,12 +415,9 @@ public class Java extends Task { * @since Ant 1.10.5 */ public void setSourceFile(final String sourceFile) throws BuildException { - final String jar = getCommandLine().getJar(); - final String className = getCommandLine().getClassname(); - final String module = getCommandLine().getModule(); - if (jar != null || className != null || module != null) { - throw new BuildException("Cannot use 'sourcefile' in combination with 'jar' or " + - "'module' or 'classname'"); + if (getCommandLine().getClassname() != null || getCommandLine().getJar() != null + || getCommandLine().getModule() != null) { + throw new BuildException(WRONG_ATTRIBUTES_MESSAGE); } getCommandLine().setSourceFile(sourceFile); } http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java b/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java index 7406756..3335490 100644 --- a/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java +++ b/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java @@ -111,8 +111,7 @@ public class MimeMailer extends Mailer { return type; } // Must be like "text/plain; charset=windows-1251" - return (type != null ? type : "text/plain") + - "; charset=" + charset; + return (type != null ? type : "text/plain") + "; charset=" + charset; } @Override http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java b/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java index 931131b..c55fa69 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java @@ -83,15 +83,15 @@ public class JavahAdapterFactory { Path classpath) throws BuildException { if ((JavaEnvUtils.isKaffe() && choice == null) - || Kaffeh.IMPLEMENTATION_NAME.equals(choice)) { + || Kaffeh.IMPLEMENTATION_NAME.equals(choice)) { return new Kaffeh(); } if ((JavaEnvUtils.isGij() && choice == null) - || Gcjh.IMPLEMENTATION_NAME.equals(choice)) { + || Gcjh.IMPLEMENTATION_NAME.equals(choice)) { return new Gcjh(); } - if (JavaEnvUtils.isAtLeastJavaVersion("10") && - (choice == null || ForkingJavah.IMPLEMENTATION_NAME.equals(choice))) { + if (JavaEnvUtils.isAtLeastJavaVersion("10") + && (choice == null || ForkingJavah.IMPLEMENTATION_NAME.equals(choice))) { throw new BuildException("javah does not exist under Java 10 and higher," + " use the javac task with nativeHeaderDir instead"); } http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java index 70c6198..de865ae 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java @@ -2067,8 +2067,7 @@ public class JUnitTask extends Task { */ @Override public boolean equals(final Object other) { - if (other == null - || other.getClass() != ForkedTestConfiguration.class) { + if (other == null || other.getClass() != ForkedTestConfiguration.class) { return false; } final ForkedTestConfiguration o = (ForkedTestConfiguration) other; @@ -2076,13 +2075,9 @@ public class JUnitTask extends Task { && haltOnError == o.haltOnError && haltOnFailure == o.haltOnFailure && ((errorProperty == null && o.errorProperty == null) - || - (errorProperty != null - && errorProperty.equals(o.errorProperty))) + || (errorProperty != null && errorProperty.equals(o.errorProperty))) && ((failureProperty == null && o.failureProperty == null) - || - (failureProperty != null - && failureProperty.equals(o.failureProperty))); + || (failureProperty != null && failureProperty.equals(o.failureProperty))); } /** http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java index e55856a..0e88fa8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java @@ -206,8 +206,8 @@ public class LauncherSupport { final Optional<Project> project = this.testExecutionContext.getProject(); for (final ListenerDefinition applicableListener : applicableListenerElements) { if (project.isPresent() && !applicableListener.shouldUse(project.get())) { - log("Excluding listener " + applicableListener.getClassName() + " since it's not applicable" + - " in the context of project", null, Project.MSG_DEBUG); + log("Excluding listener " + applicableListener.getClassName() + " since it's not applicable" + + " in the context of project", null, Project.MSG_DEBUG); continue; } final TestExecutionListener listener = requireTestExecutionListener(applicableListener, classLoader); @@ -274,7 +274,8 @@ public class LauncherSupport { throw new BuildException("Failed to load listener class " + className, e); } if (!TestExecutionListener.class.isAssignableFrom(klass)) { - throw new BuildException("Listener class " + className + " is not of type " + TestExecutionListener.class.getName()); + throw new BuildException("Listener class " + className + " is not of type " + + TestExecutionListener.class.getName()); } try { return (TestExecutionListener) klass.newInstance(); @@ -308,7 +309,8 @@ public class LauncherSupport { // if the test is configured to halt on test failures, throw a build error final String errorMessage; if (test instanceof NamedTest) { - errorMessage = "Test " + ((NamedTest) test).getName() + " has " + summary.getTestsFailedCount() + " failure(s)"; + errorMessage = "Test " + ((NamedTest) test).getName() + " has " + + summary.getTestsFailedCount() + " failure(s)"; } else { errorMessage = "Some test(s) have failure(s)"; } @@ -366,7 +368,8 @@ public class LauncherSupport { final Thread sysErrStreamer = new Thread(streamer); sysErrStreamer.setDaemon(true); sysErrStreamer.setName("junitlauncher-syserr-stream-reader"); - sysErrStreamer.setUncaughtExceptionHandler((t, e) -> this.log("Failed in syserr streaming", e, Project.MSG_INFO)); + sysErrStreamer.setUncaughtExceptionHandler((t, e) -> this.log("Failed in syserr streaming", + e, Project.MSG_INFO)); sysErrStreamer.start(); break; } http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java index 654211e..12cef49 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/confined/JUnitLauncherTask.java @@ -87,8 +87,8 @@ public class JUnitLauncherTask extends Task { final Project project = getProject(); for (final TestDefinition test : this.tests) { if (!test.shouldRun(project)) { - log("Excluding test " + test + " since it's considered not to run " + - "in context of project " + project, Project.MSG_DEBUG); + log("Excluding test " + test + " since it's considered not to run " + + "in context of project " + project, Project.MSG_DEBUG); continue; } if (test.getForkDefinition() != null) { @@ -214,8 +214,8 @@ public class JUnitLauncherTask extends Task { try { projectPropsPath = dumpProjectProperties(); } catch (IOException e) { - throw new BuildException("Could not create the necessary properties file while forking a process" + - " for a test", e); + throw new BuildException("Could not create the necessary properties file while forking" + + " a process for a test", e); } // --properties <path-to-properties-file> commandlineJava.createArgument().setValue(Constants.ARG_PROPERTIES); http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java index f7650be..cd1c383 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPConfigurator.java @@ -72,8 +72,8 @@ class FTPConfigurator { if (!serverLanguageCodeConfig.isEmpty() && !FTPClientConfig.getSupportedLanguageCodes() .contains(serverLanguageCodeConfig)) { - throw new BuildException("unsupported language code" + - serverLanguageCodeConfig); + throw new BuildException("unsupported language code" + + serverLanguageCodeConfig); } config.setServerLanguageCode(serverLanguageCodeConfig); task.log("custom config: server language code = " http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java index ba74f44..fd7285b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/unix/Symlink.java @@ -198,16 +198,15 @@ public class Symlink extends DispatchTask { public void recreate() throws BuildException { try { if (fileSets.isEmpty()) { - handleError( - "File set identifying link file(s) required for action recreate"); + handleError("File set identifying link file(s) required for action recreate"); return; } final Properties links = loadLinks(fileSets); for (final String lnk : links.stringPropertyNames()) { final String res = links.getProperty(lnk); try { - if (Files.isSymbolicLink(Paths.get(lnk)) && - new File(lnk).getCanonicalPath().equals(new File(res).getCanonicalPath())) { + if (Files.isSymbolicLink(Paths.get(lnk)) + && new File(lnk).getCanonicalPath().equals(new File(res).getCanonicalPath())) { // it's already a symlink and the symlink target is the same // as the target noted in the properties file. So there's no // need to recreate it @@ -216,7 +215,8 @@ public class Symlink extends DispatchTask { continue; } } catch (IOException e) { - final String errMessage = "Failed to check if path " + lnk + " is a symbolic link, linking to " + res; + final String errMessage = "Failed to check if path " + lnk + + " is a symbolic link, linking to " + res; if (failonerror) { throw new BuildException(errMessage, e); } http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java b/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java index b4e8cbf..10ad5a0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java @@ -351,10 +351,9 @@ public abstract class DefaultRmicAdapter implements RmicAdapter { attributes.log("Compilation " + cmd.describeArguments(), Project.MSG_VERBOSE); - String niceSourceList = (compileList.size() == 1 ? "File" : "Files") + - " to be compiled:" + - compileList.stream().peek(arg -> cmd.createArgument().setValue(arg)) - .collect(Collectors.joining(" ")); + String niceSourceList = (compileList.size() == 1 ? "File" : "Files") + " to be compiled:" + + compileList.stream().peek(arg -> cmd.createArgument().setValue(arg)) + .collect(Collectors.joining(" ")); attributes.log(niceSourceList, Project.MSG_VERBOSE); } http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/main/org/apache/tools/tar/TarUtils.java ---------------------------------------------------------------------- diff --git a/src/main/org/apache/tools/tar/TarUtils.java b/src/main/org/apache/tools/tar/TarUtils.java index fcb1127..34a8b8f 100644 --- a/src/main/org/apache/tools/tar/TarUtils.java +++ b/src/main/org/apache/tools/tar/TarUtils.java @@ -493,8 +493,8 @@ public class TarUtils { final long max = 1L << bits; long val = Math.abs(value); if (val >= max) { - throw new IllegalArgumentException("Value " + value + - " is too large for " + length + " byte field."); + throw new IllegalArgumentException("Value " + value + + " is too large for " + length + " byte field."); } if (negative) { val ^= max - 1; http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java index f69e6e2..45a2889 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecStreamRedirectorTest.java @@ -60,8 +60,8 @@ public class ExecStreamRedirectorTest { if (dirListingOutput != null) { // Compare the directory listing that was redirected to these files. // All files should have the same content. - assertTrue("Redirected output in file " + redirectedOutputFile + - " doesn't match content in other redirected output file(s)", + assertTrue("Redirected output in file " + redirectedOutputFile + + " doesn't match content in other redirected output file(s)", Arrays.equals(dirListingOutput, redirectedOutput)); } dirListingOutput = redirectedOutput; http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/JUnitLauncherTaskTest.java ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/JUnitLauncherTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/JUnitLauncherTaskTest.java index 024a87b..9d61d92 100644 --- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/JUnitLauncherTaskTest.java +++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/junitlauncher/JUnitLauncherTaskTest.java @@ -102,7 +102,8 @@ public class JUnitLauncherTaskTest { final Path trackerFile = setupTrackerProperty(targetName); buildRule.executeTarget(targetName); // make sure the right test(s) were run - Assert.assertTrue("JUnit4SampleTest test was expected to be run", wasTestRun(trackerFile, JUnit4SampleTest.class.getName())); + Assert.assertTrue("JUnit4SampleTest test was expected to be run", wasTestRun(trackerFile, + JUnit4SampleTest.class.getName())); Assert.assertTrue("JUnit4SampleTest#testFoo was expected to succeed", verifySuccess(trackerFile, JUnit4SampleTest.class.getName(), "testFoo")); } @@ -169,7 +170,8 @@ public class JUnitLauncherTaskTest { JupiterSampleTest.class.getName(), "testFails")); Assert.assertTrue("JupiterSampleTest#testSkipped was expected to be skipped", verifySkipped(trackerFile, JupiterSampleTest.class.getName(), "testSkipped")); - Assert.assertFalse("ForkedTest wasn't expected to be run", wasTestRun(trackerFile, ForkedTest.class.getName())); + Assert.assertFalse("ForkedTest wasn't expected to be run", wasTestRun(trackerFile, + ForkedTest.class.getName())); } /** @@ -192,9 +194,9 @@ public class JUnitLauncherTaskTest { } /** - * Tests that in a forked mode execution of tests, when the {@code includeJUnitPlatformLibraries} attribute - * is set to false, then the execution of such tests fails with a classloading error for the JUnit platform - * classes + * Tests that in a forked mode execution of tests, when the {@code includeJUnitPlatformLibraries} + * attribute is set to false, then the execution of such tests fails with a classloading error + * for the JUnit platform classes * * @throws Exception */ @@ -203,8 +205,8 @@ public class JUnitLauncherTaskTest { final String targetName = "test-junit-platform-lib-excluded"; try { buildRule.executeTarget(targetName); - Assert.fail(targetName + " was expected to fail since JUnit platform libraries " + - "weren't included in the classpath of the forked JVM"); + Assert.fail(targetName + " was expected to fail since JUnit platform libraries " + + "weren't included in the classpath of the forked JVM"); } catch (BuildException be) { // expect a ClassNotFoundException for a JUnit platform class final String cnfeMessage = ClassNotFoundException.class.getName() + ": org.junit.platform"; @@ -213,13 +215,14 @@ public class JUnitLauncherTaskTest { } } final String exclusionLogMsg = "Excluding JUnit platform libraries"; - Assert.assertTrue("JUnit platform libraries weren't excluded from classpath", buildRule.getFullLog().contains(exclusionLogMsg)); + Assert.assertTrue("JUnit platform libraries weren't excluded from classpath", + buildRule.getFullLog().contains(exclusionLogMsg)); } /** - * Tests that in a forked mode execution of tests, when the {@code includeAntRuntimeLibraries} attribute - * is set to false, then the execution of such tests fails with a classloading error for the Ant runtime - * classes + * Tests that in a forked mode execution of tests, when the {@code includeAntRuntimeLibraries} + * attribute is set to false, then the execution of such tests fails with a classloading error + * for the Ant runtime classes * * @throws Exception */ @@ -228,8 +231,8 @@ public class JUnitLauncherTaskTest { final String targetName = "test-junit-ant-runtime-lib-excluded"; try { buildRule.executeTarget(targetName); - Assert.fail(targetName + " was expected to fail since JUnit platform libraries " + - "weren't included in the classpath of the forked JVM"); + Assert.fail(targetName + " was expected to fail since JUnit platform libraries " + + "weren't included in the classpath of the forked JVM"); } catch (BuildException be) { // expect a Error due to missing main class (which is part of Ant runtime libraries // that we excluded) @@ -239,13 +242,15 @@ public class JUnitLauncherTaskTest { } } final String exclusionLogMsg = "Excluding Ant runtime libraries"; - Assert.assertTrue("Ant runtime libraries weren't excluded from classpath", buildRule.getFullLog().contains(exclusionLogMsg)); + Assert.assertTrue("Ant runtime libraries weren't excluded from classpath", + buildRule.getFullLog().contains(exclusionLogMsg)); } /** - * Tests that in a forked mode execution, with {@code includeJUnitPlatformLibraries} attribute set to false - * and with the test classpath explicitly including JUnit platform library jars, the tests are executed successfully + * Tests that in a forked mode execution, with {@code includeJUnitPlatformLibraries} attribute + * set to false and with the test classpath explicitly including JUnit platform library jars, + * the tests are executed successfully * * @throws Exception */ @@ -255,7 +260,8 @@ public class JUnitLauncherTaskTest { final Path trackerFile = setupTrackerProperty(targetName); buildRule.executeTarget(targetName); final String exclusionLogMsg = "Excluding JUnit platform libraries"; - Assert.assertTrue("JUnit platform libraries weren't excluded from classpath", buildRule.getFullLog().contains(exclusionLogMsg)); + Assert.assertTrue("JUnit platform libraries weren't excluded from classpath", + buildRule.getFullLog().contains(exclusionLogMsg)); Assert.assertTrue("JupiterSampleTest#testSucceeds was expected to succeed", verifySuccess(trackerFile, JupiterSampleTest.class.getName(), "testSucceeds")); Assert.assertTrue("JupiterSampleTest#testFails was expected to fail", verifyFailed(trackerFile, @@ -263,8 +269,9 @@ public class JUnitLauncherTaskTest { } /** - * Tests that in a forked mode execution, with {@code includeAntRuntimeLibraries} attribute set to false - * and with the test classpath explicitly including Ant runtime library jars, the tests are executed successfully + * Tests that in a forked mode execution, with {@code includeAntRuntimeLibraries} attribute + * set to false and with the test classpath explicitly including Ant runtime library jars, + * the tests are executed successfully * * @throws Exception */ @@ -281,7 +288,8 @@ public class JUnitLauncherTaskTest { // run the target buildRule.executeTarget(targetName); final String exclusionLogMsg = "Excluding Ant runtime libraries"; - Assert.assertTrue("Ant runtime libraries weren't excluded from classpath", buildRule.getFullLog().contains(exclusionLogMsg)); + Assert.assertTrue("Ant runtime libraries weren't excluded from classpath", + buildRule.getFullLog().contains(exclusionLogMsg)); Assert.assertTrue("JupiterSampleTest#testSucceeds was expected to succeed", verifySuccess(trackerFile, JupiterSampleTest.class.getName(), "testSucceeds")); Assert.assertTrue("JupiterSampleTest#testFails was expected to fail", verifyFailed(trackerFile, @@ -295,8 +303,9 @@ public class JUnitLauncherTaskTest { } /** - * Tests that in a forked mode execution, with {@code includeAntRuntimeLibraries} and {@code includeJUnitPlatformLibraries} - * attributes set to false and with the test classpath explicitly including Ant runtime and JUnit platform library jars, + * Tests that in a forked mode execution, with {@code includeAntRuntimeLibraries} and + * {@code includeJUnitPlatformLibraries} attributes set to false and with the test classpath + * explicitly including Ant runtime and JUnit platform library jars, * the tests are executed successfully * * @throws Exception http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java index d4c4682..428135b 100644 --- a/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java +++ b/src/tests/junit/org/apache/tools/ant/types/XMLCatalogTest.java @@ -92,12 +92,12 @@ public class XMLCatalogTest { @Test public void testEmptyCatalogResolve() throws TransformerException, MalformedURLException { - String expected = toURLString(new File(project.getBaseDir() + - "/i/dont/exist.dtd")); + String expected = toURLString(new File(project.getBaseDir() + + "/i/dont/exist.dtd")); Source result = catalog.resolve("i/dont/exist.dtd", null); String resultStr = fileURLPartWithoutLeadingSlashes((SAXSource) result); assertThat("Empty catalog should return input with a system ID like " - + expected + " but was " + resultStr, expected, endsWith(resultStr)); + + expected + " but was " + resultStr, expected, endsWith(resultStr)); } private static String fileURLPartWithoutLeadingSlashes(SAXSource result) @@ -130,8 +130,7 @@ public class XMLCatalogTest { + "/i/dont/exist.dtd")); String resultStr = fileURLPartWithoutLeadingSlashes((SAXSource) result); assertThat("Nonexistent Catalog entry return input with a system ID like " - + expected + " but was " + resultStr, - expected, endsWith(resultStr)); + + expected + " but was " + resultStr, expected, endsWith(resultStr)); } @Test http://git-wip-us.apache.org/repos/asf/ant/blob/2977bb59/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java ---------------------------------------------------------------------- diff --git a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java index aa95c29..b8aeec1 100644 --- a/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java +++ b/src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java @@ -165,10 +165,10 @@ public abstract class RegexpMatcherTest { @Test public void testMultiVersusSingleLine() { - String text = "Line1" + UNIX_LINE + - "starttest Line2" + UNIX_LINE + - "Line3 endtest" + UNIX_LINE + - "Line4" + UNIX_LINE; + String text = "Line1" + UNIX_LINE + + "starttest Line2" + UNIX_LINE + + "Line3 endtest" + UNIX_LINE + + "Line4" + UNIX_LINE; doStartTest1(text); doStartTest2(text);