Fix/repo-4792 - Alfresco/transforms and alfresco/renditions can't read path-to-jar on Windows systems (#176)

Make path to .jar containing .json config for alfresco/transforms and alfresco/renditions OS agnostic.
This commit is contained in:
Kristian Dimitrov
2019-11-28 11:28:01 +00:00
committed by GitHub
parent 5e552afc4f
commit 9951d054d9
2 changed files with 4 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
@@ -81,7 +82,7 @@ public abstract class ConfigFileFinder
AtomicBoolean somethingRead = new AtomicBoolean(false);
// Try reading resources in a jar
final File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().getPath());
final File jarFile = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI());
if (jarFile.isFile())
{
readFromJar(jarFile, path, log, successReadingConfig, somethingRead);
@@ -108,7 +109,7 @@ public abstract class ConfigFileFinder
log.debug("No config read from "+path);
}
}
catch (IOException e)
catch (IOException | URISyntaxException e)
{
log.error("Error reading from "+path, e);
successReadingConfig.set(false);