Commit d45494b4 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

curly braces are required in for/if statements

parent d7d2e99a
Pipeline #46991 failed with stage
in 63 minutes and 39 seconds
......@@ -158,7 +158,7 @@ public abstract class ElementAnnotator extends CachableInterface {
*/
public List<Class<? extends BioEntity>> getValidClasses() {
return validClasses;
};
}
/**
* Returns <code>true</code> if this annotator can annotate the object given in
......
......@@ -203,8 +203,9 @@ public abstract class AnnotationTestFunctions extends AbstractTransactionalJUnit
}
protected String nodeToString(Node node, boolean includeHeadNode) {
if (node == null)
if (node == null) {
return null;
}
StringWriter sw = new StringWriter();
try {
Transformer t = TransformerFactory.newInstance().newTransformer();
......
......@@ -96,8 +96,9 @@ public class MiriamConnectorTest extends AnnotationTestFunctions {
boolean deprecated = false;
try {
Field f = MiriamType.class.getField(mt.name());
if (f.isAnnotationPresent(Deprecated.class))
if (f.isAnnotationPresent(Deprecated.class)) {
deprecated = true;
}
} catch (NoSuchFieldException | SecurityException e) {
}
......
......@@ -127,10 +127,11 @@ public class ModelAnnotatorTest extends AnnotationTestFunctions {
modelAnnotator.copyAnnotationFromOtherSpecies(model, updater);
for (Species element : model.getSpeciesList()) {
if (element.getName().equals("s4"))
if (element.getName().equals("s4")) {
assertEquals(0, element.getMiriamData().size());
else if (element.getName().equals("hello"))
} else if (element.getName().equals("hello")) {
assertEquals(1, element.getMiriamData().size());
}
}
}
......
......@@ -70,7 +70,7 @@
<property name="tokens"
value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<!-- <module name="NeedBraces">
<module name="NeedBraces">
<property name="tokens"
value="LITERAL_DO, LITERAL_ELSE, LITERAL_FOR, LITERAL_IF, LITERAL_WHILE"/>
</module>
......@@ -95,7 +95,7 @@
value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT,
INSTANCE_INIT, ANNOTATION_DEF, ENUM_DEF"/>
</module>
<module name="WhitespaceAround">
<!-- <module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
......
......@@ -121,8 +121,9 @@ public class XmlParserTest extends CommonTestFunctions {
@Test
public void testConcurrencyParse() throws Exception {
StringBuilder builder = new StringBuilder("<doc>");
for (int i = 0; i < 30000; i++)
for (int i = 0; i < 30000; i++) {
builder.append("<test_node>test_x</test_node>");
}
builder.append("</doc>");
final String xml = builder.toString();
threadSucceded = false;
......
......@@ -921,8 +921,9 @@ public class RestAnnotationParser {
boolean isFieldAnnotated(NoteField field, Class<? extends Annotation> annotationClass) {
try {
Field f = field.getClass().getField(field.name());
if (f.isAnnotationPresent(annotationClass))
if (f.isAnnotationPresent(annotationClass)) {
return true;
}
} catch (NoSuchFieldException | SecurityException e) {
}
return false;
......
......@@ -111,8 +111,9 @@ public class ReactionCollectionXmlParser {
for (Reaction reaction : collection) {
boolean reactionToCompartment = false;
for (ReactionNode node : reaction.getReactionNodes()) {
if (node.getElement() instanceof Compartment)
if (node.getElement() instanceof Compartment) {
reactionToCompartment = true;
}
}
if (reactionToCompartment) {
logger.warn(new LogMarker(ProjectLogEntryType.EXPORT_ISSUE, reaction),
......
......@@ -165,8 +165,9 @@ public abstract class CellDesignerTestFunctions {
}
protected String nodeToString(Node node, boolean includeHeadNode) {
if (node == null)
if (node == null) {
return null;
}
StringWriter sw = new StringWriter();
try {
Transformer t = TransformerFactory.newInstance().newTransformer();
......
......@@ -66,14 +66,18 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions {
Species aliasSa10 = null;
Species aliasSa11 = null;
for (Species alias : list) {
if (alias.getElementId().equals("sa8"))
if (alias.getElementId().equals("sa8")) {
aliasSa8 = alias;
if (alias.getElementId().equals("sa9"))
}
if (alias.getElementId().equals("sa9")) {
aliasSa9 = alias;
if (alias.getElementId().equals("sa10"))
}
if (alias.getElementId().equals("sa10")) {
aliasSa10 = alias;
if (alias.getElementId().equals("sa11"))
}
if (alias.getElementId().equals("sa11")) {
aliasSa11 = alias;
}
}
assertNotNull(aliasSa8);
assertNotNull(aliasSa9);
......@@ -165,12 +169,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions {
Complex aliasSa2 = null;
Complex aliasSa3 = null;
for (Complex alias : list) {
if (alias.getElementId().equals("csa1"))
if (alias.getElementId().equals("csa1")) {
aliasSa1 = alias;
if (alias.getElementId().equals("csa2"))
}
if (alias.getElementId().equals("csa2")) {
aliasSa2 = alias;
if (alias.getElementId().equals("csa3"))
}
if (alias.getElementId().equals("csa3")) {
aliasSa3 = alias;
}
}
assertNotNull(aliasSa1);
assertNotNull(aliasSa2);
......@@ -196,12 +203,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions {
Complex aliasSa2 = null;
Complex aliasSa3 = null;
for (Complex alias : list) {
if (alias.getElementId().equals("csa1"))
if (alias.getElementId().equals("csa1")) {
aliasSa1 = alias;
if (alias.getElementId().equals("csa2"))
}
if (alias.getElementId().equals("csa2")) {
aliasSa2 = alias;
if (alias.getElementId().equals("csa3"))
}
if (alias.getElementId().equals("csa3")) {
aliasSa3 = alias;
}
}
assertNotNull(aliasSa1);
assertNotNull(aliasSa2);
......@@ -243,12 +253,15 @@ public class AliasCollectionXmlParserTest extends CellDesignerTestFunctions {
Compartment aliasCa2 = null;
Compartment aliasCa3 = null;
for (Compartment alias : list) {
if (alias.getElementId().equals("ca1"))
if (alias.getElementId().equals("ca1")) {
aliasCa1 = alias;
if (alias.getElementId().equals("ca2"))
}
if (alias.getElementId().equals("ca2")) {
aliasCa2 = alias;
if (alias.getElementId().equals("ca3"))
}
if (alias.getElementId().equals("ca3")) {
aliasCa3 = alias;
}
}
assertNotNull(aliasCa1);
assertNotNull(aliasCa2);
......
......@@ -239,8 +239,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(1, reactant.getLine().getLines().size());
NodeOperator operator = null;
for (NodeOperator operator2 : reaction.getOperators()) {
if (operator2 instanceof SplitOperator)
if (operator2 instanceof SplitOperator) {
operator = operator2;
}
}
assertEquals(LineType.DASH_DOT_DOT, operator.getLine().getType());
......@@ -361,8 +362,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(2, model.getReactions().size());
Reaction reaction = null;
for (Reaction reaction2 : model.getReactions()) {
if (reaction2.getIdReaction().equals("re1"))
if (reaction2.getIdReaction().equals("re1")) {
reaction = reaction2;
}
}
assertTrue(reaction instanceof DissociationReaction);
assertEquals(1, reaction.getReactants().size());
......@@ -396,8 +398,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
assertEquals(2, model.getReactions().size());
Reaction reaction = null;
for (Reaction reaction2 : model.getReactions()) {
if (reaction2.getIdReaction().equals("re1"))
if (reaction2.getIdReaction().equals("re1")) {
reaction = reaction2;
}
}
assertTrue(reaction instanceof DissociationReaction);
assertEquals(2, reaction.getReactants().size());
......@@ -548,10 +551,12 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
Reaction reaction1 = null;
Reaction reaction2 = null;
for (Reaction reaction : model.getReactions()) {
if (reaction.getIdReaction().equals("re2"))
if (reaction.getIdReaction().equals("re2")) {
reaction1 = reaction;
if (reaction.getIdReaction().equals("re3"))
}
if (reaction.getIdReaction().equals("re3")) {
reaction2 = reaction;
}
}
Reactant reactant = reaction1.getReactants().get(0);
Element alias1 = reaction1.getReactants().get(0).getElement();
......@@ -577,8 +582,9 @@ public class ReactionParserTests extends CellDesignerTestFunctions {
Model model = getModelForFile("testFiles/reactions/problemWithAnchors3.xml");
Reaction reaction = null;
for (Reaction reaction2 : model.getReactions()) {
if (reaction2.getIdReaction().equals("re3"))
if (reaction2.getIdReaction().equals("re3")) {
reaction = reaction2;
}
}
Point2D point = new Point2D.Double(164.85583789974368, 86.060142902597);
Point2D point2 = new Point2D.Double(397.06477630152193, 284.99999999999994);
......
......@@ -257,10 +257,12 @@ public class SpeciesCollectionXmlParserTest extends CellDesignerTestFunctions {
int complexes = 0;
int proteins = 0;
for (Pair<String, ? extends CellDesignerSpecies<?>> species : list) {
if (species.getRight() instanceof CellDesignerComplexSpecies)
if (species.getRight() instanceof CellDesignerComplexSpecies) {
complexes++;
if (species.getRight() instanceof CellDesignerProtein)
}
if (species.getRight() instanceof CellDesignerProtein) {
proteins++;
}
}
assertEquals(1, complexes);
assertEquals(2, proteins);
......
......@@ -82,7 +82,7 @@ public abstract class CompartmentConverter<T extends Compartment> extends Elemen
*/
protected CompartmentConverter(ColorExtractor colorExtractor) {
super(colorExtractor);
};
}
/**
* @return the alphaLevel
......
......@@ -123,7 +123,7 @@ public abstract class SpeciesConverter<T extends Species> extends ElementConvert
*/
protected SpeciesConverter(ColorExtractor colorExtractor) {
super(colorExtractor);
};
}
/**
* Returns default shape of the {@link Species}.
......
......@@ -142,8 +142,9 @@ public abstract class ConverterTestFunctions {
}
protected String nodeToString(Node node, boolean includeHeadNode) {
if (node == null)
if (node == null) {
return null;
}
StringWriter sw = new StringWriter();
try {
Transformer t = TransformerFactory.newInstance().newTransformer();
......
......@@ -62,10 +62,12 @@ public class Privilege implements Serializable {
@Override
public boolean equals(Object o) {
if (this == o)
if (this == o) {
return true;
if (!(o instanceof Privilege))
}
if (!(o instanceof Privilege)) {
return false;
}
Privilege that = (Privilege) o;
return type == that.type
&& Objects.equals(objectId, that.objectId);
......
......@@ -53,8 +53,9 @@ public class MiriamTypeGenericTest extends ModelTestFunctions {
boolean deprecated = false;
try {
Field f = MiriamType.class.getField(mt.name());
if (f.isAnnotationPresent(clazz))
if (f.isAnnotationPresent(clazz)) {
deprecated = true;
}
} catch (NoSuchFieldException | SecurityException e) {
}
return deprecated;
......
......@@ -86,8 +86,9 @@ public class ElementUtilsTest extends ModelTestFunctions {
throw new InvalidArgumentException();
}
String tmp = "";
for (int i = 0; i < indent; i++)
for (int i = 0; i < indent; i++) {
tmp += " ";
}
logger.debug(tmp + top.getCommonName());
for (ClassTreeNode node : top.getChildren()) {
print(node, indent + 1);
......
......@@ -1129,8 +1129,9 @@ public class ModelContructor {
Integer result = null;
for (Species species : allChildren) {
if (species.getZ() != null) {
if (result == null)
if (result == null) {
result = species.getZ();
}
result = Math.min(result, species.getZ());
}
}
......
......@@ -333,8 +333,9 @@ class ReactionLayoutFinder {
private boolean pointOnPolyline(PolylineData line, Point2D point) {
// point cannot be on the edge
if (line.getStartPoint().distance(point) <= Configuration.EPSILON ||
line.getEndPoint().distance(point) <= Configuration.EPSILON)
line.getEndPoint().distance(point) <= Configuration.EPSILON) {
return false;
}
for (Line2D l : line.getLines()) {
if (lt.distBetweenPointAndLineSegment(l, point) <= Configuration.EPSILON) {
......
......@@ -163,8 +163,9 @@ public abstract class WikipathwaysTestFunctions {
}
protected String nodeToString(Node node, boolean includeHeadNode) {
if (node == null)
if (node == null) {
return null;
}
StringWriter sw = new StringWriter();
try {
Transformer t = TransformerFactory.newInstance().newTransformer();
......
......@@ -232,8 +232,9 @@ public abstract class RestTestFunctions {
}
protected String nodeToString(Node node, boolean includeHeadNode) {
if (node == null)
if (node == null) {
return null;
}
StringWriter sw = new StringWriter();
try {
Transformer t = TransformerFactory.newInstance().newTransformer();
......
......@@ -33,5 +33,5 @@ public class MiriamService implements IMiriamService {
@Override
public Article getArticle(MiriamData miriamData) throws PubmedSearchException {
return pubmedParser.getPubmedArticleById(miriamData.getResource());
};
}
}
......@@ -106,7 +106,7 @@ public class SearchService implements ISearchService {
*/
private void addSearchPrefix(String prefix, List<Class<? extends BioEntity>> clazz) {
speciesSearchReversePrefix.put(prefix, clazz);
};
}
/**
* Transform {@link Reaction} into set of result entries.
......
......@@ -17,4 +17,4 @@ import lcsb.mapviewer.services.utils.AllUtilsTests;
})
public class AllServicesTests {
};
\ No newline at end of file
}
\ No newline at end of file
......@@ -45,7 +45,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
public void addCookie(Cookie cookie) {
logger.debug("addCookie");
this.addCookie(cookie);
} @Override
}
@Override
public PrintWriter getWriter() throws IOException {
logger.debug("getWriter");
return this.getWriter();
......@@ -55,7 +57,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
public boolean containsHeader(String name) {
logger.debug("containsHeader");
return this.containsHeader(name);
} @Override
}
@Override
public ServletOutputStream getOutputStream() throws IOException {
logger.debug("getOutputStream");
logger.debug(new Exception(), new Exception());
......@@ -66,7 +70,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
public String encodeURL(String url) {
logger.debug("encodeURL");
return this.encodeURL(url);
} @Override
}
@Override
public String getCharacterEncoding() {
logger.debug("getCharacterEncoding");
return this.getCharacterEncoding();
......@@ -76,7 +82,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
public String encodeRedirectURL(String url) {
logger.debug("encodeRedirectURL");
return this.encodeRedirectURL(url);
} @Override
}
@Override
public String getContentType() {
logger.debug("getContentType");
return this.getContentType();
......@@ -86,7 +94,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
public String encodeUrl(String url) {
logger.debug("encodeUrl");
return this.encodeUrl(url);
} @Override
}
@Override
public void setCharacterEncoding(String charset) {
logger.debug("setCharacterEncoding");
this.setCharacterEncoding(charset);
......@@ -96,7 +106,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
public String encodeRedirectUrl(String url) {
logger.debug("encodeRedirectUrl");
return this.encodeRedirectUrl(url);
} @Override
}
@Override
public void setContentLength(int len) {
logger.debug("setContentLength");
this.setContentLength(len);
......@@ -107,7 +119,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
logger.debug("sendError");
this.sendError(sc);
} @Override
}
@Override
public void setContentType(String type) {
logger.debug("setContentType: " + type);
logger.debug(new Exception(), new Exception());
......@@ -119,7 +133,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
logger.debug("sendError");
this.sendError(sc);
} @Override
}
@Override
public void setBufferSize(int size) {
logger.debug("setBufferSize");
this.setBufferSize(size);
......@@ -130,7 +146,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
logger.debug("sendRedirect");
this.sendRedirect(location);
} @Override
}
@Override
public int getBufferSize() {
logger.debug("getBufferSize");
return this.getBufferSize();
......@@ -141,7 +159,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
logger.debug("setDateHeader");
this.setDateHeader(name, date);
} @Override
}
@Override
public void flushBuffer() throws IOException {
logger.debug("flushBuffer");
this.flushBuffer();
......@@ -152,7 +172,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
logger.debug("addDateHeader");
this.addDateHeader(name, date);
} @Override
}
@Override
public void resetBuffer() {
logger.debug("resetBuffer");
this.resetBuffer();
......@@ -163,7 +185,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
logger.debug("setHeader");
this.setHeader(name, value);
} @Override
}
@Override
public boolean isCommitted() {
logger.debug("isCommitted");
return this.isCommitted();
......@@ -174,7 +198,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
logger.debug("addHeader: " + name + " - " + value);
this.addHeader(name, value);
} @Override
}
@Override
public void reset() {
logger.debug("reset");
this.reset();
......@@ -185,7 +211,9 @@ public class CustomHttpServletResponseWrapper extends HttpServletResponseWrapper
logger.debug("setIntHeader");
this.setIntHeader(name, value);
} @Override
}
@Override