diff --git a/metafix/src/main/java/org/metafacture/metafix/FixMethod.java b/metafix/src/main/java/org/metafacture/metafix/FixMethod.java index a8045a34..df0bbb9b 100644 --- a/metafix/src/main/java/org/metafacture/metafix/FixMethod.java +++ b/metafix/src/main/java/org/metafacture/metafix/FixMethod.java @@ -517,10 +517,10 @@ public void apply(final Metafix metafix, final Record record, final List map = metafix.getMap(mapName); } - final String defaultValue = map.get(Maps.DEFAULT_MAP_KEY); // TODO: Catmandu uses 'default' + final String defaultOption = options.get("default"); + final String defaultValue = options.getOrDefault(Maps.DEFAULT_MAP_KEY, defaultOption); final boolean delete = getBoolean(options, "delete"); final boolean printUnknown = getBoolean(options, "print_unknown"); - final String defaultOption = options.get("default"); final Consumer> consumer = c -> record.transform(params.get(0), oldValue -> { final String newValue = map.get(oldValue); @@ -531,11 +531,7 @@ public void apply(final Metafix metafix, final Record record, final List if (c != null) { c.accept(oldValue); } - elsif (defaultOption != null){ - return defaultOption; - } return defaultValue != null ? defaultValue : delete ? null : oldValue; - } });