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

@@ -43,4 +43,4 @@ jobs:
# Add email to link commits to user # Add email to link commits to user
- git config user.email "${GIT_EMAIL}" - git config user.email "${GIT_EMAIL}"
# Skip building of release commits # Skip building of release commits
- mvn --batch-mode -q -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform - mvn --batch-mode -q -DscmCommentPrefix="[maven-release-plugin][skip ci] " -Dusername="${GIT_USERNAME}" -Dpassword="${GIT_PASSWORD}" -DskipTests -Darguments=-DskipTests release:clean release:prepare release:perform

View File

@@ -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);