Skip to content

Commit 30693db

Browse files
committed
Fall back to the local oxgarage.properties if there's none at /etc.
1 parent 90bb3bb commit 30693db

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/main/java/pl/psnc/dl/ege/configuration/EGEConstants.java

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,34 @@
1616

1717
public final class EGEConstants {
1818
public static final Properties oxgProps = new Properties();
19-
String whereami = EGEConstants.class.getProtectionDomain().getCodeSource().getLocation().getPath();
20-
String PATH = whereami.substring(0, whereami.lastIndexOf(File.separator));
19+
static String whereami = EGEConstants.class.getProtectionDomain().getCodeSource().getLocation().getPath();
20+
static String PATH = whereami.substring(0, whereami.lastIndexOf(File.separator));
2121
private final static Logger LOGGER = Logger.getLogger(EGEConfigurationManager.class.getName());
2222

2323
static {
24-
try {
25-
oxgProps.load(new FileInputStream("/etc/oxgarage.properties"));
26-
}
27-
catch (java.io.IOException e) {
28-
LOGGER.error("Could not read file /etc/oxgarage.properties");
29-
}
24+
try {
25+
System.out.println(PATH);
26+
oxgProps.load(new FileInputStream(PATH + File.separator + "oxgarage.properties"));
27+
} catch (java.io.IOException e) {
28+
try {
29+
oxgProps.load(new FileInputStream(PATH + File.separator + "oxgarage.properties"));
30+
} catch (java.io.IOException ex) {
31+
LOGGER.error("Could not read file /etc/oxgarage.properties or " + PATH
32+
+ File.separator + "oxgarage.properties" );
33+
}
34+
}
35+
3036
}
3137

3238

3339
/**
3440
* EGE temporary files directory
3541
*/
36-
public static final String OXGAPP = oxgProps.getProperty("OXGARAGE","/var/cache/oxgarage/");
37-
public static final String TEIROOT = oxgProps.getProperty("TEI","/usr/share/xml/tei/");
38-
public static final String OpenOfficeConfig = oxgProps.getProperty("OpenOfficeConfig","/usr/lib/libreoffice/");
39-
public static final String DEFAULT_LOCALE = oxgProps.getProperty("defaultLocale","en");
40-
public static final String DEFAULT_PROFILE = oxgProps.getProperty("defaultProfile","default");
42+
public static final String OXGAPP = oxgProps.getProperty("OXGARAGE","/var/cache/oxgarage/");
43+
public static final String TEIROOT = oxgProps.getProperty("TEI","/usr/share/xml/tei/");
44+
public static final String OpenOfficeConfig = oxgProps.getProperty("OpenOfficeConfig","/usr/lib/libreoffice/");
45+
public static final String DEFAULT_LOCALE = oxgProps.getProperty("defaultLocale","en");
46+
public static final String DEFAULT_PROFILE = oxgProps.getProperty("defaultProfile","default");
4147
// name for document family consisting of text documents
4248
public static final String TEXTFAMILY = "Documents";
4349
public static final String TEXTFAMILYCODE = "text";

0 commit comments

Comments
 (0)