From ff2cd94cee59a21d669f8031f854e24bccd67c3d Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 11 Nov 2019 22:13:11 +0000 Subject: [PATCH 1/5] Bump dependency.jackson.version in /search-services Bumps `dependency.jackson.version` from 2.10.0 to 2.10.1. Updates `jackson-core` from 2.10.0 to 2.10.1 - [Release notes](https://github.com/FasterXML/jackson-core/releases) - [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.10.0...jackson-core-2.10.1) Updates `jackson-annotations` from 2.10.0 to 2.10.1 - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Updates `jackson-databind` from 2.10.0 to 2.10.1 - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Signed-off-by: dependabot-preview[bot] --- search-services/alfresco-solrclient-lib/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/search-services/alfresco-solrclient-lib/pom.xml b/search-services/alfresco-solrclient-lib/pom.xml index a70bf5fcc..5c75cb1e0 100644 --- a/search-services/alfresco-solrclient-lib/pom.xml +++ b/search-services/alfresco-solrclient-lib/pom.xml @@ -23,7 +23,7 @@ 8.53 - 2.10.0 + 2.10.1 From 2fbe9cdd87842d0dbe6f284b87ba883dc76c9620 Mon Sep 17 00:00:00 2001 From: agazzarini Date: Wed, 13 Nov 2019 18:13:58 +0100 Subject: [PATCH 2/5] [ SEARCH-875 ] Minor refactoring and formatting --- .../main/java/org/alfresco/solr/utils/Utils.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java index 2254b9cf0..b3e90e502 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java @@ -18,6 +18,8 @@ */ package org.alfresco.solr.utils; +import java.io.Closeable; +import java.io.IOException; import java.util.Collection; import java.util.Collections; @@ -53,4 +55,16 @@ public abstract class Utils return null; } } + + public static void silentyClose(Closeable resource) + { + try + { + resource.close(); + } + catch(IOException ignore) + { + // Nothing to be done here + } + } } From 3de46bf59d86598197f71001003c60deb071f8dc Mon Sep 17 00:00:00 2001 From: agazzarini Date: Thu, 14 Nov 2019 10:29:41 +0100 Subject: [PATCH 3/5] [ SEARCH-875 ] Javadoc on silentlyClose utility method. --- .../java/org/alfresco/solr/utils/Utils.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java index b3e90e502..04e553119 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java @@ -56,11 +56,36 @@ public abstract class Utils } } + /** + * Silently closes the given {@link Closeable} resource without raising any exception. + * This utility method is specifically useful when we have to close a resource in a lamba statement: since the + * close() method could throw an {@link IOException} the compiler requires an enclosing try / catch block which + * makes the code less readable. + * + *

+ *

+ * + * try { if (resource != null) resource.close } catch (IOException exception) { ... } + * + *

+ *
+ * + * In these contexts a call to this method reduces the amount of code needed: + * + *

+ *

+ * + * silentlyClose(resource); + * + *

+ * + * @param resource the {@link Closeable} resource we want to silently close. + */ public static void silentyClose(Closeable resource) { try { - resource.close(); + if (resource != null) resource.close(); } catch(IOException ignore) { From 96bd118e8c7df8c97a156c4baeaab09802dca4cb Mon Sep 17 00:00:00 2001 From: Tom Page Date: Thu, 14 Nov 2019 10:54:24 +0000 Subject: [PATCH 4/5] Update notice.txt for Jackson. --- .../packaging/src/main/resources/licenses/notice.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/search-services/packaging/src/main/resources/licenses/notice.txt b/search-services/packaging/src/main/resources/licenses/notice.txt index 12e46175c..92c61b013 100644 --- a/search-services/packaging/src/main/resources/licenses/notice.txt +++ b/search-services/packaging/src/main/resources/licenses/notice.txt @@ -54,9 +54,9 @@ mybatis-spring-1.2.5.jar http://www.mybatis.org/ chemistry-opencmis-server-support-1.0.0.jar http://chemistry.apache.org/ chemistry-opencmis-server-bindings-1.0.0.jar http://chemistry.apache.org/ quartz-2.3.1.jar http://quartz-scheduler.org/ -jackson-core-2.10.0.jar https://github.com/FasterXML/jackson -jackson-annotations-2.10.0.jar https://github.com/FasterXML/jackson -jackson-databind-2.10.0.jar https://github.com/FasterXML/jackson +jackson-core-2.10.1.jar https://github.com/FasterXML/jackson +jackson-annotations-2.10.1.jar https://github.com/FasterXML/jackson +jackson-databind-2.10.1.jar https://github.com/FasterXML/jackson commons-httpclient-3.1-HTTPCLIENT-1265.jar http://jakarta.apache.org/commons/ spring-aop-5.1.8.RELEASE.jar http://projects.spring.io/spring-framework/ spring-beans-5.1.8.RELEASE.jar http://projects.spring.io/spring-framework/ From 773bdf41b1e1569fe5b41aaf4d865b6a1b86c4d2 Mon Sep 17 00:00:00 2001 From: agazzarini Date: Thu, 14 Nov 2019 15:14:38 +0100 Subject: [PATCH 5/5] [ SEARCH-875 ] Review comments addressed --- .../src/main/java/org/alfresco/solr/utils/Utils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java b/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java index 04e553119..3b586ca11 100644 --- a/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java +++ b/search-services/alfresco-search/src/main/java/org/alfresco/solr/utils/Utils.java @@ -18,6 +18,9 @@ */ package org.alfresco.solr.utils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.Closeable; import java.io.IOException; import java.util.Collection; @@ -25,6 +28,8 @@ import java.util.Collections; public abstract class Utils { + private static final Logger LOGGER = LoggerFactory.getLogger(Utils.class); + /** * Returns the same input collection if that is not null, otherwise a new empty collection. * Provides a safe way for iterating over a returned collection (which could be null). @@ -89,7 +94,7 @@ public abstract class Utils } catch(IOException ignore) { - // Nothing to be done here + LOGGER.warn("Unable to properly close the resource instance {}. See the stacktrace below for further details.", resource, ignore); } } }