Skip to content

Commit cc252ed

Browse files
committed
reformatted file according to checkstyle rules
1 parent 05b20f7 commit cc252ed

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

src/main/java/org/javamoney/moneta/spi/MonetaryConfig.java

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -28,70 +28,70 @@
2828

2929
/**
3030
* Loader for the Java Money JSR configuration.
31-
*
31+
*
3232
* @author Anatole Tresch
3333
*/
34-
public final class MonetaryConfig{
34+
public final class MonetaryConfig {
35+
36+
private static final Logger LOG = Logger
37+
.getLogger(MonetaryConfig.class.getName());
3538

36-
private static final Logger LOG = Logger
37-
.getLogger(MonetaryConfig.class.getName());
39+
private static final MonetaryConfig INSTANCE = new MonetaryConfig();
3840

39-
private static final MonetaryConfig INSTANCE = new MonetaryConfig();
40-
41-
private Map<String, String> config = new HashMap<>();
42-
private Map<String, Integer> priorities = new HashMap<>();
41+
private Map<String, String> config = new HashMap<>();
42+
private Map<String, Integer> priorities = new HashMap<>();
4343

44-
private MonetaryConfig() {
45-
try {
46-
Enumeration<URL> urls = getClass().getClassLoader().getResources(
47-
"javamoney.properties");
48-
while (urls.hasMoreElements()) {
49-
URL url = urls.nextElement();
50-
try {
51-
Properties props = new Properties();
52-
props.load(url.openStream());
53-
updateConfig(props);
54-
} catch (Exception e) {
55-
LOG.log(Level.SEVERE,
56-
"Error loading javamoney.properties, ignoring "
57-
+ url, e);
58-
}
59-
}
60-
} catch (IOException e) {
61-
LOG.log(Level.SEVERE, "Error loading javamoney.properties.", e);
62-
}
63-
}
44+
private MonetaryConfig() {
45+
try {
46+
Enumeration<URL> urls = getClass().getClassLoader().getResources(
47+
"javamoney.properties");
48+
while (urls.hasMoreElements()) {
49+
URL url = urls.nextElement();
50+
try {
51+
Properties props = new Properties();
52+
props.load(url.openStream());
53+
updateConfig(props);
54+
} catch (Exception e) {
55+
LOG.log(Level.SEVERE,
56+
"Error loading javamoney.properties, ignoring "
57+
+ url, e);
58+
}
59+
}
60+
} catch (IOException e) {
61+
LOG.log(Level.SEVERE, "Error loading javamoney.properties.", e);
62+
}
63+
}
6464

65-
private void updateConfig(Properties props) {
66-
for (Map.Entry<Object, Object> en : props.entrySet()) {
67-
String key = en.getKey().toString();
68-
String value = en.getValue().toString();
69-
Integer existingPrio = priorities.get(key);
70-
int prio = 0;
71-
if (value.startsWith("{prio=")) {
72-
int index = value.indexOf('}');
73-
if (index > 0) {
74-
String prioString = value.substring("{prio=".length(),
75-
index);
76-
value = value.substring(index + 1);
77-
prio = Integer.parseInt(prioString);
78-
priorities.put(key, prio);
79-
}
80-
}
81-
if (Objects.isNull(existingPrio)) {
82-
config.put(key, value);
83-
} else if (existingPrio < prio) {
84-
config.put(key, value);
85-
} else if (existingPrio == prio) {
86-
throw new IllegalStateException(
87-
"AmbiguousConfiguration detected for '" + key + "'.");
88-
}
89-
// else ignore entry with lower prio!
90-
}
91-
}
65+
private void updateConfig(Properties props) {
66+
for (Map.Entry<Object, Object> en : props.entrySet()) {
67+
String key = en.getKey().toString();
68+
String value = en.getValue().toString();
69+
Integer existingPrio = priorities.get(key);
70+
int prio = 0;
71+
if (value.startsWith("{prio=")) {
72+
int index = value.indexOf('}');
73+
if (index > 0) {
74+
String prioString = value.substring("{prio=".length(),
75+
index);
76+
value = value.substring(index + 1);
77+
prio = Integer.parseInt(prioString);
78+
priorities.put(key, prio);
79+
}
80+
}
81+
if (Objects.isNull(existingPrio)) {
82+
config.put(key, value);
83+
} else if (existingPrio < prio) {
84+
config.put(key, value);
85+
} else if (existingPrio == prio) {
86+
throw new IllegalStateException(
87+
"AmbiguousConfiguration detected for '" + key + "'.");
88+
}
89+
// else ignore entry with lower prio!
90+
}
91+
}
9292

93-
public static Map<String, String> getConfig() {
94-
return Collections.unmodifiableMap(INSTANCE.config);
95-
}
93+
public static Map<String, String> getConfig() {
94+
return Collections.unmodifiableMap(INSTANCE.config);
95+
}
9696

9797
}

0 commit comments

Comments
 (0)