@@ -182,6 +182,6 @@ public class DefaultSensorContext implements SensorContext { | |||
} | |||
private Resource resourceOrProject(Resource resource) { | |||
return (resource != null ? resource : project); | |||
return resource!=null ? resource : project; | |||
} | |||
} |
@@ -61,7 +61,7 @@ public class DecoratorsExecutor implements BatchComponent { | |||
DecoratorContext decorateResource(Resource resource, Collection<Decorator> decorators, boolean executeDecorators) { | |||
List<DecoratorContext> 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)); | |||
} |
@@ -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(); | |||
@@ -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<InputFile> mainFiles(String... langs) { |
@@ -39,7 +39,7 @@ public class CodeColorizer { | |||
} | |||
public String toHtml(Reader code, HtmlOptions options) { | |||
HtmlOptions opts = (options == null ? HtmlOptions.DEFAULT : options); | |||
HtmlOptions opts = options == null ? HtmlOptions.DEFAULT : options; | |||
return new HtmlRenderer(opts).render(code, tokenizers); | |||
} | |||
@@ -63,7 +63,7 @@ public class LiteralTokenizer extends Tokenizer { | |||
public boolean match(int endFlag) { | |||
literalValue.append((char) endFlag); | |||
return (code.lastChar() == firstChar && evenNumberOfBackSlashBeforeDelimiter() && literalValue.length() > 1); | |||
return code.lastChar()==firstChar && evenNumberOfBackSlashBeforeDelimiter() && literalValue.length()>1; | |||
} | |||
private boolean evenNumberOfBackSlashBeforeDelimiter() { |
@@ -55,7 +55,7 @@ public class ScanGraph extends BeanGraph implements BatchComponent { | |||
public ComponentVertex getComponent(String key) { | |||
Vertex vertex = GraphUtil.single(getUnderlyingGraph().getVertices("key", key)); | |||
return (vertex != null ? wrapComponent(vertex) : null); | |||
return vertex != null ? wrapComponent(vertex) : null; | |||
} | |||
public ComponentVertex addComponent(Resource resource, @Nullable Snapshot snapshot) { |
@@ -48,7 +48,7 @@ public class ActiveDashboardDao implements BatchComponent, ServerComponent { | |||
ActiveDashboardMapper mapper = session.getMapper(ActiveDashboardMapper.class); | |||
try { | |||
Integer max = mapper.selectMaxOrderIndexForNullUser(); | |||
return (max != null ? max.intValue() : 0); | |||
return max != null ? max.intValue() : 0; | |||
} finally { | |||
session.close(); | |||
} |
@@ -88,10 +88,6 @@ public class RemotePlugin { | |||
return files; | |||
} | |||
public String getPluginFilename() { | |||
return (!files.isEmpty() ? files.get(0).getFilename() : null); | |||
} | |||
@Override | |||
public boolean equals(Object o) { | |||
if (this == o) { |
@@ -71,7 +71,7 @@ public class MeasuresDao extends BaseDao { | |||
return CollectionUtils.select(getMetricsByName().values(), new Predicate() { | |||
public boolean evaluate(Object o) { | |||
Metric m = (Metric) o; | |||
return (m.getEnabled() && m.getOrigin() != Metric.Origin.JAV); | |||
return m.getEnabled() && m.getOrigin() != Metric.Origin.JAV; | |||
} | |||
}); | |||
} |
@@ -96,7 +96,7 @@ public final class ByteArray { | |||
public String toHexString() { | |||
StringBuilder hex = new StringBuilder(2 * bytes.length); | |||
for (byte b : bytes) { | |||
hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt((b & 0x0F))); | |||
hex.append(HEXES.charAt((b & 0xF0) >> 4)).append(HEXES.charAt(b & 0x0F)); | |||
} | |||
return hex.toString(); | |||
} |
@@ -106,7 +106,7 @@ public class CountDistributionBuilder implements MeasureBuilder { | |||
Map<String, String> map = KeyValueFormat.parse(measure.getData()); | |||
for (Map.Entry<String, String> entry : map.entrySet()) { | |||
String key = entry.getKey(); | |||
int value = (StringUtils.isBlank(entry.getValue()) ? 0 : Integer.parseInt(entry.getValue())); | |||
int value = StringUtils.isBlank(entry.getValue()) ? 0 : Integer.parseInt(entry.getValue()); | |||
if (NumberUtils.isNumber(key)) { | |||
add(NumberUtils.toInt(key), value); | |||
} else { |
@@ -87,7 +87,7 @@ public final class MeasureUtils { | |||
if (measure != null) { | |||
result = measure.getVariation(periodIndex); | |||
} | |||
return (result != null ? result : defaultValue); | |||
return result != null ? result : defaultValue; | |||
} | |||
public static Long getVariationAsLong(Measure measure, int periodIndex) { |
@@ -92,7 +92,7 @@ public class ServerExtensionInstaller { | |||
} | |||
static boolean isType(Object extension, Class<? extends Extension> extensionClass) { | |||
Class clazz = (extension instanceof Class ? (Class) extension : extension.getClass()); | |||
Class clazz = extension instanceof Class ? (Class) extension : extension.getClass(); | |||
return extensionClass.isAssignableFrom(clazz); | |||
} | |||
} |