From 9fe28c5e6f56bd44633283d8b8cb01c5791b7d2a Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Sat, 17 Aug 2013 00:38:28 +0200 Subject: Fix some quality flaws --- sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java | 2 +- .../src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java | 2 +- sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java | 4 ++-- .../org/sonar/batch/scan/filesystem/DeprecatedFileSystemAdapter.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sonar-batch') diff --git a/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java b/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java index 9f20029e633..57c75b2551f 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java +++ b/sonar-batch/src/main/java/org/sonar/batch/DefaultSensorContext.java @@ -182,6 +182,6 @@ public class DefaultSensorContext implements SensorContext { } private Resource resourceOrProject(Resource resource) { - return (resource != null ? resource : project); + return resource!=null ? resource : project; } } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java index 539fc1e4529..75b6cd54be0 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/DecoratorsExecutor.java @@ -61,7 +61,7 @@ public class DecoratorsExecutor implements BatchComponent { DecoratorContext decorateResource(Resource resource, Collection decorators, boolean executeDecorators) { List childrenContexts = Lists.newArrayList(); for (Resource child : index.getChildren(resource)) { - boolean isModule = (child instanceof Project); + boolean isModule = child instanceof Project; DefaultDecoratorContext childContext = (DefaultDecoratorContext) decorateResource(child, decorators, !isModule); childrenContexts.add(childContext.setReadOnly(true)); } diff --git a/sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java b/sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java index 0dd90eca8df..02056e53899 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java +++ b/sonar-batch/src/main/java/org/sonar/batch/phases/UpdateStatusJob.java @@ -74,7 +74,7 @@ public class UpdateStatusJob implements BatchComponent { private void enableCurrentSnapshot() { Snapshot previousLastSnapshot = resourcePersister.getLastSnapshot(snapshot, false); - boolean isLast = (previousLastSnapshot == null || previousLastSnapshot.getCreatedAt().before(snapshot.getCreatedAt())); + boolean isLast = previousLastSnapshot == null || previousLastSnapshot.getCreatedAt().before(snapshot.getCreatedAt()); setFlags(snapshot, isLast, Snapshot.STATUS_PROCESSED); logSuccess(LoggerFactory.getLogger(getClass())); } @@ -113,7 +113,7 @@ public class UpdateStatusJob implements BatchComponent { query.setParameter("last", last); query.setParameter("rootId", snapshot.getId()); query.setParameter("path", snapshot.getPath() + snapshot.getId() + ".%"); - query.setParameter("pathRootId", (snapshot.getRootId() == null ? snapshot.getId() : snapshot.getRootId())); + query.setParameter("pathRootId", snapshot.getRootId()==null ? snapshot.getId() : snapshot.getRootId()); query.executeUpdate(); session.commit(); diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DeprecatedFileSystemAdapter.java b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DeprecatedFileSystemAdapter.java index 4201a6b5bf1..4379089c86e 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DeprecatedFileSystemAdapter.java +++ b/sonar-batch/src/main/java/org/sonar/batch/scan/filesystem/DeprecatedFileSystemAdapter.java @@ -176,7 +176,7 @@ public class DeprecatedFileSystemAdapter implements ProjectFileSystem { public File getFileFromBuildDirectory(String filename) { File file = new File(getBuildDir(), filename); - return (file.exists() ? file : null); + return file.exists() ? file : null; } public Resource toResource(File file) { @@ -187,7 +187,7 @@ public class DeprecatedFileSystemAdapter implements ProjectFileSystem { if (relativePath == null) { return null; } - return (file.isFile() ? new org.sonar.api.resources.File(relativePath.path()) : new org.sonar.api.resources.Directory(relativePath.path())); + return file.isFile() ? new org.sonar.api.resources.File(relativePath.path()) : new org.sonar.api.resources.Directory(relativePath.path()); } public List mainFiles(String... langs) { -- cgit v1.2.3