Commit cfc77621 authored by Niels Erik G. Nielsen's avatar Niels Erik G. Nielsen
Browse files

Bugfix: detect location of original record

   .. in original content when record not contained in collection
parent 74473e08
......@@ -763,8 +763,9 @@ import com.indexdata.masterkey.localindices.util.MarcXMLToJson;
JSONObject marcJson = null;
if (record.getOriginalContent() != null) {
try {
logger.log(Level.TRACE,"Incoming original content: " + new String(record.getOriginalContent(), "UTF-8"));
marcJson = MarcXMLToJson.convertMarcXMLToJson(new String(record.getOriginalContent(), "UTF-8"));
logger.debug(marcJson.toJSONString());
logger.log(Level.TRACE, "Original content converted to JSON: " + marcJson.toJSONString());
} catch (IOException | ParserConfigurationException | SAXException e) {
updateCounters.sourceRecordsFailed++;
RecordError error = new ExceptionRecordError(e, "Error creating MARC JSON for source record", "MARC source");
......
......@@ -21,6 +21,7 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
*
* @author kurt
......@@ -42,7 +43,7 @@ public class MarcXMLToJson {
Element metadata = (Element)topRecord.getElementsByTagName("metadata").item(0);
record = (Element) metadata.getElementsByTagName("record").item(0);
} else if (root.getTagName().equals("record")) {
record = (Element) root.getElementsByTagName("record").item(0);
record = root;
} else if (root.getTagName().equals("collection")) {
NodeList records = root.getElementsByTagName("record");
if (records != null && records.getLength()==1) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment