From 1ba857f81f73180756b6120c7458adff24fe439a Mon Sep 17 00:00:00 2001 From: parvathy00 Date: Fri, 29 Mar 2024 12:05:48 +0530 Subject: [PATCH] Parvathy | BAH-3720 | Fix. applicationDataDirectory File Path --- .../bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java | 6 +++++- .../api/worker/OpenElisAccessionEventWorker.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java index 5ddc3fbdaf..c29fefce6e 100644 --- a/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java +++ b/bahmnicore-api/src/main/java/org/bahmni/module/bahmnicore/dao/impl/ApplicationDataDirectoryImpl.java @@ -9,7 +9,11 @@ public class ApplicationDataDirectoryImpl implements ApplicationDataDirectory { @Override public File getFile(String relativePath) { - return new File(OpenmrsUtil.getApplicationDataDirectory() + relativePath); + String applicationDataDirectory = OpenmrsUtil.getApplicationDataDirectory(); + if (!applicationDataDirectory.endsWith(File.separator)) { + applicationDataDirectory += File.separator; + } + return new File(applicationDataDirectory + relativePath); } @Override diff --git a/openmrs-elis-atomfeed-client-omod/src/main/java/org/bahmni/module/elisatomfeedclient/api/worker/OpenElisAccessionEventWorker.java b/openmrs-elis-atomfeed-client-omod/src/main/java/org/bahmni/module/elisatomfeedclient/api/worker/OpenElisAccessionEventWorker.java index 8b375970e3..0f35f094df 100644 --- a/openmrs-elis-atomfeed-client-omod/src/main/java/org/bahmni/module/elisatomfeedclient/api/worker/OpenElisAccessionEventWorker.java +++ b/openmrs-elis-atomfeed-client-omod/src/main/java/org/bahmni/module/elisatomfeedclient/api/worker/OpenElisAccessionEventWorker.java @@ -143,7 +143,11 @@ public void process(Event event) { void runInterceptor(Class className, Object object) { GroovyClassLoader gcl = new GroovyClassLoader(); - File directory = new File(OpenmrsUtil.getApplicationDataDirectory() + "elisFeedInterceptor"); + String applicationDataDirectory = OpenmrsUtil.getApplicationDataDirectory(); + if (!applicationDataDirectory.endsWith(File.separator)) { + applicationDataDirectory += File.separator; + } + File directory = new File(applicationDataDirectory + "elisFeedInterceptor"); File[] files = directory.listFiles(); if (files != null) { for (File file : files) {