From 5ab51caf3879b5a4990ecb0649b08fe28ec1af40 Mon Sep 17 00:00:00 2001 From: Matt Nash Date: Wed, 6 Nov 2013 11:21:24 -0600 Subject: [PATCH] Issue #2511 fix for edex localization adapter to allow filename to appear in path Change-Id: I9fea157a67799e1168d4b5f7efaf5ef6cdd64933 Former-commit-id: b3ac4b7a9cbbbad9cf76d5fdc2e1a99e2c43c175 [formerly 8404299627c7d27731910821befc068767c43aa1] Former-commit-id: 19bfe014c92b5e51a4d85680a08b3227f0989715 --- .../raytheon/edex/utility/EDEXLocalizationAdapter.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/edexOsgi/com.raytheon.edex.common/src/com/raytheon/edex/utility/EDEXLocalizationAdapter.java b/edexOsgi/com.raytheon.edex.common/src/com/raytheon/edex/utility/EDEXLocalizationAdapter.java index e7c79b6a09..5dd0ffd870 100644 --- a/edexOsgi/com.raytheon.edex.common/src/com/raytheon/edex/utility/EDEXLocalizationAdapter.java +++ b/edexOsgi/com.raytheon.edex.common/src/com/raytheon/edex/utility/EDEXLocalizationAdapter.java @@ -58,6 +58,8 @@ import com.raytheon.uf.edex.core.props.PropertiesFactory; * ------------ ---------- ----------- -------------------------- * Jul 11, 2008 1250 jelkins Initial creation * Mar 14, 2013 1794 djohnson FileUtil.listFiles now returns List. + * Nov 03, 2013 2511 mnash Fix issue where if name occurs in path + * file won't be returned correctly * * * @author jelkins @@ -231,7 +233,12 @@ public class EDEXLocalizationAdapter implements ILocalizationAdapter { entry.isDirectory = file.isDirectory(); entry.context = ctx; String fullPath = file.getAbsolutePath(); - entry.fileName = fullPath.substring(fullPath.indexOf(basePath)); + String path = getUtilityDir() + File.separator + ctx.toPath() + + File.separator; + entry.fileName = fullPath.replaceFirst(path, ""); + if (entry.fileName.startsWith(File.separator)) { + entry.fileName = entry.fileName.substring(1); + } entry.date = new Date(file.lastModified()); entry.protectedLevel = ProtectedFiles.getProtectedLevel(null,