From 4b5e9811af19f56609f7c993a9392de9872dbcab Mon Sep 17 00:00:00 2001 From: "Harry L. Hoots, III" Date: Wed, 28 Feb 2024 09:41:07 -0500 Subject: [PATCH] Issue #27775: Upgrade commons compress to 1.26 --- .../check_this_in_if_it_changes/pom.xml | 9 +- dev/cnf/oss_dependencies.maven | 5 +- .../bnd.bnd | 7 +- dev/com.ibm.ws.filetransfer/bnd.bnd | 7 +- dev/com.ibm.ws.kernel.boot.archive/bnd.bnd | 14 ++- dev/com.ibm.ws.kernel.boot_fat/bnd.bnd | 1 + dev/com.ibm.ws.kernel.feature_fat/bnd.bnd | 3 +- .../build.gradle | 2 +- dev/com.ibm.ws.logging_fat/bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 4 +- .../bnd.overrides | 2 +- dev/com.ibm.ws.org.apache.commons.io/bnd.bnd | 4 +- .../bnd.overrides | 14 +-- .../persistence/FilePersistenceProvider.java | 23 ++-- .../v1/pojo/PlainTextLoaderService.java | 101 +++++++++--------- .../bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 1 + .../bnd.bnd | 4 +- .../bnd.overrides | 4 +- dev/io.openliberty.org.testcontainers/bnd.bnd | 10 +- 28 files changed, 133 insertions(+), 92 deletions(-) diff --git a/dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml b/dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml index cdf3dcef8b3..2c9c318d9ea 100644 --- a/dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml +++ b/dev/cnf/dependabot/check_this_in_if_it_changes/pom.xml @@ -394,7 +394,7 @@ commons-codec commons-codec - 1.15 + 1.16.1 commons-collections @@ -414,7 +414,7 @@ commons-io commons-io - 2.11.0 + 2.15.1 commons-lang @@ -1696,6 +1696,11 @@ commons-compress 1.24.0 + + org.apache.commons + commons-compress + 1.26.0 + org.apache.commons commons-dbcp2 diff --git a/dev/cnf/oss_dependencies.maven b/dev/cnf/oss_dependencies.maven index edb82271b6a..d24c9d9821e 100644 --- a/dev/cnf/oss_dependencies.maven +++ b/dev/cnf/oss_dependencies.maven @@ -74,11 +74,11 @@ com.sun.xml.ws:jaxws-tools:2.3.6 com.sun.xml.ws:jaxws-tools:3.0.2 com.unboundid:unboundid-ldapsdk:5.1.0 commons-cli:commons-cli:1.4 -commons-codec:commons-codec:1.15 +commons-codec:commons-codec:1.16.1 commons-collections:commons-collections:3.2.2 commons-digester:commons-digester:2.1 commons-fileupload:commons-fileupload:1.5 -commons-io:commons-io:2.11.0 +commons-io:commons-io:2.15.1 commons-lang:commons-lang:2.4 commons-logging:commons-logging:1.2 commons-net:commons-net:3.6 @@ -335,6 +335,7 @@ org.apache.ant:ant:1.10.10 org.apache.bcel:bcel:6.6.1 org.apache.commons:commons-collections4:4.4 org.apache.commons:commons-compress:1.24.0 +org.apache.commons:commons-compress:1.26.0 org.apache.commons:commons-dbcp2:2.7.0 org.apache.commons:commons-lang3:3.14.0 org.apache.commons:commons-math:2.2 diff --git a/dev/com.ibm.ws.filetransfer.routing.archiveExpander/bnd.bnd b/dev/com.ibm.ws.filetransfer.routing.archiveExpander/bnd.bnd index 1664af4bd0b..a4bb39e73cc 100644 --- a/dev/com.ibm.ws.filetransfer.routing.archiveExpander/bnd.bnd +++ b/dev/com.ibm.ws.filetransfer.routing.archiveExpander/bnd.bnd @@ -20,10 +20,12 @@ Bundle-Description: Archive Expander; version=${bVersion} Main-Class: com.ibm.ws.filetransfer.routing.archiveExpander.ArchiveExpander Export-Package: \ - com.ibm.ws.filetransfer.routing.archiveExpander + com.ibm.ws.filetransfer.routing.archiveExpander Private-Package: \ - org.apache.commons.compress.archivers.zip + org.apache.commons.compress.archivers.zip, \ + org.apache.commons.io.build, \ + org.apache.commons.io.file.attribute Import-Package: \ !org.apache.commons.compress.compressors.lzw, \ @@ -53,4 +55,5 @@ instrument.disabled: true -buildpath: \ com.ibm.ws.org.apache.commons.compress;version=latest,\ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.ws.org.osgi.annotation.versioning;version=latest diff --git a/dev/com.ibm.ws.filetransfer/bnd.bnd b/dev/com.ibm.ws.filetransfer/bnd.bnd index f5e9e4177af..ea589f43d35 100644 --- a/dev/com.ibm.ws.filetransfer/bnd.bnd +++ b/dev/com.ibm.ws.filetransfer/bnd.bnd @@ -21,7 +21,9 @@ Export-Package:\ com.ibm.ws.filetransfer.util Private-Package: \ - com.ibm.ws.filetransfer.internal.* + com.ibm.ws.filetransfer.internal.*, \ + org.apache.commons.io.build, \ + org.apache.commons.io.file.attribute Include-Resource: \ OSGI-INF=resources/OSGI-INF @@ -49,4 +51,5 @@ instrument.classesExcludes: com/ibm/ws/filetransfer/internal/resources/*.class org.hamcrest:hamcrest-all;version=1.3, \ org.jmock:jmock-junit4;strategy=exact;version=2.5.1, \ org.jmock:jmock;strategy=exact;version=2.5.1, \ - com.ibm.ws.kernel.boot;version=latest + com.ibm.ws.kernel.boot;version=latest, \ + com.ibm.ws.org.apache.commons.io;version=latest diff --git a/dev/com.ibm.ws.kernel.boot.archive/bnd.bnd b/dev/com.ibm.ws.kernel.boot.archive/bnd.bnd index cfa2fa8a1d8..0ae33b7a7ea 100644 --- a/dev/com.ibm.ws.kernel.boot.archive/bnd.bnd +++ b/dev/com.ibm.ws.kernel.boot.archive/bnd.bnd @@ -24,7 +24,15 @@ Private-Package: \ org.apache.commons.compress.compressors.deflate64, \ org.apache.commons.compress.compressors, \ org.apache.commons.compress.compressors.lzw, \ - org.apache.commons.compress.utils + org.apache.commons.compress.utils, \ + org.apache.commons.codec, \ + org.apache.commons.io, \ + org.apache.commons.io.file.attribute, \ + org.apache.commons.io.input, \ + org.apache.commons.io.output, \ + org.apache.commons.io.function + + instrument.disabled: true @@ -36,4 +44,6 @@ instrument.disabled: true com.ibm.ws.logging.core;version=latest, \ com.ibm.ws.org.osgi.annotation.versioning;version=latest, \ com.ibm.ws.logging;version=latest, \ - com.ibm.ws.org.apache.commons.compress;version=latest + com.ibm.ws.org.apache.commons.compress;version=latest, \ + com.ibm.ws.org.apache.commons.io;version=latest,\ + io.openliberty.org.apache.commons.codec;version=latest diff --git a/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd index f33f9dcb2a4..c737162da7c 100644 --- a/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd +++ b/dev/com.ibm.ws.kernel.boot_fat/bnd.bnd @@ -33,6 +33,7 @@ tested.features: mpconfig-1.3, concurrent-1.0, mpfaulttolerance-1.1, mpmetrics-1 org.jmock:jmock-junit4;strategy=exact;version=2.5.1, \ org.jmock:jmock;strategy=exact;version=2.5.1, \ com.ibm.ws.org.apache.commons.compress;version=latest, \ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.websphere.org.osgi.core;version=latest, \ com.ibm.websphere.org.osgi.service.cm;version=latest,\ com.ibm.websphere.org.osgi.service.component;version=latest,\ diff --git a/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd b/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd index e4a2439095c..33ab0ca61c6 100644 --- a/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd +++ b/dev/com.ibm.ws.kernel.feature_fat/bnd.bnd @@ -60,8 +60,7 @@ tested.features: needsNewEe-1.0, newEe-1.0, \ org.hamcrest:hamcrest-all;version=1.3,\ org.jmock:jmock-junit4;strategy=exact;version=2.5.1,\ org.jmock:jmock;strategy=exact;version=2.5.1,\ - com.ibm.ws.org.apache.commons.compress;version=latest,\ - com.ibm.ws.org.apache.commons.compress,\ + org.apache.commons:commons-compress;strategy=exact;version=1.24.0, \ fattest.simplicity;version=latest,\ com.ibm.websphere.org.osgi.core;version=latest,\ com.ibm.websphere.org.osgi.service.cm;version=latest,\ diff --git a/dev/com.ibm.ws.kernel.feature_fat/build.gradle b/dev/com.ibm.ws.kernel.feature_fat/build.gradle index 79107675ca0..e0cc852db61 100644 --- a/dev/com.ibm.ws.kernel.feature_fat/build.gradle +++ b/dev/com.ibm.ws.kernel.feature_fat/build.gradle @@ -12,7 +12,7 @@ *******************************************************************************/ dependencies { - requiredLibs project(':com.ibm.ws.org.apache.commons.compress') + requiredLibs 'org.apache.commons:commons-compress:1.24.0' } task copyBundles { diff --git a/dev/com.ibm.ws.logging_fat/bnd.bnd b/dev/com.ibm.ws.logging_fat/bnd.bnd index 8b2fc81a47a..2b8e39ecb3c 100644 --- a/dev/com.ibm.ws.logging_fat/bnd.bnd +++ b/dev/com.ibm.ws.logging_fat/bnd.bnd @@ -42,6 +42,7 @@ fat.project: true org.jmock:jmock-junit4;strategy=exact;version=2.5.1, \ org.jmock:jmock;strategy=exact;version=2.5.1, \ com.ibm.ws.org.apache.commons.compress;version=latest, \ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.websphere.org.osgi.core;version=latest, \ com.ibm.websphere.org.osgi.service.cm;version=latest,\ com.ibm.websphere.org.osgi.service.component;version=latest,\ diff --git a/dev/com.ibm.ws.microprofile.health.2.0_fat/bnd.bnd b/dev/com.ibm.ws.microprofile.health.2.0_fat/bnd.bnd index ccb4437c38e..e2b3dfa579c 100644 --- a/dev/com.ibm.ws.microprofile.health.2.0_fat/bnd.bnd +++ b/dev/com.ibm.ws.microprofile.health.2.0_fat/bnd.bnd @@ -27,6 +27,7 @@ tested.features=servlet-4.0,cdi-2.0,mphealth-3.0,mphealth-3.1,mpConfig-1.4,mpCon -buildpath: \ com.ibm.ws.org.apache.commons.compress;version=latest, \ + com.ibm.ws.org.apache.commons.io;version=latest, \ org.apache.johnzon:johnzon-core;version=1.1.0, \ com.ibm.websphere.javaee.jsonp.1.1;version=latest, \ com.ibm.websphere.javaee.cdi.1.2;version=latest, \ diff --git a/dev/com.ibm.ws.microprofile.health_fat/bnd.bnd b/dev/com.ibm.ws.microprofile.health_fat/bnd.bnd index 76c5ee94637..0b1f6536160 100644 --- a/dev/com.ibm.ws.microprofile.health_fat/bnd.bnd +++ b/dev/com.ibm.ws.microprofile.health_fat/bnd.bnd @@ -29,6 +29,7 @@ fat.project: true -buildpath: \ com.ibm.ws.org.apache.commons.compress;version=latest, \ + com.ibm.ws.org.apache.commons.io;version=latest, \ org.apache.johnzon:johnzon-core;version=1.1.0, \ com.ibm.websphere.javaee.jsonp.1.1;version=latest, \ com.ibm.websphere.javaee.cdi.1.2;version=latest, \ diff --git a/dev/com.ibm.ws.microprofile.metrics.2.x.monitor_fat/bnd.bnd b/dev/com.ibm.ws.microprofile.metrics.2.x.monitor_fat/bnd.bnd index 49c790bc637..b628fc287b3 100644 --- a/dev/com.ibm.ws.microprofile.metrics.2.x.monitor_fat/bnd.bnd +++ b/dev/com.ibm.ws.microprofile.metrics.2.x.monitor_fat/bnd.bnd @@ -39,6 +39,7 @@ tested.features:\ org.jmock:jmock-junit4;strategy=exact;version=2.5.1,\ org.jmock:jmock;strategy=exact;version=2.5.1,\ com.ibm.ws.org.apache.commons.compress;version=latest,\ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.websphere.rest.handler;version=latest,\ com.ibm.websphere.javaee.servlet.3.1;version=latest,\ com.ibm.websphere.javaee.cdi.2.0;version=latest,\ diff --git a/dev/com.ibm.ws.microprofile.metrics.monitor_fat/bnd.bnd b/dev/com.ibm.ws.microprofile.metrics.monitor_fat/bnd.bnd index d82a7b6359a..cc82bada393 100644 --- a/dev/com.ibm.ws.microprofile.metrics.monitor_fat/bnd.bnd +++ b/dev/com.ibm.ws.microprofile.metrics.monitor_fat/bnd.bnd @@ -37,6 +37,7 @@ fat.project: true org.jmock:jmock-junit4;strategy=exact;version=2.5.1, \ org.jmock:jmock;strategy=exact;version=2.5.1, \ com.ibm.ws.org.apache.commons.compress;version=latest,\ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.websphere.rest.handler;version=latest, \ com.ibm.websphere.javaee.servlet.3.1;version=latest, \ com.ibm.websphere.javaee.cdi.2.0;version=latest,\ diff --git a/dev/com.ibm.ws.microprofile.metrics_fat/bnd.bnd b/dev/com.ibm.ws.microprofile.metrics_fat/bnd.bnd index 53d358ba080..3a562537f70 100644 --- a/dev/com.ibm.ws.microprofile.metrics_fat/bnd.bnd +++ b/dev/com.ibm.ws.microprofile.metrics_fat/bnd.bnd @@ -36,6 +36,7 @@ fat.project: true org.jmock:jmock-junit4;strategy=exact;version=2.5.1,\ org.jmock:jmock;strategy=exact;version=2.5.1,\ com.ibm.ws.org.apache.commons.compress;version=latest,\ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.websphere.rest.handler;version=latest,\ com.ibm.websphere.javaee.servlet.3.1;version=latest,\ com.ibm.websphere.javaee.cdi.2.0;version=latest,\ diff --git a/dev/com.ibm.ws.org.apache.commons.compress/bnd.bnd b/dev/com.ibm.ws.org.apache.commons.compress/bnd.bnd index 9152737c88b..7e4e4ea8f4e 100644 --- a/dev/com.ibm.ws.org.apache.commons.compress/bnd.bnd +++ b/dev/com.ibm.ws.org.apache.commons.compress/bnd.bnd @@ -10,8 +10,8 @@ # Contributors: # IBM Corporation - initial API and implementation #******************************************************************************* --include= jar:${fileuri;${repo;org.apache.commons:commons-compress;1.24.0}}!/META-INF/MANIFEST.MF,bnd.overrides +-include= jar:${fileuri;${repo;org.apache.commons:commons-compress;1.26.0}}!/META-INF/MANIFEST.MF,bnd.overrides publish.wlp.jar.disabled: true --buildpath: org.apache.commons:commons-compress;version=1.24.0 +-buildpath: org.apache.commons:commons-compress;version=1.26.0 diff --git a/dev/com.ibm.ws.org.apache.commons.compress/bnd.overrides b/dev/com.ibm.ws.org.apache.commons.compress/bnd.overrides index f8c89e65195..a05ad223ce5 100644 --- a/dev/com.ibm.ws.org.apache.commons.compress/bnd.overrides +++ b/dev/com.ibm.ws.org.apache.commons.compress/bnd.overrides @@ -4,4 +4,4 @@ bVersion=1.0 Bundle-SymbolicName: com.ibm.ws.org.apache.commons.compress Include-Resource: \ - @${repo;org.apache.commons:commons-compress;1.24.0}!/!META-INF/maven/* \ No newline at end of file + @${repo;org.apache.commons:commons-compress;1.26.0}!/!META-INF/maven/* \ No newline at end of file diff --git a/dev/com.ibm.ws.org.apache.commons.io/bnd.bnd b/dev/com.ibm.ws.org.apache.commons.io/bnd.bnd index 8775095471c..abac28f3ea8 100644 --- a/dev/com.ibm.ws.org.apache.commons.io/bnd.bnd +++ b/dev/com.ibm.ws.org.apache.commons.io/bnd.bnd @@ -10,6 +10,6 @@ # Contributors: # IBM Corporation - initial API and implementation #******************************************************************************* --include= jar:${fileuri;${repo;commons-io:commons-io;2.11.0;EXACT}}!/META-INF/MANIFEST.MF,bnd.overrides +-include= jar:${fileuri;${repo;commons-io:commons-io;2.15.1;EXACT}}!/META-INF/MANIFEST.MF,bnd.overrides --buildpath: commons-io:commons-io;strategy=exact;version=2.11.0 +-buildpath: commons-io:commons-io;strategy=exact;version=2.15.1 diff --git a/dev/com.ibm.ws.org.apache.commons.io/bnd.overrides b/dev/com.ibm.ws.org.apache.commons.io/bnd.overrides index 98c6fdba812..565116ff7af 100644 --- a/dev/com.ibm.ws.org.apache.commons.io/bnd.overrides +++ b/dev/com.ibm.ws.org.apache.commons.io/bnd.overrides @@ -13,12 +13,12 @@ Import-Package: \ !org.apache.commons.io.*, * Export-Package: \ -org.apache.commons.io;version="2.11.0",org.apache.commons.io.comparator;version="2.11.0", \ -org.apache.commons.io.file;version="2.11.0",org.apache.commons.io.file.spi;version="2.11.0", \ -org.apache.commons.io.filefilter;version="2.11.0",org.apache.commons.io.function;version="2.11.0", \ -org.apache.commons.io.input;version="2.11.0",org.apache.commons.io.input.buffer;version="2.11.0", \ -org.apache.commons.io.monitor;version="2.11.0",org.apache.commons.io.output;version="2.11.0", \ -org.apache.commons.io.serialization;version="2.11.0" +org.apache.commons.io;version="2.15.1",org.apache.commons.io.comparator;version="2.15.1", \ +org.apache.commons.io.file;version="2.15.1",org.apache.commons.io.file.spi;version="2.15.1", \ +org.apache.commons.io.filefilter;version="2.15.1",org.apache.commons.io.function;version="2.15.1", \ +org.apache.commons.io.input;version="2.15.1",org.apache.commons.io.input.buffer;version="2.15.1", \ +org.apache.commons.io.monitor;version="2.15.1",org.apache.commons.io.output;version="2.15.1", \ +org.apache.commons.io.serialization;version="2.15.1" -Include-Resource: @${repo;commons-io:commons-io;2.11.0;EXACT}!/!META-INF/MANIFEST.MF|META-INF/maven/* +Include-Resource: @${repo;commons-io:commons-io;2.15.1;EXACT}!/!META-INF/MANIFEST.MF|META-INF/maven/* diff --git a/dev/com.ibm.ws.ui/src/com/ibm/ws/ui/internal/persistence/FilePersistenceProvider.java b/dev/com.ibm.ws.ui/src/com/ibm/ws/ui/internal/persistence/FilePersistenceProvider.java index 2f860ef019e..aeebb7fc033 100755 --- a/dev/com.ibm.ws.ui/src/com/ibm/ws/ui/internal/persistence/FilePersistenceProvider.java +++ b/dev/com.ibm.ws.ui/src/com/ibm/ws/ui/internal/persistence/FilePersistenceProvider.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-2.0/ - * + * * SPDX-License-Identifier: EPL-2.0 * * Contributors: @@ -15,6 +15,7 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.nio.file.NoSuchFileException; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.HashMap; @@ -74,7 +75,7 @@ public FilePersistenceProvider() { /** * Unit test constructor. Allows for override of the JSON API object and * IFileDebugger. - * + * * @param json * @param fDebug */ @@ -120,7 +121,7 @@ protected void deactivate() { * This method should not be called directly by any method except getPersistenceFileLockObj(). *

