From 821d62ac973353b69a4a8c7c945227a2d35b83bd Mon Sep 17 00:00:00 2001 From: Jesper Zedlitz <jesper@zedlitz.de> Date: Mon, 20 Jan 2025 11:51:00 +0100 Subject: [PATCH] remove unnecessary exceptions, fixed a warning message --- .../de/landsh/opendata/csw2dcat/MDMetadata2Dataset.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/landsh/opendata/csw2dcat/MDMetadata2Dataset.java b/src/main/java/de/landsh/opendata/csw2dcat/MDMetadata2Dataset.java index fe8fed7..de58981 100644 --- a/src/main/java/de/landsh/opendata/csw2dcat/MDMetadata2Dataset.java +++ b/src/main/java/de/landsh/opendata/csw2dcat/MDMetadata2Dataset.java @@ -14,7 +14,6 @@ import org.apache.jena.vocabulary.DCTerms; import org.apache.jena.vocabulary.RDF; import org.apache.jena.vocabulary.VCARD4; import org.dom4j.Document; -import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.Node; import org.json.JSONArray; @@ -24,7 +23,6 @@ import org.json.JSONTokener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLEncoder; @@ -630,7 +628,7 @@ public class MDMetadata2Dataset { /** * Convert a {@link Document} containin a gmd:MD_Metadata element into a DCAT-AP.de compliant dcat:Dataset {@link Resource}. */ - public Resource convert(Document input) throws DocumentException, IOException { + public Resource convert(Document input) { return convert(input.getRootElement()); } @@ -829,7 +827,7 @@ public class MDMetadata2Dataset { try { dataset.addProperty(DCATAP.hvdCategory, model.createResource(anchorRef.getStringValue())); } catch (IllegalArgumentException e) { - log.warn("Invalid HVD category {} for dataset {}", characterString.getStringValue(), id); + log.warn("Invalid HVD category {} for dataset {}", anchorRef.getStringValue(), id); } } } @@ -851,7 +849,7 @@ public class MDMetadata2Dataset { /** * Convert a gmd:MD_Metadata {@link Element} into a DCAT-AP.de compliant dcat:Dataset {@link Resource}. */ - public Resource convert(Element metadata) throws DocumentException, IOException { + public Resource convert(Element metadata) { if ("GetRecordByIdResponse".equals(metadata.getName())) { metadata = metadata.element("MD_Metadata"); @@ -892,7 +890,6 @@ public class MDMetadata2Dataset { convertDataResource(metadata, dataset); - final Element mdIdentifier = (Element) metadata.selectSingleNode("gmd:identificationInfo/*/gmd:citation/gmd:CI_Citation/gmd:identifier/gmd:MD_Identifier/gmd:code/gco:CharacterString"); final String searchId = mdIdentifier != null ? mdIdentifier.getTextTrim() : id; -- GitLab