You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2018/11/04 09:03:56 UTC
[1/2] ant git commit: Checkstyle: dangling operators
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 <gi...@apache.org>
Authored: Sun Nov 4 10:01:43 2018 +0100
Committer: Gintas Grigelionis <gi...@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);
[2/2] ant git commit: SonarQube: unnecessary parentheses is a major
code smell
Posted by gi...@apache.org.
SonarQube: unnecessary parentheses is a major code smell
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/e2dd6ec7
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/e2dd6ec7
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/e2dd6ec7
Branch: refs/heads/master
Commit: e2dd6ec79a083901907e35ac4f0cd3631e71ec55
Parents: 2977bb5
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Sun Nov 4 10:02:42 2018 +0100
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Sun Nov 4 10:03:38 2018 +0100
----------------------------------------------------------------------
.../org/apache/tools/ant/AntTypeDefinition.java | 7 ++--
.../org/apache/tools/ant/ComponentHelper.java | 6 +--
src/main/org/apache/tools/ant/Project.java | 10 ++---
.../tools/ant/dispatch/DispatchUtils.java | 2 +-
.../apache/tools/ant/listener/MailLogger.java | 16 +++-----
.../tools/ant/taskdefs/AbstractCvsTask.java | 2 +-
.../org/apache/tools/ant/taskdefs/Exit.java | 6 +--
.../org/apache/tools/ant/taskdefs/FixCRLF.java | 7 ++--
.../tools/ant/taskdefs/JikesOutputParser.java | 4 +-
.../apache/tools/ant/taskdefs/PreSetDef.java | 17 ++++----
.../org/apache/tools/ant/taskdefs/Recorder.java | 2 +-
.../apache/tools/ant/taskdefs/Redirector.java | 6 +--
.../org/apache/tools/ant/taskdefs/Touch.java | 4 +-
.../apache/tools/ant/taskdefs/condition/Os.java | 8 ++--
.../ant/taskdefs/optional/SchemaValidate.java | 2 +-
.../ant/taskdefs/optional/XMLValidateTask.java | 2 +-
.../ant/taskdefs/optional/ejb/IPlanetEjbc.java | 10 +----
.../taskdefs/optional/extension/Extension.java | 2 +-
.../tools/ant/taskdefs/optional/net/FTP.java | 2 +-
.../tools/ant/types/EnumeratedAttribute.java | 2 +-
src/main/org/apache/tools/ant/types/Path.java | 3 +-
.../org/apache/tools/ant/types/Permissions.java | 2 +-
.../tools/ant/types/RedirectorElement.java | 7 ++--
.../ant/types/selectors/SelectorUtils.java | 8 ++--
.../modifiedselector/EqualComparator.java | 2 +-
.../modifiedselector/ModifiedSelector.java | 2 +-
.../modifiedselector/PropertiesfileCache.java | 2 +-
.../apache/tools/ant/util/Base64Converter.java | 2 +-
.../apache/tools/ant/util/DOMElementWriter.java | 2 +-
.../org/apache/tools/ant/util/FileUtils.java | 2 +-
.../org/apache/tools/bzip2/BZip2Constants.java | 2 +-
src/main/org/apache/tools/bzip2/BlockSort.java | 16 ++++----
.../apache/tools/bzip2/CBZip2OutputStream.java | 17 +++-----
src/main/org/apache/tools/tar/TarBuffer.java | 42 +++++++-------------
.../org/apache/tools/tar/TarInputStream.java | 2 +-
.../apache/tools/zip/ZipEightByteInteger.java | 2 +-
src/main/org/apache/tools/zip/ZipFile.java | 3 +-
src/main/org/apache/tools/zip/ZipLong.java | 2 +-
.../org/apache/tools/zip/ZipOutputStream.java | 8 ++--
.../types/selectors/ModifiedSelectorTest.java | 2 +-
40 files changed, 104 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/AntTypeDefinition.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/AntTypeDefinition.java b/src/main/org/apache/tools/ant/AntTypeDefinition.java
index 387577f..20ae38d 100644
--- a/src/main/org/apache/tools/ant/AntTypeDefinition.java
+++ b/src/main/org/apache/tools/ant/AntTypeDefinition.java
@@ -315,8 +315,7 @@ public class AntTypeDefinition {
noArg = false;
}
//now we instantiate
- T o = ctor.newInstance(
- ((noArg) ? new Object[0] : new Object[] {project}));
+ T o = ctor.newInstance(noArg ? new Object[0] : new Object[] {project});
//set up project references.
project.setProjectReference(o);
@@ -331,12 +330,12 @@ public class AntTypeDefinition {
* @return true if the definitions are the same.
*/
public boolean sameDefinition(AntTypeDefinition other, Project project) {
- return (other != null && other.getClass() == getClass()
+ return other != null && other.getClass() == getClass()
&& other.getTypeClass(project).equals(getTypeClass(project))
&& other.getExposedClass(project).equals(getExposedClass(project))
&& other.restrict == restrict
&& other.adapterClass == adapterClass
- && other.adaptToClass == adaptToClass);
+ && other.adaptToClass == adaptToClass;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/ComponentHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/ComponentHelper.java b/src/main/org/apache/tools/ant/ComponentHelper.java
index 28fa824..1cc84f8 100644
--- a/src/main/org/apache/tools/ant/ComponentHelper.java
+++ b/src/main/org/apache/tools/ant/ComponentHelper.java
@@ -710,9 +710,9 @@ public class ComponentHelper {
}
Class<?> oldClass = old.getExposedClass(project);
boolean isTask = oldClass != null && Task.class.isAssignableFrom(oldClass);
- project.log("Trying to override old definition of "
- + (isTask ? "task " : "datatype ") + name, (def.similarDefinition(old,
- project)) ? Project.MSG_VERBOSE : Project.MSG_WARN);
+ project.log(String.format("Trying to override old definition of %s %s",
+ isTask ? "task" : "datatype", name), def.similarDefinition(old,
+ project) ? Project.MSG_VERBOSE : Project.MSG_WARN);
}
project.log(" +Datatype " + name + " " + def.getClassName(), Project.MSG_DEBUG);
antTypeTable.put(name, def);
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/Project.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java
index 62aafbc..6ff43d4 100644
--- a/src/main/org/apache/tools/ant/Project.java
+++ b/src/main/org/apache/tools/ant/Project.java
@@ -268,7 +268,7 @@ public class Project implements ResourceFactory {
public Project createSubProject() {
Project subProject = null;
try {
- subProject = (getClass().newInstance());
+ subProject = getClass().newInstance();
} catch (final Exception e) {
subProject = new Project();
}
@@ -927,7 +927,7 @@ public class Project implements ResourceFactory {
throw new BuildException("Ant cannot work on Java prior to 1.8");
}
log("Detected Java version: " + javaVersion + " in: "
- + System.getProperty("java.home"), MSG_VERBOSE);
+ + JavaEnvUtils.getJavaHome(), MSG_VERBOSE);
log("Detected OS: " + System.getProperty("os.name"), MSG_VERBOSE);
}
@@ -1716,9 +1716,9 @@ public class Project implements ResourceFactory {
* <code>false</code> otherwise.
*/
public static boolean toBoolean(final String s) {
- return ("on".equalsIgnoreCase(s)
+ return "on".equalsIgnoreCase(s)
|| "true".equalsIgnoreCase(s)
- || "yes".equalsIgnoreCase(s));
+ || "yes".equalsIgnoreCase(s);
}
/**
@@ -1828,7 +1828,7 @@ public class Project implements ResourceFactory {
.collect(Collectors.joining(","))
+ " is " + ret, MSG_VERBOSE);
- final Vector<Target> complete = (returnAll) ? ret : new Vector<>(ret);
+ final Vector<Target> complete = returnAll ? ret : new Vector<>(ret);
for (final String curTarget : targetTable.keySet()) {
final String st = state.get(curTarget);
if (st == null) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java b/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
index efaccf8..f2802a9 100644
--- a/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
+++ b/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
@@ -104,7 +104,7 @@ public class DispatchUtils {
} catch (InvocationTargetException ie) {
Throwable t = ie.getTargetException();
if (t instanceof BuildException) {
- throw ((BuildException) t);
+ throw (BuildException) t;
} else {
throw new BuildException(t);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/listener/MailLogger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/listener/MailLogger.java b/src/main/org/apache/tools/ant/listener/MailLogger.java
index c2b9e25..29068b4 100644
--- a/src/main/org/apache/tools/ant/listener/MailLogger.java
+++ b/src/main/org/apache/tools/ant/listener/MailLogger.java
@@ -143,16 +143,13 @@ public class MailLogger extends DefaultLogger {
}
Values values = new Values()
.mailhost(getValue(properties, "mailhost", "localhost"))
- .port(Integer.parseInt(
- getValue(
- properties, "port",
- String.valueOf(MailMessage.DEFAULT_PORT))))
+ .port(Integer.parseInt(getValue(properties, "port",
+ String.valueOf(MailMessage.DEFAULT_PORT))))
.user(getValue(properties, "user", ""))
.password(getValue(properties, "password", ""))
- .ssl(Project.toBoolean(getValue(properties,
- "ssl", "off")))
+ .ssl(Project.toBoolean(getValue(properties, "ssl", "off")))
.starttls(Project.toBoolean(getValue(properties,
- "starttls.enable", "off")))
+ "starttls.enable", "off")))
.from(getValue(properties, "from", null))
.replytoList(getValue(properties, "replyto", ""))
.toList(getValue(properties, prefix + ".to", null))
@@ -161,9 +158,8 @@ public class MailLogger extends DefaultLogger {
.mimeType(getValue(properties, "mimeType", DEFAULT_MIME_TYPE))
.charset(getValue(properties, "charset", ""))
.body(getValue(properties, prefix + ".body", ""))
- .subject(getValue(
- properties, prefix + ".subject",
- (success) ? "Build Success" : "Build Failure"));
+ .subject(getValue(properties, prefix + ".subject",
+ success ? "Build Success" : "Build Failure"));
if (values.user().isEmpty()
&& values.password().isEmpty()
&& !values.ssl() && !values.starttls()) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
index c55c1ec..503a3f3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
@@ -364,7 +364,7 @@ public abstract class AbstractCvsTask extends Task {
log("Caught exception: " + e.getMessage(), Project.MSG_WARN);
} catch (BuildException e) {
if (failOnError) {
- throw(e);
+ throw e;
}
Throwable t = e.getCause();
if (t == null) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/Exit.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Exit.java b/src/main/org/apache/tools/ant/taskdefs/Exit.java
index c55c584..7394887 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Exit.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Exit.java
@@ -134,8 +134,8 @@ public class Exit extends Task {
*/
@Override
public void execute() throws BuildException {
- boolean fail = (nestedConditionPresent()) ? testNestedCondition()
- : (testIfCondition() && testUnlessCondition());
+ boolean fail = nestedConditionPresent() ? testNestedCondition()
+ : testIfCondition() && testUnlessCondition();
if (fail) {
String text = null;
if (message != null && !message.trim().isEmpty()) {
@@ -231,7 +231,7 @@ public class Exit extends Task {
* @return <code>boolean</code>.
*/
private boolean nestedConditionPresent() {
- return (nestedCondition != null);
+ return nestedCondition != null;
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
index cdac0d2..af6c6fe 100644
--- a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
+++ b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
@@ -420,10 +420,9 @@ public class FixCRLF extends MatchingTask implements ChainableReader {
throws BuildException {
this.srcFile = srcFile;
try {
- reader = new BufferedReader(
- ((encoding == null) ? new FileReader(srcFile)
- : new InputStreamReader(
- Files.newInputStream(srcFile.toPath()), encoding)), INBUFLEN);
+ reader = new BufferedReader(encoding == null ? new FileReader(srcFile)
+ : new InputStreamReader(Files.newInputStream(srcFile.toPath()),
+ encoding), INBUFLEN);
nextLine();
} catch (IOException e) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java b/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
index 569968c..0fb5834 100644
--- a/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
+++ b/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java
@@ -169,9 +169,9 @@ public class JikesOutputParser implements ExecuteStreamHandler {
private void log(String line) {
if (!emacsMode) {
- task.log("", (error ? Project.MSG_ERR : Project.MSG_WARN));
+ task.log("", error ? Project.MSG_ERR : Project.MSG_WARN);
}
- task.log(line, (error ? Project.MSG_ERR : Project.MSG_WARN));
+ task.log(line, error ? Project.MSG_ERR : Project.MSG_WARN);
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java b/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java
index b343919..f4b49c6 100644
--- a/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java
+++ b/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java
@@ -266,9 +266,9 @@ public class PreSetDef extends AntlibDefinition implements TaskContainer {
*/
@Override
public boolean sameDefinition(AntTypeDefinition other, Project project) {
- return (other != null && other.getClass() == getClass() && parent != null
- && parent.sameDefinition(((PreSetDefinition) other).parent, project)
- && element.similar(((PreSetDefinition) other).element));
+ return other != null && other.getClass() == getClass() && parent != null
+ && parent.sameDefinition(((PreSetDefinition) other).parent, project)
+ && element.similar(((PreSetDefinition) other).element);
}
/**
@@ -279,12 +279,11 @@ public class PreSetDef extends AntlibDefinition implements TaskContainer {
* @return true if the definitions are similar.
*/
@Override
- public boolean similarDefinition(
- AntTypeDefinition other, Project project) {
- return (other != null && other.getClass().getName().equals(
- getClass().getName()) && parent != null
- && parent.similarDefinition(((PreSetDefinition) other).parent, project)
- && element.similar(((PreSetDefinition) other).element));
+ public boolean similarDefinition(AntTypeDefinition other, Project project) {
+ return other != null && other.getClass().getName().equals(getClass().getName())
+ && parent != null
+ && parent.similarDefinition(((PreSetDefinition) other).parent, project)
+ && element.similar(((PreSetDefinition) other).element);
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/Recorder.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Recorder.java b/src/main/org/apache/tools/ant/taskdefs/Recorder.java
index 90410b6..5d3d049 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Recorder.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Recorder.java
@@ -114,7 +114,7 @@ public class Recorder extends Task implements SubBuildListener {
* @param append if true, append to a previous file.
*/
public void setAppend(boolean append) {
- this.append = (append ? Boolean.TRUE : Boolean.FALSE);
+ this.append = append ? Boolean.TRUE : Boolean.FALSE;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/Redirector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Redirector.java b/src/main/org/apache/tools/ant/taskdefs/Redirector.java
index 5d07de1..af51675 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Redirector.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Redirector.java
@@ -695,8 +695,7 @@ public class Redirector {
/** outStreams */
private void outStreams() {
if (out != null && out.length > 0) {
- final String logHead = "Output "
- + ((appendOut) ? "appended" : "redirected") + " to ";
+ final String logHead = "Output " + (appendOut ? "appended" : "redirected") + " to ";
outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE,
appendOut, createEmptyFilesOut);
}
@@ -717,8 +716,7 @@ public class Redirector {
private void errorStreams() {
if (error != null && error.length > 0) {
- final String logHead = "Error "
- + ((appendErr) ? "appended" : "redirected") + " to ";
+ final String logHead = "Error " + (appendErr ? "appended" : "redirected") + " to ";
errorStream = foldFiles(error, logHead, Project.MSG_VERBOSE,
appendErr, createEmptyFilesErr);
} else if (!(logError || outputStream == null) && errorProperty == null) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/Touch.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Touch.java b/src/main/org/apache/tools/ant/taskdefs/Touch.java
index 86c573a..d7c9e97 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Touch.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Touch.java
@@ -254,7 +254,7 @@ public class Touch extends Task {
}
}
log("Setting millis to " + workmillis + " from datetime attribute",
- ((millis < 0) ? Project.MSG_DEBUG : Project.MSG_VERBOSE));
+ millis < 0 ? Project.MSG_DEBUG : Project.MSG_VERBOSE);
setMillis(workmillis);
// only set if successful to this point:
dateTimeConfigured = true;
@@ -352,7 +352,7 @@ public class Touch extends Task {
private void touch(File file, long modTime) {
if (!file.exists()) {
log("Creating " + file,
- ((verbose) ? Project.MSG_INFO : Project.MSG_VERBOSE));
+ verbose ? Project.MSG_INFO : Project.MSG_VERBOSE);
try {
FILE_UTILS.createNewFile(file, mkdirs);
} catch (IOException ioe) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
index 9ca87a9..21178de 100644
--- a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
+++ b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
@@ -264,12 +264,12 @@ public class Os implements Condition {
boolean isNT = false;
if (isWindows) {
//there are only four 9x platforms that we look for
- is9x = (OS_NAME.contains("95")
+ //wince isn't really 9x, but crippled enough to
+ //be a muchness. Ant doesn't run on CE, anyway.
+ is9x = OS_NAME.contains("95")
|| OS_NAME.contains("98")
|| OS_NAME.contains("me")
- //wince isn't really 9x, but crippled enough to
- //be a muchness. Ant doesn't run on CE, anyway.
- || OS_NAME.contains("ce"));
+ || OS_NAME.contains("ce");
isNT = !is9x;
}
switch (family) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java b/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
index 40e531c..a7ad4a4 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
@@ -479,7 +479,7 @@ public class SchemaValidate extends XMLValidateTask {
public int hashCode() {
int result;
// CheckStyle:MagicNumber OFF
- result = (namespace == null ? 0 : namespace.hashCode());
+ result = namespace == null ? 0 : namespace.hashCode();
result = 29 * result + (file == null ? 0 : file.hashCode());
result = 29 * result + (url == null ? 0 : url.hashCode());
// CheckStyle:MagicNumber OFF
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
index c7000b3..61502db 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
@@ -364,7 +364,7 @@ public class XMLValidateTask extends Task {
* @return true when a SAX1 parser is in use
*/
protected boolean isSax1Parser() {
- return (xmlReader instanceof ParserAdapter);
+ return xmlReader instanceof ParserAdapter;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
index 4484062..40a2b7c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
@@ -1081,12 +1081,7 @@ public class IPlanetEjbc {
* be run to bring the stubs and skeletons up to date.
*/
public boolean mustBeRecompiled(File destDir) {
-
- long sourceModified = sourceClassesModified(destDir);
-
- long destModified = destClassesModified(destDir);
-
- return (destModified < sourceModified);
+ return destClassesModified(destDir) < sourceClassesModified(destDir);
}
/**
@@ -1236,8 +1231,7 @@ public class IPlanetEjbc {
* names for the stubs and skeletons to be generated.
*/
private String[] classesToGenerate() {
- String[] classnames = (iiop)
- ? new String[NUM_CLASSES_WITH_IIOP]
+ String[] classnames = iiop ? new String[NUM_CLASSES_WITH_IIOP]
: new String[NUM_CLASSES_WITHOUT_IIOP];
final String remotePkg = remote.getPackageName() + ".";
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java b/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
index 1000d8d..5f2e7e3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
@@ -467,7 +467,7 @@ public final class Extension {
* @return true if the specified extension is compatible with this extension
*/
public boolean isCompatibleWith(final Extension required) {
- return (COMPATIBLE == getCompatibilityWith(required));
+ return COMPATIBLE == getCompatibilityWith(required);
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index 901ff06..155e2ed 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -876,7 +876,7 @@ public class FTP extends Task implements FTPTaskConfig {
* @return true if the file exists
*/
public boolean exists() {
- return (ftpFile != null);
+ return ftpFile != null;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java b/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java
index dac3966..3e29d79 100644
--- a/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java
+++ b/src/main/org/apache/tools/ant/types/EnumeratedAttribute.java
@@ -103,7 +103,7 @@ public abstract class EnumeratedAttribute {
* @return true if the value is valid
*/
public final boolean containsValue(String value) {
- return (indexOfValue(value) != -1);
+ return indexOfValue(value) != -1;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/types/Path.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/Path.java b/src/main/org/apache/tools/ant/types/Path.java
index 08f5f22..a4b0b62 100644
--- a/src/main/org/apache/tools/ant/types/Path.java
+++ b/src/main/org/apache/tools/ant/types/Path.java
@@ -331,8 +331,7 @@ public class Path extends DataType implements Cloneable, ResourceCollection {
* @param tryUserDir if true try the user directory if the file is not present
*/
public void addExisting(Path source, boolean tryUserDir) {
- File userDir = (tryUserDir) ? new File(System.getProperty("user.dir"))
- : null;
+ File userDir = tryUserDir ? new File(System.getProperty("user.dir")) : null;
for (String name : source.list()) {
File f = resolveFile(getProject(), name);
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/types/Permissions.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/Permissions.java b/src/main/org/apache/tools/ant/types/Permissions.java
index 7dd0ec9..aa7f4b7 100644
--- a/src/main/org/apache/tools/ant/types/Permissions.java
+++ b/src/main/org/apache/tools/ant/types/Permissions.java
@@ -348,7 +348,7 @@ public class Permissions {
*/
@Override
public String toString() {
- return ("Permission: " + className + " (\"" + name + "\", \"" + actions + "\")");
+ return String.format("Permission: %s (\"%s\", \"%s\")", className, name, actions);
}
}
}
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/types/RedirectorElement.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/RedirectorElement.java b/src/main/org/apache/tools/ant/types/RedirectorElement.java
index c0b1bd5..e814f46 100644
--- a/src/main/org/apache/tools/ant/types/RedirectorElement.java
+++ b/src/main/org/apache/tools/ant/types/RedirectorElement.java
@@ -342,7 +342,7 @@ public class RedirectorElement extends DataType {
if (isReference()) {
throw tooManyAttributes();
}
- this.append = ((append) ? Boolean.TRUE : Boolean.FALSE);
+ this.append = append ? Boolean.TRUE : Boolean.FALSE;
}
/**
@@ -356,7 +356,7 @@ public class RedirectorElement extends DataType {
if (isReference()) {
throw tooManyAttributes();
}
- this.alwaysLog = ((alwaysLog) ? Boolean.TRUE : Boolean.FALSE);
+ this.alwaysLog = alwaysLog ? Boolean.TRUE : Boolean.FALSE;
}
/**
@@ -368,8 +368,7 @@ public class RedirectorElement extends DataType {
if (isReference()) {
throw tooManyAttributes();
}
- this.createEmptyFiles = ((createEmptyFiles)
- ? Boolean.TRUE : Boolean.FALSE);
+ this.createEmptyFiles = createEmptyFiles ? Boolean.TRUE : Boolean.FALSE;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
index f8aba1d..3c5f9bb 100644
--- a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
+++ b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
@@ -278,8 +278,8 @@ public final class SelectorUtils {
}
// Find the pattern between padIdxStart & padIdxTmp in str between
// strIdxStart & strIdxEnd
- int patLength = (patIdxTmp - patIdxStart - 1);
- int strLength = (strIdxEnd - strIdxStart + 1);
+ int patLength = patIdxTmp - patIdxStart - 1;
+ int strLength = strIdxEnd - strIdxStart + 1;
int foundIdx = -1;
strLoop:
for (int i = 0; i <= strLength - patLength; i++) {
@@ -433,8 +433,8 @@ public final class SelectorUtils {
}
// Find the pattern between padIdxStart & padIdxTmp in str between
// strIdxStart & strIdxEnd
- int patLength = (patIdxTmp - patIdxStart - 1);
- int strLength = (strIdxEnd - strIdxStart + 1);
+ int patLength = patIdxTmp - patIdxStart - 1;
+ int strLength = strIdxEnd - strIdxStart + 1;
int foundIdx = -1;
strLoop:
for (int i = 0; i <= strLength - patLength; i++) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java
index 94fb935..7e4bbe5 100644
--- a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java
+++ b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/EqualComparator.java
@@ -45,7 +45,7 @@ public class EqualComparator implements Comparator<Object> {
}
return 0;
}
- return (o1.equals(o2)) ? 0 : 1;
+ return o1.equals(o2) ? 0 : 1;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
index 181642c..3aa6b0a 100644
--- a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
+++ b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/ModifiedSelector.java
@@ -459,7 +459,7 @@ public class ModifiedSelector extends BaseExtendSelector
+ resource.getName()
+ "' does not provide an InputStream, so it is not checked. "
+ "According to 'selres' attribute value it is "
- + ((selectResourcesWithoutInputStream) ? "" : " not")
+ + (selectResourcesWithoutInputStream ? "" : " not")
+ "selected.", Project.MSG_INFO);
return selectResourcesWithoutInputStream;
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
index ae52dc9..e8c8fd0 100644
--- a/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
+++ b/src/main/org/apache/tools/ant/types/selectors/modifiedselector/PropertiesfileCache.java
@@ -118,7 +118,7 @@ public class PropertiesfileCache implements Cache {
*/
@Override
public boolean isValid() {
- return (cachefile != null);
+ return cachefile != null;
}
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/util/Base64Converter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/Base64Converter.java b/src/main/org/apache/tools/ant/util/Base64Converter.java
index 4f62b03..2a1740d 100644
--- a/src/main/org/apache/tools/ant/util/Base64Converter.java
+++ b/src/main/org/apache/tools/ant/util/Base64Converter.java
@@ -91,7 +91,7 @@ public class Base64Converter {
out[outIndex++] = ALPHABET[bits6];
bits6 = (bits24 & POS_1_MASK) >> POS_1_SHIFT;
out[outIndex++] = ALPHABET[bits6];
- bits6 = (bits24 & POS_0_MASK);
+ bits6 = bits24 & POS_0_MASK;
out[outIndex++] = ALPHABET[bits6];
}
if (octetString.length - i == 2) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/util/DOMElementWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/DOMElementWriter.java b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
index ebef59b..5c85b13 100644
--- a/src/main/org/apache/tools/ant/util/DOMElementWriter.java
+++ b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
@@ -515,7 +515,7 @@ public class DOMElementWriter {
int prevEnd = 0;
int cdataEndPos = value.indexOf("]]>");
while (prevEnd < len) {
- final int end = (cdataEndPos < 0 ? len : cdataEndPos);
+ final int end = cdataEndPos < 0 ? len : cdataEndPos;
// Write out stretches of legal characters in the range [prevEnd, end).
int prevLegalCharPos = prevEnd;
while (prevLegalCharPos < end) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/ant/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java
index 7764ceb..1d0e9a3 100644
--- a/src/main/org/apache/tools/ant/util/FileUtils.java
+++ b/src/main/org/apache/tools/ant/util/FileUtils.java
@@ -1181,7 +1181,7 @@ public class FileUtils {
if (!l.endsWith(File.separator)) {
l += File.separator;
}
- return (p.startsWith(l)) ? p.substring(l.length()) : p;
+ return p.startsWith(l) ? p.substring(l.length()) : p;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/bzip2/BZip2Constants.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/BZip2Constants.java b/src/main/org/apache/tools/bzip2/BZip2Constants.java
index df32d95..7676e40 100644
--- a/src/main/org/apache/tools/bzip2/BZip2Constants.java
+++ b/src/main/org/apache/tools/bzip2/BZip2Constants.java
@@ -42,7 +42,7 @@ public interface BZip2Constants {
int N_GROUPS = 6;
int G_SIZE = 50;
int N_ITERS = 4;
- int MAX_SELECTORS = (2 + (900000 / G_SIZE));
+ int MAX_SELECTORS = 2 + 900000 / G_SIZE;
int NUM_OVERSHOOT_BYTES = 20;
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/bzip2/BlockSort.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/BlockSort.java b/src/main/org/apache/tools/bzip2/BlockSort.java
index 75c3ff2..14a4632 100644
--- a/src/main/org/apache/tools/bzip2/BlockSort.java
+++ b/src/main/org/apache/tools/bzip2/BlockSort.java
@@ -686,17 +686,17 @@ class BlockSort {
i2 -= lastPlus1;
}
workDoneShadow++;
- } else if ((quadrant[i1 + 3] > quadrant[i2 + 3])) {
+ } else if (quadrant[i1 + 3] > quadrant[i2 + 3]) {
continue HAMMER;
} else {
break HAMMER;
}
- } else if ((block[i1 + 4] & 0xff) > (block[i2 + 4] & 0xff)) {
+ } else if ((block[i2 + 4] & 0xff) < (block[i1 + 4] & 0xff)) {
continue HAMMER;
} else {
break HAMMER;
}
- } else if ((quadrant[i1 + 2] > quadrant[i2 + 2])) {
+ } else if (quadrant[i1 + 2] > quadrant[i2 + 2]) {
continue HAMMER;
} else {
break HAMMER;
@@ -706,7 +706,7 @@ class BlockSort {
} else {
break HAMMER;
}
- } else if ((quadrant[i1 + 1] > quadrant[i2 + 1])) {
+ } else if (quadrant[i1 + 1] > quadrant[i2 + 1]) {
continue HAMMER;
} else {
break HAMMER;
@@ -716,7 +716,7 @@ class BlockSort {
} else {
break HAMMER;
}
- } else if ((quadrant[i1] > quadrant[i2])) {
+ } else if (quadrant[i1] > quadrant[i2]) {
continue HAMMER;
} else {
break HAMMER;
@@ -900,8 +900,8 @@ class BlockSort {
}
}
- private static final int SETMASK = (1 << 21);
- private static final int CLEARMASK = (~SETMASK);
+ private static final int SETMASK = 1 << 21;
+ private static final int CLEARMASK = ~SETMASK;
final void mainSort(final CBZip2OutputStream.Data dataShadow,
final int lastShadow) {
@@ -1024,7 +1024,7 @@ class BlockSort {
copy[j] = ftab[(j << 8) + ss] & CLEARMASK;
}
- for (int j = ftab[ss << 8] & CLEARMASK, hj = (ftab[(ss + 1) << 8] & CLEARMASK); j < hj; j++) {
+ for (int j = ftab[ss << 8] & CLEARMASK, hj = ftab[ss + 1 << 8] & CLEARMASK; j < hj; j++) {
final int fmap_j = fmap[j];
c1 = block[fmap_j] & 0xff;
if (!bigDone[c1]) {
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
index ec438be..19eedda 100644
--- a/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
+++ b/src/main/org/apache/tools/bzip2/CBZip2OutputStream.java
@@ -143,14 +143,14 @@ public class CBZip2OutputStream extends OutputStream
* purposes. If you don't know what it means then you don't need
* it.
*/
- protected static final int SETMASK = (1 << 21);
+ protected static final int SETMASK = 1 << 21;
/**
* This constant is accessible by subclasses for historical
* purposes. If you don't know what it means then you don't need
* it.
*/
- protected static final int CLEARMASK = (~SETMASK);
+ protected static final int CLEARMASK = ~SETMASK;
/**
* This constant is accessible by subclasses for historical
@@ -322,14 +322,9 @@ public class CBZip2OutputStream extends OutputStream
final int weight_n1 = weight[n1];
final int weight_n2 = weight[n2];
- weight[nNodes] = (((weight_n1 & 0xffffff00)
- + (weight_n2 & 0xffffff00))
- |
- (1 + (((weight_n1 & 0x000000ff)
- > (weight_n2 & 0x000000ff))
- ? (weight_n1 & 0x000000ff)
- : (weight_n2 & 0x000000ff))
- ));
+ weight[nNodes] = (weight_n1 & 0xffffff00) + (weight_n2 & 0xffffff00)
+ | 1 + ((weight_n1 & 0x000000ff) > (weight_n2 & 0x000000ff)
+ ? weight_n1 & 0x000000ff : weight_n2 & 0x000000ff);
parent[nNodes] = -1;
nHeap++;
@@ -1565,7 +1560,7 @@ public class CBZip2OutputStream extends OutputStream
super();
final int n = blockSize100k * BZip2Constants.baseBlockSize;
- this.block = new byte[(n + 1 + NUM_OVERSHOOT_BYTES)];
+ this.block = new byte[n + 1 + NUM_OVERSHOOT_BYTES];
this.fmap = new int[n];
this.sfmap = new char[2 * n];
}
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/tar/TarBuffer.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarBuffer.java b/src/main/org/apache/tools/tar/TarBuffer.java
index 252d88c..d7f0eca 100644
--- a/src/main/org/apache/tools/tar/TarBuffer.java
+++ b/src/main/org/apache/tools/tar/TarBuffer.java
@@ -44,10 +44,10 @@ import java.util.Arrays;
public class TarBuffer {
/** Default record size */
- public static final int DEFAULT_RCDSIZE = (512);
+ public static final int DEFAULT_RCDSIZE = 512;
/** Default block size */
- public static final int DEFAULT_BLKSIZE = (DEFAULT_RCDSIZE * 20);
+ public static final int DEFAULT_BLKSIZE = DEFAULT_RCDSIZE * 20;
private InputStream inStream;
private OutputStream outStream;
@@ -123,7 +123,7 @@ public class TarBuffer {
this.debug = false;
this.blockSize = blockSize;
this.recordSize = recordSize;
- this.recsPerBlock = (this.blockSize / this.recordSize);
+ this.recsPerBlock = this.blockSize / this.recordSize;
this.blockBuffer = new byte[this.blockSize];
if (this.inStream != null) {
@@ -183,8 +183,7 @@ public class TarBuffer {
*/
public void skipRecord() throws IOException {
if (debug) {
- System.err.println("SkipRecord: recIdx = " + currRecIdx
- + " blkIdx = " + currBlkIdx);
+ System.err.printf("SkipRecord: recIdx = %d blkIdx = %d%n", currRecIdx, currBlkIdx);
}
if (inStream == null) {
@@ -206,8 +205,7 @@ public class TarBuffer {
*/
public byte[] readRecord() throws IOException {
if (debug) {
- System.err.println("ReadRecord: recIdx = " + currRecIdx
- + " blkIdx = " + currBlkIdx);
+ System.err.printf("ReadRecord: recIdx = %d blkIdx = %d%n", currRecIdx, currBlkIdx);
}
if (inStream == null) {
@@ -223,9 +221,7 @@ public class TarBuffer {
byte[] result = new byte[recordSize];
- System.arraycopy(blockBuffer,
- (currRecIdx * recordSize), result, 0,
- recordSize);
+ System.arraycopy(blockBuffer, currRecIdx * recordSize, result, 0, recordSize);
currRecIdx++;
@@ -250,8 +246,7 @@ public class TarBuffer {
int bytesNeeded = blockSize;
while (bytesNeeded > 0) {
- long numBytes = inStream.read(blockBuffer, offset,
- bytesNeeded);
+ long numBytes = inStream.read(blockBuffer, offset, bytesNeeded);
//
// NOTE
@@ -289,9 +284,8 @@ public class TarBuffer {
if (numBytes != blockSize) {
if (debug) {
- System.err.println("ReadBlock: INCOMPLETE READ "
- + numBytes + " of " + blockSize
- + " bytes read.");
+ System.err.printf("ReadBlock: INCOMPLETE READ %d of %d bytes read.%n",
+ numBytes, blockSize);
}
}
}
@@ -328,8 +322,8 @@ public class TarBuffer {
*/
public void writeRecord(byte[] record) throws IOException {
if (debug) {
- System.err.println("WriteRecord: recIdx = " + currRecIdx
- + " blkIdx = " + currBlkIdx);
+ System.err.printf("WriteRecord: recIdx = %d blkIdx = %d%n",
+ currRecIdx, currBlkIdx);
}
if (outStream == null) {
@@ -350,9 +344,7 @@ public class TarBuffer {
writeBlock();
}
- System.arraycopy(record, 0, blockBuffer,
- (currRecIdx * recordSize),
- recordSize);
+ System.arraycopy(record, 0, blockBuffer, currRecIdx * recordSize, recordSize);
currRecIdx++;
}
@@ -368,8 +360,7 @@ public class TarBuffer {
*/
public void writeRecord(byte[] buf, int offset) throws IOException {
if (debug) {
- System.err.println("WriteRecord: recIdx = " + currRecIdx
- + " blkIdx = " + currBlkIdx);
+ System.err.printf("WriteRecord: recIdx = %d blkIdx = %d%n", currRecIdx, currBlkIdx);
}
if (outStream == null) {
@@ -390,9 +381,7 @@ public class TarBuffer {
writeBlock();
}
- System.arraycopy(buf, offset, blockBuffer,
- (currRecIdx * recordSize),
- recordSize);
+ System.arraycopy(buf, offset, blockBuffer, currRecIdx * recordSize, recordSize);
currRecIdx++;
}
@@ -447,8 +436,7 @@ public class TarBuffer {
if (outStream != null) {
flushBlock();
- if (outStream != System.out
- && outStream != System.err) {
+ if (outStream != System.out && outStream != System.err) {
outStream.close();
outStream = null;
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/tar/TarInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarInputStream.java b/src/main/org/apache/tools/tar/TarInputStream.java
index 151461e..423de75 100644
--- a/src/main/org/apache/tools/tar/TarInputStream.java
+++ b/src/main/org/apache/tools/tar/TarInputStream.java
@@ -215,7 +215,7 @@ public class TarInputStream extends FilterInputStream {
}
skip -= numRead;
}
- return (numToSkip - skip);
+ return numToSkip - skip;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/zip/ZipEightByteInteger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipEightByteInteger.java b/src/main/org/apache/tools/zip/ZipEightByteInteger.java
index 46ba932..12e85bd 100644
--- a/src/main/org/apache/tools/zip/ZipEightByteInteger.java
+++ b/src/main/org/apache/tools/zip/ZipEightByteInteger.java
@@ -136,7 +136,7 @@ public final class ZipEightByteInteger {
public static byte[] getBytes(BigInteger value) {
byte[] result = new byte[8];
long val = value.longValue();
- result[0] = (byte) ((val & BYTE_MASK));
+ result[0] = (byte) (val & BYTE_MASK);
result[BYTE_1] = (byte) ((val & BYTE_1_MASK) >> BYTE_1_SHIFT);
result[BYTE_2] = (byte) ((val & BYTE_2_MASK) >> BYTE_2_SHIFT);
result[BYTE_3] = (byte) ((val & BYTE_3_MASK) >> BYTE_3_SHIFT);
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/zip/ZipFile.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipFile.java b/src/main/org/apache/tools/zip/ZipFile.java
index 6dd69bf..1115665 100644
--- a/src/main/org/apache/tools/zip/ZipFile.java
+++ b/src/main/org/apache/tools/zip/ZipFile.java
@@ -1003,8 +1003,7 @@ public class ZipFile implements Closeable {
if (ent2 == null) {
return -1;
}
- final long val = (ent1.getOffsetEntry().headerOffset
- - ent2.getOffsetEntry().headerOffset);
+ final long val = ent1.getOffsetEntry().headerOffset - ent2.getOffsetEntry().headerOffset;
return val == 0 ? 0 : val < 0 ? -1 : +1;
};
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/zip/ZipLong.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipLong.java b/src/main/org/apache/tools/zip/ZipLong.java
index 69d6ca4..a2fbca0 100644
--- a/src/main/org/apache/tools/zip/ZipLong.java
+++ b/src/main/org/apache/tools/zip/ZipLong.java
@@ -127,7 +127,7 @@ public final class ZipLong implements Cloneable {
* must be non-negative and no larger than <tt>buf.length-4</tt>
*/
public static void putLong(long value, byte[] buf, int offset) {
- buf[offset++] = (byte) ((value & BYTE_MASK));
+ buf[offset++] = (byte) (value & BYTE_MASK);
buf[offset++] = (byte) ((value & BYTE_1_MASK) >> BYTE_1_SHIFT);
buf[offset++] = (byte) ((value & BYTE_2_MASK) >> BYTE_2_SHIFT);
buf[offset] = (byte) ((value & BYTE_3_MASK) >> BYTE_3_SHIFT);
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/main/org/apache/tools/zip/ZipOutputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipOutputStream.java b/src/main/org/apache/tools/zip/ZipOutputStream.java
index 025407b..bec100f 100644
--- a/src/main/org/apache/tools/zip/ZipOutputStream.java
+++ b/src/main/org/apache/tools/zip/ZipOutputStream.java
@@ -1565,8 +1565,8 @@ public class ZipOutputStream extends FilterOutputStream {
}
// requires version 2 as we are going to store length info
// in the data descriptor
- return (isDeflatedToOutputStream(zipMethod))
- ? DATA_DESCRIPTOR_MIN_VERSION : INITIAL_VERSION;
+ return isDeflatedToOutputStream(zipMethod)
+ ? DATA_DESCRIPTOR_MIN_VERSION : INITIAL_VERSION;
}
private boolean isDeflatedToOutputStream(int zipMethod) {
@@ -1613,9 +1613,7 @@ public class ZipOutputStream extends FilterOutputStream {
* @return boolean
*/
private boolean hasZip64Extra(ZipEntry ze) {
- return ze.getExtraField(Zip64ExtendedInformationExtraField
- .HEADER_ID)
- != null;
+ return ze.getExtraField(Zip64ExtendedInformationExtraField.HEADER_ID) != null;
}
/**
http://git-wip-us.apache.org/repos/asf/ant/blob/e2dd6ec7/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
index 2837fa0..9a8d60a 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
@@ -770,7 +770,7 @@ public class ModifiedSelectorTest {
results); // result
} finally {
// cleanup the environment
- (new File(cachefile)).delete();
+ new File(cachefile).delete();
bft.deletePropertiesfile();
}
}
Re: [1/2] ant git commit: Checkstyle: dangling operators
Posted by Stefan Bodewig <bo...@apache.org>.
-1
Gintas please revert this and the three following SonarQube
commits. They are to big, add no value at all and introduce regressions
(you've already found one and revertd it and I fear there are more of
them).
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org