diff --git a/gradle.properties b/gradle.properties index 78971fc..02abcbe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group = org.xbib name = marc -version = 2.9.4 +version = 2.9.5 org.gradle.warning.mode = ALL diff --git a/src/main/java/org/xbib/marc/MarcRecord.java b/src/main/java/org/xbib/marc/MarcRecord.java index 4f4f930..a4873a1 100644 --- a/src/main/java/org/xbib/marc/MarcRecord.java +++ b/src/main/java/org/xbib/marc/MarcRecord.java @@ -447,9 +447,6 @@ public class MarcRecord implements Map { @SuppressWarnings("unchecked") private Map createMapFromMarcFields(boolean stable) { Map map = stable ? new TreeMap<>() : new LinkedHashMap<>(); - map.put(FORMAT_TAG, format); - map.put(TYPE_TAG, type); - map.put(LEADER_TAG, recordLabel.toString()); for (MarcField marcField : marcFields) { String tag = marcField.getTag(); int repeat; @@ -494,6 +491,15 @@ public class MarcRecord implements Map { repeatMap.put(Integer.toString(repeat), marcField.getValue()); } } + if (format != null) { + map.put(FORMAT_TAG, format); + } + if (type != null) { + map.put(TYPE_TAG, type); + } + if (recordLabel != null && !RecordLabel.EMPTY.equals(recordLabel)) { + map.put(LEADER_TAG, recordLabel.toString()); + } return map; } diff --git a/src/main/java/org/xbib/marc/json/MarcJsonWriter.java b/src/main/java/org/xbib/marc/json/MarcJsonWriter.java index 69850db..42b67ba 100644 --- a/src/main/java/org/xbib/marc/json/MarcJsonWriter.java +++ b/src/main/java/org/xbib/marc/json/MarcJsonWriter.java @@ -73,7 +73,7 @@ public class MarcJsonWriter extends MarcContentHandler implements Flushable, Clo private boolean fatalErrors; - private final EnumSet