You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2016/12/21 15:57:57 UTC
[01/11] ant git commit: false positive for spurious wakeups
Repository: ant
Updated Branches:
refs/heads/1.9.x db6204470 -> ae7f01f64
false positive for spurious wakeups
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/9d53feac
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/9d53feac
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/9d53feac
Branch: refs/heads/1.9.x
Commit: 9d53feac73b23fd8b4e4fb2b97e64b46d4c317db
Parents: db62044
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 14:35:05 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 14:35:05 2016 +0100
----------------------------------------------------------------------
src/main/org/apache/tools/ant/taskdefs/Parallel.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/9d53feac/src/main/org/apache/tools/ant/taskdefs/Parallel.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Parallel.java b/src/main/org/apache/tools/ant/taskdefs/Parallel.java
index c4f5c9e..0f8512a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Parallel.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Parallel.java
@@ -352,7 +352,7 @@ public class Parallel extends Task
// System.out.println("Thread " + i + " is still
// alive ");
// still running - wait for it
- semaphore.wait();
+ semaphore.wait(); //NOSONAR
continue outer2;
}
}
[10/11] ant git commit: false positives and trivial fixes
Posted by bo...@apache.org.
false positives and trivial fixes
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/f74ca522
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/f74ca522
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/f74ca522
Branch: refs/heads/1.9.x
Commit: f74ca5229940d6b8aa532e560a9d4832c1a2d2d7
Parents: 6016294
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 16:57:10 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 16:57:10 2016 +0100
----------------------------------------------------------------------
.../org/apache/tools/ant/filters/SortFilter.java | 2 +-
.../org/apache/tools/ant/taskdefs/ExecuteJava.java | 2 +-
.../org/apache/tools/ant/taskdefs/Manifest.java | 2 +-
.../tools/ant/types/resources/ArchiveResource.java | 2 +-
.../tools/ant/types/resources/MappedResource.java | 2 +-
.../ant/types/resources/ResourceDecorator.java | 16 +++++++++++++++-
.../tools/ant/types/resources/StringResource.java | 11 +++++++++++
.../tools/ant/types/resources/URLResource.java | 2 +-
.../org/apache/tools/ant/util/ResourceUtils.java | 4 ++--
src/main/org/apache/tools/bzip2/BlockSort.java | 2 +-
src/main/org/apache/tools/tar/TarUtils.java | 2 +-
11 files changed, 36 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/filters/SortFilter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/SortFilter.java b/src/main/org/apache/tools/ant/filters/SortFilter.java
index 471660c..44e8d72 100644
--- a/src/main/org/apache/tools/ant/filters/SortFilter.java
+++ b/src/main/org/apache/tools/ant/filters/SortFilter.java
@@ -362,7 +362,7 @@ public final class SortFilter extends BaseParamFilterReader
if (reverse) {
Collections.sort(lines, new Comparator<String>() {
public int compare(String s1, String s2) {
- return (-s1.compareTo(s2));
+ return (-s1.compareTo(s2)); //NOSONAR
}
});
} else {
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
index ef16c5c..b36f2fe 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
@@ -151,7 +151,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
+ " is not declared static");
}
if (timeout == null) {
- run();
+ run(); //NOSONAR
} else {
thread = new Thread(this, "ExecuteJava");
Task currentThreadTask
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/taskdefs/Manifest.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java
index 06c74dd..0d7c05e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java
@@ -1066,7 +1066,7 @@ public class Manifest {
try {
write(new PrintWriter(sw));
} catch (IOException e) {
- return null;
+ return "";
}
return sw.toString();
}
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/types/resources/ArchiveResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/ArchiveResource.java b/src/main/org/apache/tools/ant/types/resources/ArchiveResource.java
index 308de03..09ce032 100644
--- a/src/main/org/apache/tools/ant/types/resources/ArchiveResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/ArchiveResource.java
@@ -216,7 +216,7 @@ public abstract class ArchiveResource extends Resource {
if (isReference()) {
return getCheckedRef().equals(another);
}
- if (another == null || !(another.getClass().equals(getClass()))) {
+ if (another == null || another.getClass() != getClass()) {
return false;
}
ArchiveResource r = (ArchiveResource) another;
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/types/resources/MappedResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/MappedResource.java b/src/main/org/apache/tools/ant/types/resources/MappedResource.java
index 339c88b..c18cbf4 100644
--- a/src/main/org/apache/tools/ant/types/resources/MappedResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/MappedResource.java
@@ -95,7 +95,7 @@ public class MappedResource extends ResourceDecorator {
*/
@Override
public boolean equals(Object other) {
- if (other == null || !other.getClass().equals(getClass())) {
+ if (other == null || other.getClass() != getClass()) {
return false;
}
MappedResource m = (MappedResource) other;
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java b/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java
index 3806cf2..9eb8c1d 100644
--- a/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java
+++ b/src/main/org/apache/tools/ant/types/resources/ResourceDecorator.java
@@ -74,6 +74,7 @@ public abstract class ResourceDecorator extends Resource {
* Get the name of the resource.
* @return the name of the wrapped resource.
*/
+ @Override
public String getName() {
return getResource().getName();
}
@@ -82,6 +83,7 @@ public abstract class ResourceDecorator extends Resource {
* The exists attribute tells whether a file exists.
* @return true if this resource exists.
*/
+ @Override
public boolean isExists() {
return getResource().isExists();
}
@@ -92,6 +94,7 @@ public abstract class ResourceDecorator extends Resource {
* @return 0 if the resource does not exist to mirror the behavior
* of {@link java.io.File File}.
*/
+ @Override
public long getLastModified() {
return getResource().getLastModified();
}
@@ -100,6 +103,7 @@ public abstract class ResourceDecorator extends Resource {
* Tells if the resource is a directory.
* @return boolean flag indicating if the resource is a directory.
*/
+ @Override
public boolean isDirectory() {
return getResource().isDirectory();
}
@@ -109,6 +113,7 @@ public abstract class ResourceDecorator extends Resource {
* @return the size, as a long, 0 if the Resource does not exist (for
* compatibility with java.io.File), or UNKNOWN_SIZE if not known.
*/
+ @Override
public long getSize() {
return getResource().getSize();
}
@@ -121,6 +126,7 @@ public abstract class ResourceDecorator extends Resource {
* @throws UnsupportedOperationException if InputStreams are not
* supported for this Resource type.
*/
+ @Override
public InputStream getInputStream() throws IOException {
return getResource().getInputStream();
}
@@ -133,6 +139,7 @@ public abstract class ResourceDecorator extends Resource {
* @throws UnsupportedOperationException if OutputStreams are not
* supported for this Resource type.
*/
+ @Override
public OutputStream getOutputStream() throws IOException {
return getResource().getOutputStream();
}
@@ -141,6 +148,7 @@ public abstract class ResourceDecorator extends Resource {
* Fulfill the ResourceCollection contract.
* @return whether this Resource is a FileProvider.
*/
+ @Override
public boolean isFilesystemOnly() {
return as(FileProvider.class) != null;
}
@@ -149,6 +157,7 @@ public abstract class ResourceDecorator extends Resource {
* Overrides the base version.
* @param r the Reference to set.
*/
+ @Override
public void setRefid(Reference r) {
if (resource != null) {
throw noChildrenAllowed();
@@ -159,6 +168,7 @@ public abstract class ResourceDecorator extends Resource {
/**
* {@inheritDoc}
*/
+ @Override
public <T> T as(Class<T> clazz) {
return getResource().as(clazz);
}
@@ -166,6 +176,7 @@ public abstract class ResourceDecorator extends Resource {
/**
* {@inheritDoc}
*/
+ @Override
public int compareTo(Resource other) {
if (other == this) {
return 0;
@@ -181,7 +192,9 @@ public abstract class ResourceDecorator extends Resource {
* Get the hash code for this Resource.
* @return hash code as int.
*/
- public int hashCode() {
+ @Override
+ public int hashCode() { // NOSONAR
+ // super.equals + compareTo are consistent with this implementation
return (getClass().hashCode() << 4) | getResource().hashCode();
}
@@ -267,4 +280,5 @@ public abstract class ResourceDecorator extends Resource {
throw new BuildException("you can't change the size of a "
+ getDataTypeName());
}
+
}
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/types/resources/StringResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/StringResource.java b/src/main/org/apache/tools/ant/types/resources/StringResource.java
index b12a2e1..fe7b295 100644
--- a/src/main/org/apache/tools/ant/types/resources/StringResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/StringResource.java
@@ -71,6 +71,7 @@ public class StringResource extends Resource {
* Enforce String immutability.
* @param s the new name/value for this StringResource.
*/
+ @Override
public synchronized void setName(String s) {
if (getName() != null) {
throw new BuildException(new ImmutableResourceException());
@@ -90,6 +91,7 @@ public class StringResource extends Resource {
* Synchronize access.
* @return the name/value of this StringResource.
*/
+ @Override
public synchronized String getName() {
return super.getName();
}
@@ -107,6 +109,7 @@ public class StringResource extends Resource {
*
* @return true if this resource exists.
*/
+ @Override
public boolean isExists() {
return getValue() != null;
}
@@ -144,6 +147,7 @@ public class StringResource extends Resource {
* @return the size, as a long, 0 if the Resource does not exist (for
* compatibility with java.io.File), or UNKNOWN_SIZE if not known.
*/
+ @Override
public synchronized long getSize() {
return isReference() ? ((Resource) getCheckedRef()).getSize()
: getContent().length();
@@ -153,7 +157,9 @@ public class StringResource extends Resource {
* Get the hash code for this Resource.
* @return hash code as int.
*/
+ @Override
public synchronized int hashCode() {
+ // super.equals + super.compareTo are consistent with this implementation
if (isReference()) {
return getCheckedRef().hashCode();
}
@@ -166,6 +172,7 @@ public class StringResource extends Resource {
* @return the string contents of the resource.
* @since Ant 1.7
*/
+ @Override
public String toString() {
return String.valueOf(getContent());
}
@@ -178,6 +185,7 @@ public class StringResource extends Resource {
* @throws UnsupportedOperationException if InputStreams are not
* supported for this Resource type.
*/
+ @Override
public synchronized InputStream getInputStream() throws IOException {
if (isReference()) {
return ((Resource) getCheckedRef()).getInputStream();
@@ -198,6 +206,7 @@ public class StringResource extends Resource {
* @throws UnsupportedOperationException if OutputStreams are not
* supported for this Resource type.
*/
+ @Override
public synchronized OutputStream getOutputStream() throws IOException {
if (isReference()) {
return ((Resource) getCheckedRef()).getOutputStream();
@@ -212,6 +221,7 @@ public class StringResource extends Resource {
* Overrides the super version.
* @param r the Reference to set.
*/
+ @Override
public void setRefid(Reference r) {
if (encoding != DEFAULT_ENCODING) {
throw tooManyAttributes();
@@ -250,6 +260,7 @@ public class StringResource extends Resource {
baos = (ByteArrayOutputStream) out;
}
+ @Override
public void close() throws IOException {
super.close();
String result = encoding == null
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/types/resources/URLResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/URLResource.java b/src/main/org/apache/tools/ant/types/resources/URLResource.java
index 70d6c9b..027a9bd 100644
--- a/src/main/org/apache/tools/ant/types/resources/URLResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/URLResource.java
@@ -313,7 +313,7 @@ public class URLResource extends Resource implements URLProvider {
if (isReference()) {
return getCheckedRef().equals(another);
}
- if (another == null || !(another.getClass().equals(getClass()))) {
+ if (another == null || another.getClass() != getClass()) {
return false;
}
URLResource otheru = (URLResource) another;
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/src/main/org/apache/tools/ant/util/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/ResourceUtils.java b/src/main/org/apache/tools/ant/util/ResourceUtils.java
index 6397f71..518ed5a 100644
--- a/src/main/org/apache/tools/ant/util/ResourceUtils.java
+++ b/src/main/org/apache/tools/ant/util/ResourceUtils.java
@@ -72,7 +72,7 @@ public class ResourceUtils {
*/
public static final String ISO_8859_1 = "ISO-8859-1";
- private static final long MAX_IO_CHUNK_SIZE = 16*1024*1024; // 16 MB
+ private static final long MAX_IO_CHUNK_SIZE = 16*1024*1024l; // 16 MB
/**
* Tells which source files should be reprocessed based on the
@@ -630,7 +630,7 @@ public class ResourceUtils {
}
expected = in1.readLine();
}
- return in2.readLine() == null ? 0 : -1;
+ return in2.readLine() == null ? 0 : -1; //NOSONAR
} finally {
FileUtils.close(in1);
FileUtils.close(in2);
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/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 b382470..073b223 100644
--- a/src/main/org/apache/tools/bzip2/BlockSort.java
+++ b/src/main/org/apache/tools/bzip2/BlockSort.java
@@ -975,7 +975,7 @@ class BlockSort {
runningOrder[i] = i;
}
- for (int h = 364; h != 1;) {
+ for (int h = 364; h != 1;) { //NOSONAR
h /= 3;
for (int i = h; i <= 255; i++) {
final int vv = runningOrder[i];
http://git-wip-us.apache.org/repos/asf/ant/blob/f74ca522/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 12bd1da..f86154e 100644
--- a/src/main/org/apache/tools/tar/TarUtils.java
+++ b/src/main/org/apache/tools/tar/TarUtils.java
@@ -191,7 +191,7 @@ public class TarUtils {
if (negative) {
// 2's complement
val--;
- val ^= (long) Math.pow(2, (length - 1) * 8) - 1;
+ val ^= (long) Math.pow(2, (length - 1) * 8.0) - 1;
}
return negative ? -val : val;
}
[02/11] ant git commit: deal with spurious wakeups
Posted by bo...@apache.org.
deal with spurious wakeups
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/f79b8e93
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/f79b8e93
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/f79b8e93
Branch: refs/heads/1.9.x
Commit: f79b8e9354f3108954ad9b50568ccb3cba6a8587
Parents: 9d53fea
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 14:41:17 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 15:18:05 2016 +0100
----------------------------------------------------------------------
src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java | 5 +++++
src/main/org/apache/tools/ant/taskdefs/Parallel.java | 8 +++++++-
src/main/org/apache/tools/ant/util/OutputStreamFunneler.java | 8 +++++++-
src/main/org/apache/tools/ant/util/WorkerAnt.java | 8 ++++++--
4 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/f79b8e93/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
index b78b9a6..ce6276b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
@@ -53,6 +53,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
private Long timeout = null;
private volatile Throwable caught = null;
private volatile boolean timedOut = false;
+ private boolean done = false;
private Thread thread = null;
/**
@@ -168,7 +169,9 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
thread.start();
w.start();
try {
+ while (!done) {
wait();
+ }
} catch (InterruptedException e) {
// ignore
}
@@ -228,6 +231,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
perm.restoreSecurityManager();
}
synchronized (this) {
+ done = true;
notifyAll();
}
}
@@ -243,6 +247,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
timedOut = true;
thread.interrupt();
}
+ done = true;
notifyAll();
}
http://git-wip-us.apache.org/repos/asf/ant/blob/f79b8e93/src/main/org/apache/tools/ant/taskdefs/Parallel.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Parallel.java b/src/main/org/apache/tools/ant/taskdefs/Parallel.java
index 0f8512a..469ba41 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Parallel.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Parallel.java
@@ -312,7 +312,13 @@ public class Parallel extends Task
Thread timeoutThread = new Thread() {
public synchronized void run() {
try {
- wait(timeout);
+ final long start = System.currentTimeMillis();
+ final long end = start + timeout;
+ long now = System.currentTimeMillis();
+ while (now < end) {
+ wait(end - now);
+ now = System.currentTimeMillis();
+ }
synchronized (semaphore) {
stillRunning = false;
timedOut = true;
http://git-wip-us.apache.org/repos/asf/ant/blob/f79b8e93/src/main/org/apache/tools/ant/util/OutputStreamFunneler.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/OutputStreamFunneler.java b/src/main/org/apache/tools/ant/util/OutputStreamFunneler.java
index 6694c3f..9b4cef3 100644
--- a/src/main/org/apache/tools/ant/util/OutputStreamFunneler.java
+++ b/src/main/org/apache/tools/ant/util/OutputStreamFunneler.java
@@ -143,8 +143,14 @@ public class OutputStreamFunneler {
if (!funnel.closed) {
try {
if (timeoutMillis > 0) {
+ final long start = System.currentTimeMillis();
+ final long end = start + timeoutMillis;
+ long now = System.currentTimeMillis();
try {
- wait(timeoutMillis);
+ while (now < end) {
+ wait(end - now);
+ now = System.currentTimeMillis();
+ }
} catch (InterruptedException eyeEx) {
//ignore
}
http://git-wip-us.apache.org/repos/asf/ant/blob/f79b8e93/src/main/org/apache/tools/ant/util/WorkerAnt.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/WorkerAnt.java b/src/main/org/apache/tools/ant/util/WorkerAnt.java
index 288d74d..768f387 100644
--- a/src/main/org/apache/tools/ant/util/WorkerAnt.java
+++ b/src/main/org/apache/tools/ant/util/WorkerAnt.java
@@ -117,9 +117,13 @@ public class WorkerAnt extends Thread {
* @throws InterruptedException if the execution was interrupted
*/
public void waitUntilFinished(long timeout) throws InterruptedException {
+ final long start = System.currentTimeMillis();
+ final long end = start + timeout;
synchronized (notify) {
- if (!finished) {
- notify.wait(timeout);
+ long now = System.currentTimeMillis();
+ while (!finished && now < end) {
+ notify.wait(end - now);
+ now = System.currentTimeMillis();
}
}
}
[07/11] ant git commit: don't want to cause compile-time dependencies
Posted by bo...@apache.org.
don't want to cause compile-time dependencies
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/70eaedac
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/70eaedac
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/70eaedac
Branch: refs/heads/1.9.x
Commit: 70eaedacaf16df2f473f3885663735c6e129cfdd
Parents: 0b6fbd3
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 15:45:20 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 16:00:42 2016 +0100
----------------------------------------------------------------------
src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java | 2 +-
src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/70eaedac/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java b/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
index 182059c..10620ee 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
@@ -341,7 +341,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
}
if (traceConfiguration != null) {
- if ("org.apache.xalan.transformer.TransformerImpl"
+ if ("org.apache.xalan.transformer.TransformerImpl" //NOSONAR
.equals(transformer.getClass().getName())) {
try {
final Class traceSupport =
http://git-wip-us.apache.org/repos/asf/ant/blob/70eaedac/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java b/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
index 2108a68..ff72ad4 100644
--- a/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
+++ b/src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
@@ -67,7 +67,7 @@ public class KaffeRmic extends DefaultRmicAdapter {
}
cmd.setExecutable(c.getName());
- if (!c.getName().equals(RMIC_CLASSNAMES[RMIC_CLASSNAMES.length - 1])) {
+ if (!c.getName().equals(RMIC_CLASSNAMES[RMIC_CLASSNAMES.length - 1])) { //NOSONAR
// only supported since Kaffe 1.1.2
cmd.createArgument().setValue("-verbose");
getRmic().log(Commandline.describeCommand(cmd));
[08/11] ant git commit: fix SimpleDateFormat cases (the instances are
used single threaded)
Posted by bo...@apache.org.
fix SimpleDateFormat cases (the instances are used single threaded)
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/8e56f57a
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/8e56f57a
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/8e56f57a
Branch: refs/heads/1.9.x
Commit: 8e56f57ab5a1250379ba486048c52ef2e29c882d
Parents: 9d11861
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 16:01:47 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 16:01:47 2016 +0100
----------------------------------------------------------------------
.../tools/ant/taskdefs/cvslib/ChangeLogParser.java | 17 ++++++++---------
.../tools/ant/taskdefs/cvslib/ChangeLogWriter.java | 14 +++++++-------
2 files changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/8e56f57a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
index 0096aad..b088107 100644
--- a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
+++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
@@ -44,21 +44,16 @@ class ChangeLogParser {
private static final int GET_REVISION = 4;
private static final int GET_PREVIOUS_REV = 5;
-// FIXME formatters are not thread-safe
-
/** input format for dates read in from cvs log */
- private static final SimpleDateFormat INPUT_DATE
+ private final SimpleDateFormat inputDate
= new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);
/**
* New formatter used to parse CVS date/timestamp.
*/
- private static final SimpleDateFormat CVS1129_INPUT_DATE =
+ private final SimpleDateFormat cvs1129InputDate =
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z", Locale.US);
static {
- TimeZone utc = TimeZone.getTimeZone("UTC");
- INPUT_DATE.setTimeZone(utc);
- CVS1129_INPUT_DATE.setTimeZone(utc);
}
//The following is data used while processing stdout of CVS command
@@ -102,6 +97,10 @@ class ChangeLogParser {
for (int i = 0; i < moduleNames.length; i++) {
moduleNameLengths[i] = moduleNames[i].length();
}
+
+ TimeZone utc = TimeZone.getTimeZone("UTC");
+ inputDate.setTimeZone(utc);
+ cvs1129InputDate.setTimeZone(utc);
}
/**
@@ -297,10 +296,10 @@ class ChangeLogParser {
*/
private Date parseDate(final String date) {
try {
- return INPUT_DATE.parse(date);
+ return inputDate.parse(date);
} catch (ParseException e) {
try {
- return CVS1129_INPUT_DATE.parse(date);
+ return cvs1129InputDate.parse(date);
} catch (ParseException e2) {
throw new IllegalStateException("Invalid date format: " + date);
}
http://git-wip-us.apache.org/repos/asf/ant/blob/8e56f57a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java
index 2385e51..7e43f3a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java
@@ -34,18 +34,18 @@ import org.w3c.dom.Element;
*/
public class ChangeLogWriter {
/** output format for dates written to xml file */
- private static final SimpleDateFormat OUTPUT_DATE
+ private final SimpleDateFormat outputDate
= new SimpleDateFormat("yyyy-MM-dd");
/** output format for times written to xml file */
- private static final SimpleDateFormat OUTPUT_TIME
+ private static SimpleDateFormat outputTime
= new SimpleDateFormat("HH:mm");
/** stateless helper for writing the XML document */
private static final DOMElementWriter DOM_WRITER = new DOMElementWriter();
- static {
+ public ChangeLogWriter() {
TimeZone utc = TimeZone.getTimeZone("UTC");
- OUTPUT_DATE.setTimeZone(utc);
- OUTPUT_TIME.setTimeZone(utc);
+ outputDate.setTimeZone(utc);
+ outputTime.setTimeZone(utc);
}
/**
@@ -87,9 +87,9 @@ public class ChangeLogWriter {
final CVSEntry entry) throws IOException {
Element ent = doc.createElement("entry");
DOMUtils.appendTextElement(ent, "date",
- OUTPUT_DATE.format(entry.getDate()));
+ outputDate.format(entry.getDate()));
DOMUtils.appendTextElement(ent, "time",
- OUTPUT_TIME.format(entry.getDate()));
+ outputTime.format(entry.getDate()));
DOMUtils.appendCDATAElement(ent, "author", entry.getAuthor());
final Enumeration enumeration = entry.getFiles().elements();
[11/11] ant git commit: compareTo requires equals requires hashCode
Posted by bo...@apache.org.
compareTo requires equals requires hashCode
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/ae7f01f6
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/ae7f01f6
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/ae7f01f6
Branch: refs/heads/1.9.x
Commit: ae7f01f64069421018c841cffce45bff0a3da339
Parents: f74ca52
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 16:57:31 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 16:57:31 2016 +0100
----------------------------------------------------------------------
.../ant/taskdefs/optional/EchoProperties.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/ae7f01f6/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
index d8ef51a..30bcc75 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/EchoProperties.java
@@ -440,6 +440,24 @@ public class EchoProperties extends Task {
Tuple that = (Tuple) o;
return key.compareTo(that.key);
}
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (o == null || o.getClass() != getClass()) {
+ return false;
+ }
+ Tuple that = (Tuple) o;
+ return (key == null ? that.key == null : key.equals(that.key))
+ && (value == null ? that.value == null : value.equals(that.value));
+ }
+
+ @Override
+ public int hashCode() {
+ return key != null ? key.hashCode() : 0;
+ }
}
private List sortProperties(Properties props) {
[06/11] ant git commit: could have used isAssignableFrom since Ant
1.9.0
Posted by bo...@apache.org.
could have used isAssignableFrom since Ant 1.9.0
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/9d118612
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/9d118612
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/9d118612
Branch: refs/heads/1.9.x
Commit: 9d118612833b8dddb6293debeb8e82ab5c256b9f
Parents: 3e235a8
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 15:45:06 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 16:00:42 2016 +0100
----------------------------------------------------------------------
src/main/org/apache/tools/ant/taskdefs/AntStructure.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/9d118612/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
index 707f4b9..8554a2a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
@@ -390,8 +390,7 @@ public class AntStructure extends Task {
} catch (final IllegalAccessException ie) {
sb.append("CDATA ");
}
- } else if (type.getSuperclass() != null
- && type.getSuperclass().getName().equals("java.lang.Enum")) {
+ } else if (Enum.class.isAssignableFrom(type)) {
try {
final Object[] values = (Object[]) type.getMethod("values", (Class[]) null)
.invoke(null, (Object[]) null);
[04/11] ant git commit: DataType already implements Cloneable
Posted by bo...@apache.org.
DataType already implements Cloneable
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/3e235a8f
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/3e235a8f
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/3e235a8f
Branch: refs/heads/1.9.x
Commit: 3e235a8f5ac5ea6421ab0c5565f45444f387c667
Parents: 0d64816
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 15:47:51 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 16:00:42 2016 +0100
----------------------------------------------------------------------
src/main/org/apache/tools/ant/types/AntFilterReader.java | 3 +--
src/main/org/apache/tools/ant/types/FilterChain.java | 3 +--
src/main/org/apache/tools/ant/types/Mapper.java | 2 +-
src/main/org/apache/tools/ant/types/XMLCatalog.java | 2 +-
4 files changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/3e235a8f/src/main/org/apache/tools/ant/types/AntFilterReader.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/AntFilterReader.java b/src/main/org/apache/tools/ant/types/AntFilterReader.java
index 20c41bc..bdc1c31 100644
--- a/src/main/org/apache/tools/ant/types/AntFilterReader.java
+++ b/src/main/org/apache/tools/ant/types/AntFilterReader.java
@@ -27,8 +27,7 @@ import org.apache.tools.ant.Project;
* An AntFilterReader is a wrapper class that encloses the classname
* and configuration of a Configurable FilterReader.
*/
-public final class AntFilterReader
- extends DataType implements Cloneable {
+public final class AntFilterReader extends DataType {
private String className;
http://git-wip-us.apache.org/repos/asf/ant/blob/3e235a8f/src/main/org/apache/tools/ant/types/FilterChain.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/FilterChain.java b/src/main/org/apache/tools/ant/types/FilterChain.java
index b495a5a..da7d967 100644
--- a/src/main/org/apache/tools/ant/types/FilterChain.java
+++ b/src/main/org/apache/tools/ant/types/FilterChain.java
@@ -45,8 +45,7 @@ import org.apache.tools.ant.filters.TokenFilter;
* FilterChain may contain a chained set of filter readers.
*
*/
-public class FilterChain extends DataType
- implements Cloneable {
+public class FilterChain extends DataType {
private Vector<Object> filterReaders = new Vector<Object>();
http://git-wip-us.apache.org/repos/asf/ant/blob/3e235a8f/src/main/org/apache/tools/ant/types/Mapper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/Mapper.java b/src/main/org/apache/tools/ant/types/Mapper.java
index 941e8dd..c02e782 100644
--- a/src/main/org/apache/tools/ant/types/Mapper.java
+++ b/src/main/org/apache/tools/ant/types/Mapper.java
@@ -30,7 +30,7 @@ import org.apache.tools.ant.util.FileNameMapper;
* Element to define a FileNameMapper.
*
*/
-public class Mapper extends DataType implements Cloneable {
+public class Mapper extends DataType {
// CheckStyle:VisibilityModifier OFF - bc
protected MapperType type = null;
http://git-wip-us.apache.org/repos/asf/ant/blob/3e235a8f/src/main/org/apache/tools/ant/types/XMLCatalog.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/XMLCatalog.java b/src/main/org/apache/tools/ant/types/XMLCatalog.java
index bd9be43..2edd5a1 100644
--- a/src/main/org/apache/tools/ant/types/XMLCatalog.java
+++ b/src/main/org/apache/tools/ant/types/XMLCatalog.java
@@ -119,7 +119,7 @@ import org.xml.sax.XMLReader;
*
*/
public class XMLCatalog extends DataType
- implements Cloneable, EntityResolver, URIResolver {
+ implements EntityResolver, URIResolver {
/** helper for some File.toURL connversions */
private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
[03/11] ant git commit: whitespace
Posted by bo...@apache.org.
whitespace
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/0b6fbd33
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/0b6fbd33
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/0b6fbd33
Branch: refs/heads/1.9.x
Commit: 0b6fbd33814cb5264cdf79886013ddea1beb177d
Parents: f79b8e9
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 15:18:45 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 15:18:45 2016 +0100
----------------------------------------------------------------------
src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/0b6fbd33/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
index ce6276b..ef16c5c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
+++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
@@ -169,9 +169,9 @@ public class ExecuteJava implements Runnable, TimeoutObserver {
thread.start();
w.start();
try {
- while (!done) {
- wait();
- }
+ while (!done) {
+ wait();
+ }
} catch (InterruptedException e) {
// ignore
}
[05/11] ant git commit: false positive for class name comparison
Posted by bo...@apache.org.
false positive for class name comparison
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/0d648167
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/0d648167
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/0d648167
Branch: refs/heads/1.9.x
Commit: 0d648167bcf6eb4384ab04f7b9d63494208b85b6
Parents: 70eaeda
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 15:45:33 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 16:00:42 2016 +0100
----------------------------------------------------------------------
src/main/org/apache/tools/ant/types/Permissions.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/0d648167/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 96da71b..d0559c7 100644
--- a/src/main/org/apache/tools/ant/types/Permissions.java
+++ b/src/main/org/apache/tools/ant/types/Permissions.java
@@ -302,7 +302,7 @@ public class Permissions {
* @param perm The permission to check against.
*/
boolean matches(final java.security.Permission perm) {
- if (!className.equals(perm.getClass().getName())) {
+ if (!className.equals(perm.getClass().getName())) { //NOSONAR
return false;
}
if (name != null) {
[09/11] ant git commit: fix Serializable classes that were in fact
not Serializable
Posted by bo...@apache.org.
fix Serializable classes that were in fact not Serializable
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/60162945
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/60162945
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/60162945
Branch: refs/heads/1.9.x
Commit: 60162945ddae9876f4436094a63487b11b6deee4
Parents: 8e56f57
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed Dec 21 16:08:28 2016 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed Dec 21 16:08:28 2016 +0100
----------------------------------------------------------------------
src/main/org/apache/tools/ant/RuntimeConfigurable.java | 5 +++--
.../org/apache/tools/zip/UnsupportedZipFeatureException.java | 8 ++++----
2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/60162945/src/main/org/apache/tools/ant/RuntimeConfigurable.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/RuntimeConfigurable.java b/src/main/org/apache/tools/ant/RuntimeConfigurable.java
index 26f68df..0aafccb 100644
--- a/src/main/org/apache/tools/ant/RuntimeConfigurable.java
+++ b/src/main/org/apache/tools/ant/RuntimeConfigurable.java
@@ -52,7 +52,8 @@ public class RuntimeConfigurable implements Serializable {
private String elementTag = null;
/** List of child element wrappers. */
- private List<RuntimeConfigurable> children = null;
+ // picking ArrayList rather than List as arrayList is Serializable
+ private ArrayList<RuntimeConfigurable> children = null;
/** The element to configure. It is only used during
* maybeConfigure.
@@ -589,7 +590,7 @@ public class RuntimeConfigurable implements Serializable {
// Children (this is a shadow of UnknownElement#children)
if (r.children != null) {
- List<RuntimeConfigurable> newChildren = new ArrayList<RuntimeConfigurable>();
+ ArrayList<RuntimeConfigurable> newChildren = new ArrayList<RuntimeConfigurable>();
newChildren.addAll(r.children);
if (children != null) {
newChildren.addAll(children);
http://git-wip-us.apache.org/repos/asf/ant/blob/60162945/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java b/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
index 21d48f2..291d494 100644
--- a/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
+++ b/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
@@ -28,8 +28,8 @@ import java.util.zip.ZipException;
public class UnsupportedZipFeatureException extends ZipException {
private final Feature reason;
- private final ZipEntry entry;
- private static final long serialVersionUID = 4430521921766595597L;
+ private transient final ZipEntry entry;
+ private static final long serialVersionUID = 20161221L;
/**
* Creates an exception.
@@ -61,7 +61,7 @@ public class UnsupportedZipFeatureException extends ZipException {
/**
* ZIP Features that may or may not be supported.
*/
- public static class Feature {
+ public static class Feature implements java.io.Serializable {
/**
* The entry is encrypted.
*/
@@ -86,4 +86,4 @@ public class UnsupportedZipFeatureException extends ZipException {
return name;
}
}
-}
\ No newline at end of file
+}