From 784dff46ae182a1f11fcf02f6a140e8402959819 Mon Sep 17 00:00:00 2001 From: James Cover jdcove2 Date: Thu, 5 Dec 2024 20:22:24 +0000 Subject: [PATCH] Changes from PR feedback. --- .../java/emissary/core/BaseDataObject.java | 18 +++++++++++------- .../java/emissary/core/IBaseDataObject.java | 5 +++++ .../emissary/core/IBaseDataObjectHelper.java | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/main/java/emissary/core/BaseDataObject.java b/src/main/java/emissary/core/BaseDataObject.java index ed59ccac2..72a8fc072 100755 --- a/src/main/java/emissary/core/BaseDataObject.java +++ b/src/main/java/emissary/core/BaseDataObject.java @@ -56,11 +56,13 @@ public class BaseDataObject implements Serializable, Cloneable, Remote, IBaseDat * Original name of the input data. Can only be set in the constructor of the DataObject. returned via the * {@link #getFilename()} method. Also used in constructing the {@link #shortName()} of the document. */ + @Nullable protected String theFileName; /** * Terminal portion of theFileName */ + @Nullable protected String shortName; /** @@ -77,6 +79,7 @@ public class BaseDataObject implements Serializable, Cloneable, Remote, IBaseDat /** * History of processing errors. Lines of text are accumulated from String and returned in-toto as a String. */ + @Nullable protected StringBuilder procError; /** @@ -727,16 +730,17 @@ public String printMeta() { return PayloadUtil.printFormattedMetadata(this); } + @Override + public void clearProcessingError() { + this.procError = null; + } + @Override public void addProcessingError(final String err) { - if (err == null) { - this.procError = null; - } else { - if (this.procError == null) { - this.procError = new StringBuilder(); - } - this.procError.append(err).append("\n"); + if (this.procError == null) { + this.procError = new StringBuilder(); } + this.procError.append(err).append("\n"); } @Override diff --git a/src/main/java/emissary/core/IBaseDataObject.java b/src/main/java/emissary/core/IBaseDataObject.java index a8e68cb53..1b2e346b2 100755 --- a/src/main/java/emissary/core/IBaseDataObject.java +++ b/src/main/java/emissary/core/IBaseDataObject.java @@ -686,6 +686,11 @@ enum MergePolicy { String toString(); + /** + * Clears the processing error + */ + void clearProcessingError(); + /** * Record a processing error * diff --git a/src/main/java/emissary/core/IBaseDataObjectHelper.java b/src/main/java/emissary/core/IBaseDataObjectHelper.java index 85f8e5c8d..256233297 100644 --- a/src/main/java/emissary/core/IBaseDataObjectHelper.java +++ b/src/main/java/emissary/core/IBaseDataObjectHelper.java @@ -153,7 +153,7 @@ public static void copy(final BaseDataObject fromBdo, final BaseDataObject toBdo toBdo.setFilename(filename); } - toBdo.addProcessingError(null); + toBdo.clearProcessingError(); final String processingError = fromBdo.getProcessingError(); if (processingError != null) { toBdo.addProcessingError(processingError.substring(0, processingError.length() - 1));