From 865f46c9e466b784159dbebd351b2a4a74153dbb Mon Sep 17 00:00:00 2001 From: Sebastien Besson Date: Mon, 22 Nov 2021 14:36:05 +0000 Subject: [PATCH] Update ScriptRepoHelper to use commons-io:2.6 Unlike the rest of the OMERO Java components which declare commons-io:commons-io:2.6 as a dependency in build.gradle, this component still inherits the 1.x version of commons-io transitively (via Bio-Formats and its jhdf5 dependency). As we are trying to upgrade the underlying jhdf5 library, the ScriptRepoHelper class needs to be updated to be compatible with commons-io 2.x --- build.gradle | 2 ++ src/main/java/ome/services/scripts/ScriptRepoHelper.java | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 12b5ac0f0..356caf07a 100644 --- a/build.gradle +++ b/build.gradle @@ -71,6 +71,8 @@ dependencies { } implementation("net.sf.ehcache:ehcache:2.10.4") + + implementation("commons-io:commons-io:2.6") } diff --git a/src/main/java/ome/services/scripts/ScriptRepoHelper.java b/src/main/java/ome/services/scripts/ScriptRepoHelper.java index 306c58017..a06b9f089 100644 --- a/src/main/java/ome/services/scripts/ScriptRepoHelper.java +++ b/src/main/java/ome/services/scripts/ScriptRepoHelper.java @@ -6,7 +6,6 @@ package ome.services.scripts; import java.io.File; -import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -77,7 +76,7 @@ public class ScriptRepoHelper extends OnContextRefreshedEventListener { * matching scripts in the given directory. */ public final static IOFileFilter BASE_SCRIPT_FILTER = new AndFileFilter(Arrays - .asList(new FileFilter[] { EmptyFileFilter.NOT_EMPTY, + .asList(new IOFileFilter[] { EmptyFileFilter.NOT_EMPTY, HiddenFileFilter.VISIBLE, CanReadFileFilter.CAN_READ })); private final Map types = @@ -191,8 +190,8 @@ public void handleContextRefreshedEvent(ContextRefreshedEvent event) { event.getApplicationContext() .getBeansOfType(ScriptFileType.class)); - final List andFilters = new ArrayList(); - final List orFilters= new ArrayList(); + final List andFilters = new ArrayList(); + final List orFilters= new ArrayList(); for (Map.Entry entry : types.entrySet()) { IOFileFilter found = entry.getValue().getFileFilter(); log.info("Registering {}: {}", entry.getKey(), found);