Skip to content

Commit

Permalink
Update metafacture-xml/src/main/java/org/metafacture/xml/SimpleXmlEnc…
Browse files Browse the repository at this point in the history
…oder.java

Co-authored-by: Jens Wille <jens.wille@hbz-nrw.de>
  • Loading branch information
dr0i and blackwinter committed Mar 19, 2024
1 parent 9626868 commit 874505f
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,12 @@ public void setNamespaces(final Map<String, String> namespaces) {
*/
public void setNamespaces(final String namespacesString) {
final Properties properties = new Properties();
final StringReader sr = new StringReader(namespacesString);
try {
try (StringReader sr = new StringReader(namespacesString)) {
properties.load(sr);
}
catch (final IOException e) {
throw new MetafactureException("Failed to create namespace list");
}
finally {
if (sr != null) {
sr.close();
}
}
propertiesToMap(properties);
}

Expand Down Expand Up @@ -379,9 +373,7 @@ private boolean isDefaultNamespace(final String ns) {
}

private void propertiesToMap(final Properties properties) {
for (final Entry<Object, Object> entry : properties.entrySet()) {
namespaces.put(entry.getKey().toString(), entry.getValue().toString());
}
properties.forEach((k, v) -> namespaces.put(k.toString(), v.toString()));
}

/**
Expand Down

0 comments on commit 874505f

Please sign in to comment.