From be75ea973f222332662b632ea350dd8e048620bb Mon Sep 17 00:00:00 2001 From: cagache Date: Mon, 16 Dec 2019 15:14:31 +0200 Subject: [PATCH 1/7] Reduce Sonar issues from automation-community-rest-api --- .../alfresco/rest/rm/community/model/record/Record.java | 2 +- .../rm/community/model/recordcategory/RecordCategory.java | 2 +- .../model/recordcategory/RecordCategoryChild.java | 2 +- .../rest/rm/community/requests/gscore/api/FilesAPI.java | 1 - .../org/alfresco/rest/rm/community/util/PojoUtility.java | 8 ++++++-- .../java/org/alfresco/rest/v0/CustomDefinitionsAPI.java | 2 +- .../src/main/java/org/alfresco/rest/v0/RMAuditAPI.java | 2 +- .../src/main/java/org/alfresco/rest/v0/SearchAPI.java | 2 +- 8 files changed, 12 insertions(+), 9 deletions(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/Record.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/Record.java index 55acb537a9..9b959c193a 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/Record.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/record/Record.java @@ -109,7 +109,7 @@ public class Record extends TestModel implements IRestModel @Override public ModelAssertion assertThat() { - return new ModelAssertion(this); + return new ModelAssertion<>(this); } @Override diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategory.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategory.java index 297ac5ccf7..fbaa9a0ea9 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategory.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategory.java @@ -53,7 +53,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class RecordCategory extends TestModel { - public final static String DEFAULT_FILE_PLAN_ALIAS = "-filePlan-"; + public static final String DEFAULT_FILE_PLAN_ALIAS = "-filePlan-"; /*************************/ /** Mandatory parameters */ diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChild.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChild.java index 746e8f2fe3..008c10bcbf 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChild.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/model/recordcategory/RecordCategoryChild.java @@ -53,7 +53,7 @@ import lombok.NoArgsConstructor; @AllArgsConstructor public class RecordCategoryChild extends TestModel { - public final static String RECORD_FOLDER_NODE_TYPE = "rma:recordFolder"; + public static final String RECORD_FOLDER_NODE_TYPE = "rma:recordFolder"; /*************************/ /** Mandatory parameters */ diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java index 949d4cbfc3..0b86644d5d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/requests/gscore/api/FilesAPI.java @@ -28,7 +28,6 @@ package org.alfresco.rest.rm.community.requests.gscore.api; import static org.alfresco.rest.core.RestRequest.simpleRequest; import static org.alfresco.rest.rm.community.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang3.StringUtils.EMPTY; import static org.springframework.http.HttpMethod.POST; import org.alfresco.rest.core.RMRestWrapper; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java index 7d0d08f98a..55592dfbbd 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/rm/community/util/PojoUtility.java @@ -54,6 +54,10 @@ public class PojoUtility */ private static final Logger LOGGER = LoggerFactory.getLogger(PojoUtility.class); + /** Private constructor to prevent instantiation. */ + private PojoUtility() + {} + /** * see {@link #toJson(Object, Class, Class)} */ @@ -122,7 +126,7 @@ public class PojoUtility } catch (IOException e) { - LOGGER.error("Unable to convert the json into a java object.", e.toString()); + LOGGER.error("Unable to convert the json into a java object.", e); } return obj; @@ -152,7 +156,7 @@ public class PojoUtility } catch (IOException e) { - LOGGER.error("Unable to convert the json array into a java collection.", e.toString()); + LOGGER.error("Unable to convert the json array into a java collection.", e); } diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CustomDefinitionsAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CustomDefinitionsAPI.java index 6b480fd10d..bae0a15631 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CustomDefinitionsAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/CustomDefinitionsAPI.java @@ -105,7 +105,7 @@ public class CustomDefinitionsAPI extends BaseAPI } catch (JSONException error) { - LOGGER.error("Unable to get the refId for the custom reference definition " + customDefinition); + LOGGER.error("Unable to get the refId for the custom reference definition {}", customDefinition); } } return null; diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java index 10c7125ec8..6558d67bb0 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/RMAuditAPI.java @@ -76,7 +76,7 @@ public class RMAuditAPI extends BaseAPI } catch (UnsupportedEncodingException e) { - LOGGER.error("Unable to encode the event name" + e.getMessage()); + LOGGER.error("Unable to encode the event name {}", e.getMessage()); } JSONArray auditEntries = doGetRequest(user, password, MessageFormat.format(RM_AUDIT_LOG_API,"{0}", parameters)).getJSONObject("data").getJSONArray("entries"); diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java index c1a42bae6a..80d7a9a23d 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java @@ -102,7 +102,7 @@ public class SearchAPI extends BaseAPI String filters, String sortby) { - List searchParameters = new ArrayList(); + List searchParameters = new ArrayList<>(); searchParameters.add(new BasicNameValuePair("query", query)); searchParameters.add(new BasicNameValuePair("filters", filters)); if (sortby != null) From a9e20f89bb2edf648d6d6061913e4b92fcaa2703 Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 20 Dec 2019 09:50:58 +0200 Subject: [PATCH 2/7] Upgrade jackson-databind from 2.9.10 to 2.9.10.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dac2e7c47b..b902bbed17 100644 --- a/pom.xml +++ b/pom.xml @@ -559,7 +559,7 @@ 8080 2.9.9 - 2.9.10 + 2.9.10.1 0.31.0 1.10.19 42.2.6 From 7156ad9c751924b3d29e7d97103d8edf546372bf Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 20 Dec 2019 11:40:49 +0200 Subject: [PATCH 3/7] Added install_first source clear scan directive --- srcclr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/srcclr.yml b/srcclr.yml index 8ae09190de..3e68ccf1fb 100644 --- a/srcclr.yml +++ b/srcclr.yml @@ -1,2 +1,3 @@ # The scope of this file is to have a custom scan directive for SourceClear excluding automation and benchmark projects from the scan. -custom_maven_command: clean install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' \ No newline at end of file +custom_maven_command: clean install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' +install_first: true \ No newline at end of file From e76d3c5457f9a5ef1ef15eabcecfe79807cb33dc Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 20 Dec 2019 14:25:20 +0200 Subject: [PATCH 4/7] Added back fail-fast --- srcclr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/srcclr.yml b/srcclr.yml index 3e68ccf1fb..af9b5adb18 100644 --- a/srcclr.yml +++ b/srcclr.yml @@ -1,3 +1,2 @@ # The scope of this file is to have a custom scan directive for SourceClear excluding automation and benchmark projects from the scan. -custom_maven_command: clean install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' -install_first: true \ No newline at end of file +custom_maven_command: compile -Dcheckstyle.skip=true -e -DskipTests -DskipITs --fail-fast -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' \ No newline at end of file From 1c090aef7397fcdc5b087e76ebc17325d89cb660 Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 20 Dec 2019 14:37:32 +0200 Subject: [PATCH 5/7] Revert "Added back fail-fast" This reverts commit e76d3c54 --- srcclr.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/srcclr.yml b/srcclr.yml index af9b5adb18..3e68ccf1fb 100644 --- a/srcclr.yml +++ b/srcclr.yml @@ -1,2 +1,3 @@ # The scope of this file is to have a custom scan directive for SourceClear excluding automation and benchmark projects from the scan. -custom_maven_command: compile -Dcheckstyle.skip=true -e -DskipTests -DskipITs --fail-fast -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' \ No newline at end of file +custom_maven_command: clean install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' +install_first: true \ No newline at end of file From 218239a1a6e30b46bd51e25b0154447eeca612b6 Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 20 Dec 2019 14:37:51 +0200 Subject: [PATCH 6/7] Revert "Added install_first source clear scan directive" This reverts commit 7156ad9c --- srcclr.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/srcclr.yml b/srcclr.yml index 3e68ccf1fb..8ae09190de 100644 --- a/srcclr.yml +++ b/srcclr.yml @@ -1,3 +1,2 @@ # The scope of this file is to have a custom scan directive for SourceClear excluding automation and benchmark projects from the scan. -custom_maven_command: clean install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' -install_first: true \ No newline at end of file +custom_maven_command: clean install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' \ No newline at end of file From bb2162fd72548cb19c21d3cf27d493d09f5e981a Mon Sep 17 00:00:00 2001 From: cagache Date: Fri, 20 Dec 2019 14:38:44 +0200 Subject: [PATCH 7/7] Remove mvn clean --- srcclr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srcclr.yml b/srcclr.yml index 8ae09190de..73aea3ff53 100644 --- a/srcclr.yml +++ b/srcclr.yml @@ -1,2 +1,2 @@ # The scope of this file is to have a custom scan directive for SourceClear excluding automation and benchmark projects from the scan. -custom_maven_command: clean install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' \ No newline at end of file +custom_maven_command: install -Dcheckstyle.skip=true -e -DskipTests -DskipITs -Dmaven.test.skip=true -Denforcer.skip=true -pl '!rm-automation,!rm-automation/rm-automation-community-rest-api,!rm-automation/rm-automation-enterprise-rest-api,!rm-automation/rm-automation-ui,!rm-benchmark' \ No newline at end of file