Skip to content

Commit

Permalink
Changes from PR feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Cover jdcove2 committed Dec 5, 2024
1 parent 95149a6 commit 784dff4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
18 changes: 11 additions & 7 deletions src/main/java/emissary/core/BaseDataObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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;

/**
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/emissary/core/IBaseDataObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,11 @@ enum MergePolicy {
String toString();


/**
* Clears the processing error
*/
void clearProcessingError();

/**
* Record a processing error
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/core/IBaseDataObjectHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 784dff4

Please sign in to comment.