Skip to content

Commit 874505f

Browse files
dr0iblackwinter
andcommitted
Update metafacture-xml/src/main/java/org/metafacture/xml/SimpleXmlEncoder.java
Co-authored-by: Jens Wille <[email protected]>
1 parent 9626868 commit 874505f

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

metafacture-xml/src/main/java/org/metafacture/xml/SimpleXmlEncoder.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,12 @@ public void setNamespaces(final Map<String, String> namespaces) {
226226
*/
227227
public void setNamespaces(final String namespacesString) {
228228
final Properties properties = new Properties();
229-
final StringReader sr = new StringReader(namespacesString);
230-
try {
229+
try (StringReader sr = new StringReader(namespacesString)) {
231230
properties.load(sr);
232231
}
233232
catch (final IOException e) {
234233
throw new MetafactureException("Failed to create namespace list");
235234
}
236-
finally {
237-
if (sr != null) {
238-
sr.close();
239-
}
240-
}
241235
propertiesToMap(properties);
242236
}
243237

@@ -379,9 +373,7 @@ private boolean isDefaultNamespace(final String ns) {
379373
}
380374

381375
private void propertiesToMap(final Properties properties) {
382-
for (final Entry<Object, Object> entry : properties.entrySet()) {
383-
namespaces.put(entry.getKey().toString(), entry.getValue().toString());
384-
}
376+
properties.forEach((k, v) -> namespaces.put(k.toString(), v.toString()));
385377
}
386378

387379
/**

0 commit comments

Comments
 (0)