From 92b4d736ed08613824523d2acd033cc39b56b412 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Thu, 13 Jun 2013 15:38:16 +0200 Subject: [PATCH] Fix some quality flaws --- .../java/org/sonar/batch/bootstrap/BatchSettings.java | 3 +-- .../src/main/java/org/sonar/batch/index/Bucket.java | 1 - .../sonar/core/issue/db/UpdateConflictResolver.java | 2 +- .../src/main/java/org/sonar/api/utils/ZipUtils.java | 10 +++++----- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchSettings.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchSettings.java index a50b3d40eb0..d3852be72f7 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchSettings.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchSettings.java @@ -31,7 +31,6 @@ import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import javax.annotation.Nullable; - import java.util.List; import java.util.Map; @@ -47,7 +46,7 @@ public class BatchSettings extends Settings { private Map savedProperties; public BatchSettings(BootstrapSettings bootstrapSettings, PropertyDefinitions propertyDefinitions, - ServerClient client, Configuration deprecatedConfiguration) { + ServerClient client, Configuration deprecatedConfiguration) { super(propertyDefinitions); this.bootstrapSettings = bootstrapSettings; this.client = client; diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/Bucket.java b/sonar-batch/src/main/java/org/sonar/batch/index/Bucket.java index 6c253dd7e19..d44e9613e11 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/Bucket.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/Bucket.java @@ -26,7 +26,6 @@ import org.sonar.api.measures.Measure; import org.sonar.api.measures.MeasuresFilter; import org.sonar.api.measures.MeasuresFilters; import org.sonar.api.resources.Resource; -import org.sonar.api.rules.Violation; import org.sonar.api.utils.SonarException; import java.util.Collection; diff --git a/sonar-core/src/main/java/org/sonar/core/issue/db/UpdateConflictResolver.java b/sonar-core/src/main/java/org/sonar/core/issue/db/UpdateConflictResolver.java index 5ebe79bf908..7a267ab8153 100644 --- a/sonar-core/src/main/java/org/sonar/core/issue/db/UpdateConflictResolver.java +++ b/sonar-core/src/main/java/org/sonar/core/issue/db/UpdateConflictResolver.java @@ -33,7 +33,7 @@ import java.util.Date; */ class UpdateConflictResolver { - private final Logger LOG = LoggerFactory.getLogger(IssueStorage.class); + private static final Logger LOG = LoggerFactory.getLogger(IssueStorage.class); public void resolve(DefaultIssue issue, IssueMapper mapper) { LOG.debug("Resolve conflict on issue " + issue.key()); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java index 2d21928b0a4..0b6dfae9842 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java @@ -128,14 +128,14 @@ public final class ZipUtils { } - private static void _zip(String entryName, InputStream in, ZipOutputStream out) throws IOException { + private static void doZip(String entryName, InputStream in, ZipOutputStream out) throws IOException { ZipEntry zentry = new ZipEntry(entryName); out.putNextEntry(zentry); IOUtils.copy(in, out); out.closeEntry(); } - private static void _zip(String entryName, File file, ZipOutputStream out) throws IOException { + private static void doZip(String entryName, File file, ZipOutputStream out) throws IOException { if (file.isDirectory()) { entryName += '/'; ZipEntry zentry = new ZipEntry(entryName); @@ -143,14 +143,14 @@ public final class ZipUtils { out.closeEntry(); File[] files = file.listFiles(); for (int i = 0, len = files.length; i < len; i++) { - _zip(entryName + files[i].getName(), files[i], out); + doZip(entryName + files[i].getName(), files[i], out); } } else { InputStream in = null; try { in = new BufferedInputStream(new FileInputStream(file)); - _zip(entryName, in, out); + doZip(entryName, in, out); } finally { IOUtils.closeQuietly(in); } @@ -160,7 +160,7 @@ public final class ZipUtils { private static void zip(File file, ZipOutputStream out) throws IOException { for (File child : file.listFiles()) { String name = child.getName(); - _zip(name, child, out); + doZip(name, child, out); } } -- 2.39.5