From 8fdbd6a9fe5e6fc3ab0ff5aaf17750834e9b41cd Mon Sep 17 00:00:00 2001 From: dev-mlb <19797865+dev-mlb@users.noreply.github.com> Date: Tue, 10 Sep 2024 17:36:05 -0400 Subject: [PATCH] use DataObjectFactory for ibdo creation --- .../java/emissary/core/IBaseDataObjectHelper.java | 2 +- .../emissary/core/IBaseDataObjectXmlCodecs.java | 14 +++++++------- .../emissary/core/IBaseDataObjectXmlHelper.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/emissary/core/IBaseDataObjectHelper.java b/src/main/java/emissary/core/IBaseDataObjectHelper.java index 6aa1486918..9831b28bea 100644 --- a/src/main/java/emissary/core/IBaseDataObjectHelper.java +++ b/src/main/java/emissary/core/IBaseDataObjectHelper.java @@ -50,7 +50,7 @@ private IBaseDataObjectHelper() {} public static IBaseDataObject clone(final IBaseDataObject iBaseDataObject, final boolean fullClone) { Validate.notNull(iBaseDataObject, "Required: iBaseDataObject not null"); - final BaseDataObject bdo = fullClone ? new InternalIdBaseDataObject(iBaseDataObject.getInternalId()) : new BaseDataObject(); + final IBaseDataObject bdo = fullClone ? new InternalIdBaseDataObject(iBaseDataObject.getInternalId()) : DataObjectFactory.getInstance(); final SeekableByteChannelFactory sbcf = iBaseDataObject.getChannelFactory(); if (sbcf != null) { diff --git a/src/main/java/emissary/core/IBaseDataObjectXmlCodecs.java b/src/main/java/emissary/core/IBaseDataObjectXmlCodecs.java index 7e4fa4f79d..daf6e69518 100644 --- a/src/main/java/emissary/core/IBaseDataObjectXmlCodecs.java +++ b/src/main/java/emissary/core/IBaseDataObjectXmlCodecs.java @@ -86,12 +86,12 @@ public final class IBaseDataObjectXmlCodecs { */ public static final Map PRIMITVE_NAME_DEFAULT_MAP = Collections .unmodifiableMap(new ConcurrentHashMap<>(Stream.of( - new AbstractMap.SimpleEntry<>(BIRTH_ORDER, new BaseDataObject().getBirthOrder()), - new AbstractMap.SimpleEntry<>(BROKEN, new BaseDataObject().isBroken()), - new AbstractMap.SimpleEntry<>(NUM_CHILDREN, new BaseDataObject().getNumChildren()), - new AbstractMap.SimpleEntry<>(NUM_SIBLINGS, new BaseDataObject().getNumSiblings()), - new AbstractMap.SimpleEntry<>(OUTPUTABLE, new BaseDataObject().isOutputable()), - new AbstractMap.SimpleEntry<>(PRIORITY, new BaseDataObject().getPriority())) + new AbstractMap.SimpleEntry<>(BIRTH_ORDER, DataObjectFactory.getInstance().getBirthOrder()), + new AbstractMap.SimpleEntry<>(BROKEN, DataObjectFactory.getInstance().isBroken()), + new AbstractMap.SimpleEntry<>(NUM_CHILDREN, DataObjectFactory.getInstance().getNumChildren()), + new AbstractMap.SimpleEntry<>(NUM_SIBLINGS, DataObjectFactory.getInstance().getNumSiblings()), + new AbstractMap.SimpleEntry<>(OUTPUTABLE, DataObjectFactory.getInstance().isOutputable()), + new AbstractMap.SimpleEntry<>(PRIORITY, DataObjectFactory.getInstance().getPriority())) .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue)))); /** * The XML namespace for "xml". @@ -824,6 +824,6 @@ public static Element protectedElementSha256(final String name, final byte[] byt */ public static Method getIbdoMethod(final String methodName, final Class... parameterTypes) throws NoSuchMethodException { - return IBaseDataObject.class.getDeclaredMethod(methodName, parameterTypes); + return IBaseDataObject.class.getMethod(methodName, parameterTypes); } } diff --git a/src/main/java/emissary/core/IBaseDataObjectXmlHelper.java b/src/main/java/emissary/core/IBaseDataObjectXmlHelper.java index 972c46fe6e..2ecf1be94a 100644 --- a/src/main/java/emissary/core/IBaseDataObjectXmlHelper.java +++ b/src/main/java/emissary/core/IBaseDataObjectXmlHelper.java @@ -64,7 +64,7 @@ private IBaseDataObjectXmlHelper() {} */ public static IBaseDataObject createStandardInitialIbdo(final IBaseDataObject ibdo, final SeekableByteChannelFactory sbcf, final String classification, final String formAndFileType, final KffDataObjectHandler kff) { - final IBaseDataObject tempIbdo = new BaseDataObject(); + final IBaseDataObject tempIbdo = DataObjectFactory.getInstance(); // We want to return the ibdo with the data field equal to null. This can only // be accomplished if the data is never set. Therefore, we have to set the data @@ -96,13 +96,13 @@ public static IBaseDataObject ibdoFromXml(final Document document, final List answerChildren = answersElement.getChildren(); ibdoFromXmlMainElements(answersElement, parentIbdo, decoders); for (final Element answerChild : answerChildren) { - final IBaseDataObject childIbdo = new BaseDataObject(); + final IBaseDataObject childIbdo = DataObjectFactory.getInstance(); final String childName = answerChild.getName(); if (childName.startsWith(EXTRACTED_RECORD_ELEMENT_PREFIX)) {