mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
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:
committed by
GitHub
parent
5e552afc4f
commit
9951d054d9
@@ -37,6 +37,7 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -81,7 +82,7 @@ public abstract class ConfigFileFinder
|
|||||||
AtomicBoolean somethingRead = new AtomicBoolean(false);
|
AtomicBoolean somethingRead = new AtomicBoolean(false);
|
||||||
|
|
||||||
// Try reading resources in a jar
|
// 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())
|
if (jarFile.isFile())
|
||||||
{
|
{
|
||||||
readFromJar(jarFile, path, log, successReadingConfig, somethingRead);
|
readFromJar(jarFile, path, log, successReadingConfig, somethingRead);
|
||||||
@@ -108,7 +109,7 @@ public abstract class ConfigFileFinder
|
|||||||
log.debug("No config read from "+path);
|
log.debug("No config read from "+path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException | URISyntaxException e)
|
||||||
{
|
{
|
||||||
log.error("Error reading from "+path, e);
|
log.error("Error reading from "+path, e);
|
||||||
successReadingConfig.set(false);
|
successReadingConfig.set(false);
|
||||||
|
Reference in New Issue
Block a user