:eyes: Some source code analysis tools can help to find opportunities for improving software components.
:thought_balloon: I propose to increase the usage of compound operators accordingly.
diff --git a/mica-core/src/main/java/org/obiba/mica/core/domain/Person.java b/mica-core/src/main/java/org/obiba/mica/core/domain/Person.java
index b3d16b670..e13ed310a 100644
--- a/mica-core/src/main/java/org/obiba/mica/core/domain/Person.java
+++ b/mica-core/src/main/java/org/obiba/mica/core/domain/Person.java
@@ -155,7 +155,7 @@ public class Person implements Persistable<String>, Identified {
lastName = "";
int from = tokens.length > 2 ? 2 : 1;
for(int i = from; i < tokens.length; i++) {
- lastName = lastName + (i == from ? "" : " ") + tokens[i];
+ lastName += (i == from ? "" : " ") + tokens[i];
}
}
}
diff --git a/mica-core/src/main/java/org/obiba/mica/dataset/domain/DatasetVariable.java b/mica-core/src/main/java/org/obiba/mica/dataset/domain/DatasetVariable.java
index 29b15928c..789717ca9 100644
--- a/mica-core/src/main/java/org/obiba/mica/dataset/domain/DatasetVariable.java
+++ b/mica-core/src/main/java/org/obiba/mica/dataset/domain/DatasetVariable.java
@@ -181,7 +181,7 @@ public class DatasetVariable implements Indexable, AttributeAware {
if (Type.Harmonized == variableType) {
String entityId = studyId;
String tableType = opalTableType == OpalTableType.Study ? OPAL_STUDY_TABLE_PREFIX : OPAL_HARMONIZATION_TABLE_PREFIX;
- id = id + ID_SEPARATOR + tableType + ID_SEPARATOR + entityId + ID_SEPARATOR + project + ID_SEPARATOR + table;
+ id += ID_SEPARATOR + tableType + ID_SEPARATOR + entityId + ID_SEPARATOR + project + ID_SEPARATOR + table;
}
return id;
@@ -509,7 +509,7 @@ public class DatasetVariable implements Indexable, AttributeAware {
if (Type.Harmonized == variableType) {
entityId = studyId;
- id = id + ID_SEPARATOR + tableType + ID_SEPARATOR + entityId + ID_SEPARATOR + project + ID_SEPARATOR + table;
+ id += ID_SEPARATOR + tableType + ID_SEPARATOR + entityId + ID_SEPARATOR + project + ID_SEPARATOR + table;
}
return id;
diff --git a/mica-core/src/main/java/org/obiba/mica/micaConfig/service/OpalService.java b/mica-core/src/main/java/org/obiba/mica/micaConfig/service/OpalService.java
index a61670347..7d12631ef 100644
--- a/mica-core/src/main/java/org/obiba/mica/micaConfig/service/OpalService.java
+++ b/mica-core/src/main/java/org/obiba/mica/micaConfig/service/OpalService.java
@@ -366,7 +366,7 @@ public class OpalService implements EnvironmentAware {
}
if (!opalUrl.endsWith("/ws")) {
- opalUrl = opalUrl + "/ws";
+ opalUrl += "/ws";
}
return opalUrl;
diff --git a/mica-core/src/main/java/org/obiba/mica/user/UserProfileService.java b/mica-core/src/main/java/org/obiba/mica/user/UserProfileService.java
index 7c4725e24..5b6a14fee 100644
--- a/mica-core/src/main/java/org/obiba/mica/user/UserProfileService.java
+++ b/mica-core/src/main/java/org/obiba/mica/user/UserProfileService.java
@@ -190,7 +190,7 @@ public class UserProfileService extends AgateRestService {
String query = "username=";
try {
- query = query + URLEncoder.encode(username, "UTF-8");
+ query += URLEncoder.encode(username, "UTF-8");
} catch (UnsupportedEncodingException e) {
// ignore
}
diff --git a/mica-rest/src/main/java/org/obiba/mica/dataset/rest/PublishedDatasetsEntitiesResource.java b/mica-rest/src/main/java/org/obiba/mica/dataset/rest/PublishedDatasetsEntitiesResource.java
index 538c567c5..f0355742a 100644
--- a/mica-rest/src/main/java/org/obiba/mica/dataset/rest/PublishedDatasetsEntitiesResource.java
+++ b/mica-rest/src/main/java/org/obiba/mica/dataset/rest/PublishedDatasetsEntitiesResource.java
@@ -47,7 +47,7 @@ public class PublishedDatasetsEntitiesResource {
int total = 0;
for (StudyEntitiesCountQuery studyEntitiesCountQuery : studyEntitiesCountService.newQueries(query, entityType)) {
- total = total + studyEntitiesCountQuery.getTotal();
+ total += studyEntitiesCountQuery.getTotal();
builder.addCounts(studyEntitiesCountQuery.getStudyEntitiesCount());
}
// sum of all the study counts because entities are study specific
diff --git a/mica-rest/src/main/java/org/obiba/mica/dataset/rest/entity/rql/RQLCriterionOpalConverter.java b/mica-rest/src/main/java/org/obiba/mica/dataset/rest/entity/rql/RQLCriterionOpalConverter.java
index fbe6e64dc..369a0ae32 100644
--- a/mica-rest/src/main/java/org/obiba/mica/dataset/rest/entity/rql/RQLCriterionOpalConverter.java
+++ b/mica-rest/src/main/java/org/obiba/mica/dataset/rest/entity/rql/RQLCriterionOpalConverter.java
@@ -32,9 +32,9 @@ public class RQLCriterionOpalConverter {
private String getQuery(String field) {
String query = function + "(" + field;
if (Strings.isNullOrEmpty(value))
- query = query + ")";
+ query += ")";
else
- query = query + ",(" + value + "))";
+ query += ",(" + value + "))";
return not ? "not(" + query + ")" : query;
}
diff --git a/mica-search/src/main/java/org/obiba/mica/file/search/rest/PublishedFilesSearchResource.java b/mica-search/src/main/java/org/obiba/mica/file/search/rest/PublishedFilesSearchResource.java
index ef910f4f4..707582004 100644
--- a/mica-search/src/main/java/org/obiba/mica/file/search/rest/PublishedFilesSearchResource.java
+++ b/mica-search/src/main/java/org/obiba/mica/file/search/rest/PublishedFilesSearchResource.java
@@ -51,7 +51,7 @@ public class PublishedFilesSearchResource extends AbstractFileSearchResource {
.forEach(f -> files.add(f));
if(files.size() < limit) {
- from = from + limit;
+ from += limit;
states = esAttachmentService.find(from, limit, sort, order, getBasePath(), queryString);
}
}
diff --git a/mica-search/src/main/java/org/obiba/mica/search/reports/generators/DatasetVariableDtosCsvReportGenerator.java b/mica-search/src/main/java/org/obiba/mica/search/reports/generators/DatasetVariableDtosCsvReportGenerator.java
index d75a32df6..2114fdf30 100644
--- a/mica-search/src/main/java/org/obiba/mica/search/reports/generators/DatasetVariableDtosCsvReportGenerator.java
+++ b/mica-search/src/main/java/org/obiba/mica/search/reports/generators/DatasetVariableDtosCsvReportGenerator.java
@@ -96,7 +96,7 @@ public class DatasetVariableDtosCsvReportGenerator extends CsvReportGenerator {
String rval = cat.getName();
Optional<Mica.AttributeDto> lblAttrOpt = cat.getAttributesList().stream().filter(attr -> attr.getName().equals("label")).findFirst();
if (lblAttrOpt.isPresent()) {
- rval = rval + ": " + lblAttrOpt.get().getValuesList().get(0).getValue();
+ rval += ": " + lblAttrOpt.get().getValuesList().get(0).getValue();
}
return rval;
}).collect(Collectors.joining(" | ")));
diff --git a/mica-webapp/src/main/java/org/obiba/mica/web/controller/domain/AuthConfiguration.java b/mica-webapp/src/main/java/org/obiba/mica/web/controller/domain/AuthConfiguration.java
index 1db097555..29f167543 100644
--- a/mica-webapp/src/main/java/org/obiba/mica/web/controller/domain/AuthConfiguration.java
+++ b/mica-webapp/src/main/java/org/obiba/mica/web/controller/domain/AuthConfiguration.java
@@ -58,8 +58,8 @@ public class AuthConfiguration {
public String getUserAccountUrl() {
String url = getPublicUrl();
- if (!url.endsWith("/")) url = url + "/";
- url = url + "profile";
+ if (!url.endsWith("/")) url += "/";
+ url += "profile";
return url;
}
:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of compound operators accordingly.