EarProperties.java
2.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.pdfg.logging.PDFGLogger
*/
package com.adobe.pdfg.common;
import com.adobe.pdfg.logging.PDFGLogger;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Properties;
public abstract class EarProperties {
protected boolean tryCreationAgain = false;
private static final PDFGLogger logger = PDFGLogger.getPDFGLogger(EarProperties.class);
protected Properties properties = null;
protected EarProperties() {
}
protected synchronized void init(String propertyFile, ClassLoader loader) {
this.tryCreationAgain = false;
Properties props = new Properties(System.getProperties());
if (!this.addProperties("LFS_PDFGenerator.properties", loader, props)) {
this.addProperties("LFS_PDFGenerator3D.properties", loader, props);
}
if (propertyFile != null) {
this.addProperties(propertyFile, loader, props);
}
this.properties = props;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
private boolean addProperties(String propertyFile, ClassLoader loader, Properties props) {
boolean bSuccess;
block13 : {
bSuccess = true;
InputStream in = null;
try {
in = loader.getResourceAsStream(propertyFile);
if (in != null) {
Properties moreProperties = new Properties();
moreProperties.load(in);
props.putAll(moreProperties);
break block13;
}
logger.debug("Properties file '" + propertyFile + "' not found");
bSuccess = false;
}
catch (IOException e) {
logger.debug(e.getMessage(), null, (Throwable)e);
props.clear();
bSuccess = false;
}
finally {
if (in != null) {
try {
in.close();
}
catch (IOException e1) {
logger.debug(e1.getMessage(), null, (Throwable)e1);
}
}
}
}
return bSuccess;
}
protected int virtualGetIntProperty(String key, int defaultValue) {
int result = defaultValue;
String propertyString = this.properties.getProperty(key);
if (propertyString != null && propertyString.length() > 0) {
try {
int propertyInt;
result = propertyInt = Integer.parseInt(propertyString);
}
catch (NumberFormatException e) {
logger.debug("Non integer value '" + propertyString + "' for '" + key + "' , using default " + result, null, (Throwable)e);
}
}
return result;
}
}