* 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},\