* This method will create the File object. - * + * * @param name The persistence name associated with the File * @return The File object which represents the underlying persistent file. * @throws IOException If the parent directories could not be created (if necessary) @@ -145,7 +146,7 @@ private File getPersistenceFile(final String name) { *

* Access to this method is synchronized. Callers should use the returned * object for local synchronization. - * + * * @param name The persistence name associated with the File 'lock object' * @return The associated File 'lock object' * @throws IOException If the File 'lock object' could not be properly created because the parent directories could not be created. @@ -165,7 +166,7 @@ private synchronized File getPersistenceFileLockObj(final String name) { * directories do not exist they will be created. If they can not be * created, an exception will be thrown to the caller. Parent directories * are NOT created by the Rest handler JSON API so we must ensure they are created here. - * + * * @param file The File whose parents should be created, if needed. * @throws IOException If the parent directories could not be created. */ @@ -277,6 +278,9 @@ public String loadPlainText(final String name) throws FileNotFoundException, IOE } catch (FileNotFoundException e) { // This is an expected error flow, do not FFDC or log anything throw e; + } catch (NoSuchFileException e) { + // This is an expected error flow, do not FFDC or log anything + throw e; } catch (IOException e) { Tr.error(tc, "FILE_PERSISTENCE_IO_ERROR", file.getAbsolutePath(), e.getMessage()); throw e; @@ -305,10 +309,8 @@ public Boolean run() { boolean deleted = file.delete(); File parent = file.getParentFile(); String[] sa = parent.list(); - if (sa.length == 0) - { - if (parent.delete() == false) - { + if (sa.length == 0) { + if (parent.delete() == false) { Tr.warning(tc, "TOOLDATA_PARENT_DIR_DELETE_RESULT_FALSE", parent.getAbsolutePath()); } } @@ -321,8 +323,7 @@ public Boolean run() { /** {@inheritDoc} */ @Override - public boolean exists(String name) - { + public boolean exists(String name) { final File file = getPersistenceFileLockObj(name); synchronized (file) { diff --git a/dev/com.ibm.ws.ui/src/com/ibm/ws/ui/internal/v1/pojo/PlainTextLoaderService.java b/dev/com.ibm.ws.ui/src/com/ibm/ws/ui/internal/v1/pojo/PlainTextLoaderService.java index e8aede67d5e..b27ef8dca84 100755 --- a/dev/com.ibm.ws.ui/src/com/ibm/ws/ui/internal/v1/pojo/PlainTextLoaderService.java +++ b/dev/com.ibm.ws.ui/src/com/ibm/ws/ui/internal/v1/pojo/PlainTextLoaderService.java @@ -4,7 +4,7 @@ * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-2.0/ - * + * * SPDX-License-Identifier: EPL-2.0 * * Contributors: @@ -14,7 +14,7 @@ import java.io.FileNotFoundException; import java.io.IOException; -import java.util.Base64; +import java.nio.file.NoSuchFileException; import java.util.HashMap; import java.util.Map; @@ -51,7 +51,7 @@ public class PlainTextLoaderService implements IToolDataService { /** * Only set the FILE persistence provider. This service is required. - * + * * @param provider */ @Reference(service = IPersistenceProvider.class, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY, @@ -70,7 +70,7 @@ protected synchronized void unsetIPersistenceProviderFILE(final IPersistenceProv /** * Only set the COLLECTIVE persistence provider. This server is optional. - * + * * @param provider */ @Reference(service = IPersistenceProvider.class, policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY, @@ -89,14 +89,16 @@ protected synchronized void unsetIPersistenceProviderCOLLECTIVE(final IPersisten } @Activate - protected synchronized void activate() {} + protected synchronized void activate() { + } @Deactivate - protected synchronized void deactive() {} + protected synchronized void deactive() { + } /** * Gets the effective instance of the IPersistenceProvider. - * + * * @return The instance of IPersistenceProvider */ protected synchronized IPersistenceProvider getPersist() { @@ -136,22 +138,22 @@ private synchronized Object getSyncObject(final String encodedPersistedName) { } /** - * The persisted file name for the tool with user id in it in previous releases is not encrypted because it is sensitive. However, + * The persisted file name for the tool with user id in it in previous releases is not encrypted because it is sensitive. However, * encryption is now done on the user id to avoid path traversal attack through the id and to provide an unique string. * * @param toolName The name of the tool - * @param userId The user id + * @param userId The user id * @return The encrypted file path to the tool data */ private String getEncodedPersistedName(final String toolName, final String userId) { return toolName + "/" + Toolbox.getEncodedUserId(userId); } - /** + /** * Each tool persists its data in non-encrypted persisted file path in previous releases. * * @param toolName The name of the tool - * @param userId The user id + * @param userId The user id * @return The non-encrypted file path to the tool data */ private String getNonencodedPersistedName(final String toolName, final String userId) { @@ -162,7 +164,7 @@ private String getNonencodedPersistedName(final String toolName, final String us * Return the encrypted and non-encrypted persisted names for the given tool and user id. * * @param toolName The name of the tool - * @param userId The user id + * @param userId The user id * @return The tool file paths including both encrypted and non-encrypted json file names */ private String[] getPersistedNames(final String toolName, final String userId) { @@ -181,14 +183,14 @@ private String[] getPersistedNames(final String toolName, final String userId) { * Promote the tool data for the given tool and user from the specified persistence provider to its encrypted persisted name. * * @param persistProvider The persistence layer - * @param persistedNames String array containing the non-encrypted and encrypted persisted file paths - * @param userId The user id - * @param toolName The name of the tool - * @param toolData The tool data to be persisted + * @param persistedNames String array containing the non-encrypted and encrypted persisted file paths + * @param userId The user id + * @param toolName The name of the tool + * @param toolData The tool data to be persisted * @return Returns the tool data, or null if the file is not found, or if IOException is thrown. */ - private void convertToEncodedPersistedName(final IPersistenceProvider persistProvider, final String[] persistedNames, - final String userId, final String toolName, final String toolData) { + private void convertToEncodedPersistedName(final IPersistenceProvider persistProvider, final String[] persistedNames, + final String userId, final String toolName, final String toolData) { if (tc.isDebugEnabled()) { Tr.debug(tc, "convertToEncodedPersistedName", "converting from " + persistedNames[0] + " to " + persistedNames[1]); } @@ -197,7 +199,7 @@ private void convertToEncodedPersistedName(final IPersistenceProvider persistPro deleteToolDataFromPersistence(persistProvider, persistedNames[0], userId, toolName); // create the tool data in the encoded file name if (postAndPutToolDataToPersistence(persistProvider, persistedNames[1], userId, toolName, toolData) != null) { - Tr.info(tc, "TOOL_DATA_PROMOTED_TO_ENCODED_NAME", new Object[] {toolName, userId}); + Tr.info(tc, "TOOL_DATA_PROMOTED_TO_ENCODED_NAME", new Object[] { toolName, userId }); } } @@ -205,11 +207,11 @@ private void convertToEncodedPersistedName(final IPersistenceProvider persistPro @Override public String getToolData(String userId, String toolName) { if (tc.isEntryEnabled()) { - Tr.entry(tc, "getToolData", new Object[] {"userId=" + userId, "toolName=" + toolName}); + Tr.entry(tc, "getToolData", new Object[] { "userId=" + userId, "toolName=" + toolName }); } String[] persistedNames = getPersistedNames(toolName, userId); - synchronized(getSyncObject(persistedNames[1])) { + synchronized (getSyncObject(persistedNames[1])) { final IPersistenceProvider persistenceProvider = getPersist(); // if the persisted tool data stored in the encoded file name does not exist, then read the data from the non-ecoded file name. // If the non-ecoded file name does not exist, then it is safe to assume persisted data not available for this tool. @@ -240,9 +242,9 @@ public String getToolData(String userId, String toolName) { * Load the tool data for the given persisted file path from the specified persistence provider. * * @param persistProvider The persistence layer - * @param persistedName The persisted file path for the tool - * @param userId The user id - * @param toolName the name of the tool + * @param persistedName The persisted file path for the tool + * @param userId The user id + * @param toolName the name of the tool * @return Returns the tool data, or null if the file is not found, or if IOException is thrown. */ @FFDCIgnore(FileNotFoundException.class) @@ -257,6 +259,8 @@ private String loadToolDataFromPersistence(final IPersistenceProvider persist, f Tr.info(tc, "LOADED_PERSISTED_TOOL_DATA", userId, toolName); } catch (FileNotFoundException e) { // do nothing and return null toolData + } catch (NoSuchFileException e) { + // do nothing and return null toolData } catch (IOException e) { // A general I/O error occured while accessing the persisted data. // This is the unexpected code path. We should FFDC here. @@ -274,18 +278,18 @@ private String loadToolDataFromPersistence(final IPersistenceProvider persist, f @Override public boolean deleteToolData(String userId, String toolName) { if (tc.isEntryEnabled()) { - Tr.entry(tc, "deleteToolData", new Object[] {"userId=" + userId, "toolName=" + toolName}); + Tr.entry(tc, "deleteToolData", new Object[] { "userId=" + userId, "toolName=" + toolName }); } String[] persistedNames = getPersistedNames(toolName, userId); boolean deletedFromCollective = true; boolean deletedFromFile = true; - synchronized(getSyncObject(persistedNames[1])) { + synchronized (getSyncObject(persistedNames[1])) { for (String persistedName : persistedNames) { if (persistenceProviderCollective != null) - deletedFromCollective = deleteToolDataFromPersistence(persistenceProviderCollective, persistedName, userId, toolName) && deletedFromCollective; + deletedFromCollective = deleteToolDataFromPersistence(persistenceProviderCollective, persistedName, userId, toolName) && deletedFromCollective; if (persistenceProviderFile != null) - deletedFromFile = deleteToolDataFromPersistence(persistenceProviderFile, persistedName, userId, toolName) && deletedFromFile; + deletedFromFile = deleteToolDataFromPersistence(persistenceProviderFile, persistedName, userId, toolName) && deletedFromFile; } } if (tc.isEntryEnabled()) { @@ -299,10 +303,10 @@ public boolean deleteToolData(String userId, String toolName) { @Override public String addToolData(String userId, String toolName, String toolData) { if (tc.isDebugEnabled()) { - Tr.debug(tc, "addToolData", new Object[] {"userId=" + userId, "toolName=" + toolName}); + Tr.debug(tc, "addToolData", new Object[] { "userId=" + userId, "toolName=" + toolName }); } String encodedPersistedName = getEncodedPersistedName(toolName, userId); - synchronized(getSyncObject(encodedPersistedName)) { + synchronized (getSyncObject(encodedPersistedName)) { return postAndPutToolDataToPersistence(getPersist(), encodedPersistedName, userId, toolName, toolData); } } @@ -311,9 +315,9 @@ public String addToolData(String userId, String toolName, String toolData) { * Deletes the tool data for the given persisted file path from the specified persistence provider. * * @param persistProvider The persistence layer - * @param persistedName The persisted file path for the tool - * @param userId The user id - * @param toolName the name of the tool + * @param persistedName The persisted file path for the tool + * @param userId The user id + * @param toolName the name of the tool * @return Returns true if the tool data is deleted or does not exist. Otherwise return false. */ private boolean deleteToolDataFromPersistence(final IPersistenceProvider persist, final String persistedName, final String userId, final String toolName) { @@ -323,8 +327,7 @@ private boolean deleteToolDataFromPersistence(final IPersistenceProvider persist // synchronized is done by the caller try { boolean ret = true; - if (persist != null && persist.exists(persistedName)) - { + if (persist != null && persist.exists(persistedName)) { ret = persist.delete(persistedName); if (ret) Tr.info(tc, "DELETED_PERSISTED_TOOL_DATA", userId, toolName); @@ -340,9 +343,9 @@ private boolean deleteToolDataFromPersistence(final IPersistenceProvider persist * Posts the tool data to the given encrypted persisted name using the specified persistence provider. * * @param persistProvider The persistence layer - * @param persistedName The encrypted persisted file path for the tool - * @param userId The userId of the tool data to be saved - * @param toolName the name of the tool + * @param persistedName The encrypted persisted file path for the tool + * @param userId The userId of the tool data to be saved + * @param toolName the name of the tool * @return Returns tool data string, otherwise null if error */ private String postAndPutToolDataToPersistence(final IPersistenceProvider persist, final String persistedName, final String userId, final String toolName, @@ -368,7 +371,7 @@ private String postAndPutToolDataToPersistence(final IPersistenceProvider persis @Override public boolean exists(String userId, String toolName) { String encodedPersistedName = getEncodedPersistedName(toolName, userId); - synchronized(getSyncObject(encodedPersistedName)) { + synchronized (getSyncObject(encodedPersistedName)) { if (persistenceProviderCollective != null) { return persistenceProviderCollective.exists(encodedPersistedName); } else { @@ -379,15 +382,14 @@ public boolean exists(String userId, String toolName) { /** {@inheritDoc} */ @Override - public void promoteIfPossible(String userId, String toolName) - { + public void promoteIfPossible(String userId, String toolName) { if (tc.isEntryEnabled()) { - Tr.entry(tc, "promoteIfPossible", new Object[] {"userId=" + userId, "toolName=" + toolName}); + Tr.entry(tc, "promoteIfPossible", new Object[] { "userId=" + userId, "toolName=" + toolName }); } // Try promoting the content in the encoded file name from the file persistence layer to collective first. If the file doesn't exist, then // promote the content in the non-encoded file name from the file to collective persistence layer. String[] persistedNames = getPersistedNames(toolName, userId); - synchronized(getSyncObject(persistedNames[1])) { + synchronized (getSyncObject(persistedNames[1])) { if (persistenceProviderCollective != null && persistenceProviderCollective.exists(persistedNames[1]) == false) { if (!promoteIfPossible(persistedNames[1], persistedNames[1], userId, toolName)) { promoteIfPossible(persistedNames[0], persistedNames[1], userId, toolName); @@ -403,19 +405,18 @@ public void promoteIfPossible(String userId, String toolName) * Promotes the tool data from file persistence layer to collective if data doesn't exist in collective. * * @param fromPersistedName The presisted file name in the file persistence layer to be prompted - * @param toPersistedName The persisted file name to be saved in the collective persistence layer - * @param userId The userId of the tool data to be saved - * @param toolName the name of the tool + * @param toPersistedName The persisted file name to be saved in the collective persistence layer + * @param userId The userId of the tool data to be saved + * @param toolName the name of the tool * @return Returns tool data string, otherwise null if error */ private boolean promoteIfPossible(final String fromPersistedName, final String toPersistedName, final String userId, final String toolName) { if (tc.isEntryEnabled()) { - Tr.entry(tc, "promoteIfPossible", new Object[] {"fromPersistedName=" + fromPersistedName, "toPersistedName=" + toPersistedName}); + Tr.entry(tc, "promoteIfPossible", new Object[] { "fromPersistedName=" + fromPersistedName, "toPersistedName=" + toPersistedName }); } boolean promoted = false; - - if (persistenceProviderFile.exists(fromPersistedName) == true) - { + + if (persistenceProviderFile.exists(fromPersistedName) == true) { try { String data = loadToolDataFromPersistence(persistenceProviderFile, fromPersistedName, userId, toolName); if (data != null && !"IOException".equals(data)) { diff --git a/dev/io.openliberty.microprofile.health.3.0.internal_fat/bnd.bnd b/dev/io.openliberty.microprofile.health.3.0.internal_fat/bnd.bnd index e3081975468..db0e4f0ec58 100644 --- a/dev/io.openliberty.microprofile.health.3.0.internal_fat/bnd.bnd +++ b/dev/io.openliberty.microprofile.health.3.0.internal_fat/bnd.bnd @@ -23,6 +23,7 @@ tested.features=servlet-4.0,cdi-2.0,mphealth-3.0,mpConfig-1.4,mpConfig-2.0 -buildpath: \ com.ibm.ws.org.apache.commons.compress;version=latest, \ + com.ibm.ws.org.apache.commons.io;version=latest, \ org.apache.johnzon:johnzon-core;version=1.1.0, \ com.ibm.websphere.javaee.jsonp.1.1;version=latest, \ com.ibm.websphere.javaee.cdi.2.0;version=latest, \ diff --git a/dev/io.openliberty.microprofile.health.3.1.internal_fat/bnd.bnd b/dev/io.openliberty.microprofile.health.3.1.internal_fat/bnd.bnd index ed5709e3bbb..8aed8367dc1 100644 --- a/dev/io.openliberty.microprofile.health.3.1.internal_fat/bnd.bnd +++ b/dev/io.openliberty.microprofile.health.3.1.internal_fat/bnd.bnd @@ -39,6 +39,7 @@ tested.features: \ -buildpath: \ com.ibm.ws.org.apache.commons.compress;version=latest, \ + com.ibm.ws.org.apache.commons.io;version=latest, \ org.apache.johnzon:johnzon-core;version=1.1.0, \ com.ibm.websphere.javaee.jsonp.1.1;version=latest, \ com.ibm.websphere.javaee.cdi.2.0;version=latest, \ diff --git a/dev/io.openliberty.microprofile.metrics.internal.3.x.monitor_fat/bnd.bnd b/dev/io.openliberty.microprofile.metrics.internal.3.x.monitor_fat/bnd.bnd index 7a6eb0986cd..ddd58fa30bf 100644 --- a/dev/io.openliberty.microprofile.metrics.internal.3.x.monitor_fat/bnd.bnd +++ b/dev/io.openliberty.microprofile.metrics.internal.3.x.monitor_fat/bnd.bnd @@ -41,6 +41,7 @@ tested.features:\ org.jmock:jmock-junit4;strategy=exact;version='2.5.1',\ org.jmock:jmock;strategy=exact;version='2.5.1',\ com.ibm.ws.org.apache.commons.compress;version=latest,\ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.websphere.rest.handler;version=latest,\ com.ibm.websphere.javaee.servlet.3.1;version=latest,\ com.ibm.websphere.javaee.cdi.2.0;version=latest,\ diff --git a/dev/io.openliberty.microprofile.metrics.internal.4.x.monitor_fat/bnd.bnd b/dev/io.openliberty.microprofile.metrics.internal.4.x.monitor_fat/bnd.bnd index f541b5497a9..a6283b53d2d 100644 --- a/dev/io.openliberty.microprofile.metrics.internal.4.x.monitor_fat/bnd.bnd +++ b/dev/io.openliberty.microprofile.metrics.internal.4.x.monitor_fat/bnd.bnd @@ -45,6 +45,7 @@ tested.features:\ org.jmock:jmock-junit4;strategy=exact;version='2.5.1',\ org.jmock:jmock;strategy=exact;version='2.5.1',\ com.ibm.ws.org.apache.commons.compress;version=latest,\ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.websphere.rest.handler;version=latest,\ io.openliberty.jakarta.servlet.5.0;version=latest,\ io.openliberty.jakarta.cdi.3.0;version=latest,\ diff --git a/dev/io.openliberty.microprofile.metrics.internal.5.x.monitor_fat/bnd.bnd b/dev/io.openliberty.microprofile.metrics.internal.5.x.monitor_fat/bnd.bnd index 305f78bca43..a3dc6cd79da 100644 --- a/dev/io.openliberty.microprofile.metrics.internal.5.x.monitor_fat/bnd.bnd +++ b/dev/io.openliberty.microprofile.metrics.internal.5.x.monitor_fat/bnd.bnd @@ -49,6 +49,7 @@ tested.features:\ org.jmock:jmock-junit4;strategy=exact;version='2.5.1',\ org.jmock:jmock;strategy=exact;version='2.5.1',\ com.ibm.ws.org.apache.commons.compress;version=latest,\ + com.ibm.ws.org.apache.commons.io;version=latest, \ com.ibm.websphere.rest.handler;version=latest,\ io.openliberty.jakarta.servlet.6.0;version=latest,\ io.openliberty.jakarta.cdi.4.0;version=latest,\ diff --git a/dev/io.openliberty.org.apache.commons.codec/bnd.bnd b/dev/io.openliberty.org.apache.commons.codec/bnd.bnd index 341311dcbb6..e7817718358 100644 --- a/dev/io.openliberty.org.apache.commons.codec/bnd.bnd +++ b/dev/io.openliberty.org.apache.commons.codec/bnd.bnd @@ -10,6 +10,6 @@ # Contributors: # IBM Corporation - initial API and implementation #******************************************************************************* --include= jar:${fileuri;${repo;commons-codec:commons-codec;1.15}}!/META-INF/MANIFEST.MF,bnd.overrides +-include= jar:${fileuri;${repo;commons-codec:commons-codec;1.16.1}}!/META-INF/MANIFEST.MF,bnd.overrides --buildpath: commons-codec:commons-codec;version=1.15 +-buildpath: commons-codec:commons-codec;strategy=exact;version=1.16.1 diff --git a/dev/io.openliberty.org.apache.commons.codec/bnd.overrides b/dev/io.openliberty.org.apache.commons.codec/bnd.overrides index da54a1b8610..d643f96c06d 100644 --- a/dev/io.openliberty.org.apache.commons.codec/bnd.overrides +++ b/dev/io.openliberty.org.apache.commons.codec/bnd.overrides @@ -1,7 +1,7 @@ -include= ~../cnf/resources/bnd/rejar.props -bVersion=1.15 +bVersion=1.16 Bundle-SymbolicName: io.openliberty.org.apache.commons.codec Include-Resource: \ - @${repo;commons-codec:commons-codec;1.15;EXACT}!/!META-INF/maven/* \ No newline at end of file + @${repo;commons-codec:commons-codec;1.16.1;EXACT}!/!META-INF/maven/* \ No newline at end of file diff --git a/dev/io.openliberty.org.testcontainers/bnd.bnd b/dev/io.openliberty.org.testcontainers/bnd.bnd index 1998202a77a..fb5194fe46f 100644 --- a/dev/io.openliberty.org.testcontainers/bnd.bnd +++ b/dev/io.openliberty.org.testcontainers/bnd.bnd @@ -27,9 +27,13 @@ Bundle-Description: FAT Testcontainer Bundle; version=${bVersion} Export-Package: \ com.github.*;version="${dockerJavaVersion}",\ com.sun.jna.*;version="5.8.0",\ - org.apache.commons.*;version="1.24.0",\ + org.apache.commons.codec.*;version="1.16.1",\ + org.apache.commons.compress.*;version="1.26.0",\ + org.apache.commons.io.*;version="2.15.1",\ org.testcontainers.*;version="${testContainerVersion}";-split-package:=merge-last,\ - org.rnorth.*;version="1.0.8" + org.rnorth.*;version="1.0.8",\ + + #Ensure that /META-INF/service folder from testcontainers core project is included in bundle. # This will ensure that the other docker container strategies are accessible at runtime. @@ -53,6 +57,8 @@ generate.replacement: true com.github.docker-java:docker-java-transport;version=${dockerJavaVersion},\ com.github.docker-java:docker-java-transport-zerodep;version=${dockerJavaVersion},\ com.ibm.ws.org.apache.commons.compress;version=latest,\ + com.ibm.ws.org.apache.commons.io;version=latest, \ + io.openliberty.org.apache.commons.codec;version=latest, \ org.testcontainers:testcontainers;version=${testContainerVersion},\ org.testcontainers:database-commons;version=${testContainerVersion},\ org.testcontainers:jdbc;version=${testContainerVersion},\