From 5954fec83e5a3011691868890691472e26f5bc2f Mon Sep 17 00:00:00 2001 From: Faisal Hameed Date: Tue, 23 Feb 2016 10:50:12 +0500 Subject: [PATCH] Fixing squid:UselessParenthesesCheck, squid:MissingDeprecatedCheck, squid:S1700 --- .../jenkins/plugins/bfa/db/Semaphore.java | 12 ++++++------ .../plugins/bfa/graphs/ComputerGraphAction.java | 2 +- .../bfa/model/indication/FoundIndication.java | 3 +++ .../jenkins/plugins/bfa/statistics/Statistics.java | 2 +- .../jenkins/plugins/bfa/db/SemaphoreTest.java | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/db/Semaphore.java b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/db/Semaphore.java index f6e0e8f7..172f357f 100644 --- a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/db/Semaphore.java +++ b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/db/Semaphore.java @@ -30,13 +30,13 @@ */ public class Semaphore { - private java.util.concurrent.Semaphore semaphore; + private java.util.concurrent.Semaphore semaphoreLock; /** * Standard constructor. */ public Semaphore() { - semaphore = new java.util.concurrent.Semaphore(0); + semaphoreLock = new java.util.concurrent.Semaphore(0); } /** @@ -46,12 +46,12 @@ public Semaphore() { */ public void acquire() throws InterruptedException { int take; - if (semaphore.availablePermits() < 1) { + if (semaphoreLock.availablePermits() < 1) { take = 1; } else { - take = semaphore.availablePermits(); + take = semaphoreLock.availablePermits(); } - semaphore.acquire(take); + semaphoreLock.acquire(take); } /** @@ -59,6 +59,6 @@ public void acquire() throws InterruptedException { * Releases a permit, returning it to the semaphore. */ public void release() { - semaphore.release(); + semaphoreLock.release(); } } diff --git a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/graphs/ComputerGraphAction.java b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/graphs/ComputerGraphAction.java index a36bb583..de603fb1 100644 --- a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/graphs/ComputerGraphAction.java +++ b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/graphs/ComputerGraphAction.java @@ -117,7 +117,7 @@ private boolean isSlave() { if (computer == null) { return false; } - return (computer.getNode() instanceof Slave); + return computer.getNode() instanceof Slave; } @Override diff --git a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/indication/FoundIndication.java b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/indication/FoundIndication.java index 86efbc56..68cd05c9 100644 --- a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/indication/FoundIndication.java +++ b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/model/indication/FoundIndication.java @@ -50,6 +50,9 @@ public class FoundIndication { */ protected static final String FILE_ENCODING = System.getProperty("file.encoding"); private String matchingFile; + /** + * @deprecated, kept for backwards compatibility. + */ @Deprecated private transient Integer matchingLine; private String pattern; diff --git a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/statistics/Statistics.java b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/statistics/Statistics.java index b63d91e0..67979a60 100644 --- a/src/main/java/com/sonyericsson/jenkins/plugins/bfa/statistics/Statistics.java +++ b/src/main/java/com/sonyericsson/jenkins/plugins/bfa/statistics/Statistics.java @@ -198,7 +198,7 @@ public Statistics(@JsonProperty("projectName") String projectName, } /** - * Deprecated, kept for backwards compatibility. + * @deprecated, kept for backwards compatibility. * @param projectName the project name. * @param buildNumber the build number. * @param startingTime the starting time. diff --git a/src/test/java/com/sonyericsson/jenkins/plugins/bfa/db/SemaphoreTest.java b/src/test/java/com/sonyericsson/jenkins/plugins/bfa/db/SemaphoreTest.java index f11145dd..f6b76d14 100644 --- a/src/test/java/com/sonyericsson/jenkins/plugins/bfa/db/SemaphoreTest.java +++ b/src/test/java/com/sonyericsson/jenkins/plugins/bfa/db/SemaphoreTest.java @@ -43,7 +43,7 @@ public class SemaphoreTest { @Test(timeout = 20000) public void testAcquireAndRelease() throws Exception { Semaphore semaphore = new Semaphore(); - java.util.concurrent.Semaphore innerSemaphore = Whitebox.getInternalState(semaphore, "semaphore"); + java.util.concurrent.Semaphore innerSemaphore = Whitebox.getInternalState(semaphore, "semaphoreLock"); assertEquals("The semaphore should have no available permits to start with", 0, innerSemaphore.availablePermits()); semaphore.release();