Murtadha Hubail has submitted this change and it was merged. Change subject: [NO ISSUE][FAIL] Fix Message Propagation in HyracksException ......................................................................
[NO ISSUE][FAIL] Fix Message Propagation in HyracksException - user model changes: no - storage format changes: no - interface changes: no Details: - Properly propogate the message from the cause in HyracksException. Change-Id: If167755a000e60ca082bd1cc4692c747a502f6ae Reviewed-on: https://asterix-gerrit.ics.uci.edu/2720 Reviewed-by: Murtadha Hubail <[email protected]> Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: Michael Blow <[email protected]> --- M hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java M hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ErrorMessageUtil.java 2 files changed, 11 insertions(+), 3 deletions(-) Approvals: Anon. E. Moose #1000171: Jenkins: Verified; No violations found; ; Verified Michael Blow: Looks good to me, approved Murtadha Hubail: Looks good to me, but someone else must approve diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java index 428e643..99747fa 100644 --- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java +++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/HyracksException.java @@ -83,7 +83,7 @@ */ @Deprecated protected HyracksException(Throwable cause) { - this(ErrorMessageUtil.NONE, UNKNOWN, String.valueOf(cause), cause, (Serializable[]) null); + this(ErrorMessageUtil.NONE, UNKNOWN, ErrorMessageUtil.getCauseMessage(cause), cause, (Serializable[]) null); } /** @@ -99,7 +99,7 @@ } public HyracksException(Throwable cause, int errorCode, Serializable... params) { - this(ErrorMessageUtil.NONE, errorCode, String.valueOf(cause), cause, null, params); + this(ErrorMessageUtil.NONE, errorCode, ErrorMessageUtil.getCauseMessage(cause), cause, null, params); } public HyracksException(String component, int errorCode, String message, Serializable... params) { @@ -107,7 +107,7 @@ } public HyracksException(String component, int errorCode, Throwable cause, Serializable... params) { - this(component, errorCode, String.valueOf(cause), cause, null, params); + this(component, errorCode, ErrorMessageUtil.getCauseMessage(cause), cause, null, params); } public HyracksException(String component, int errorCode, String message, Throwable cause, Serializable... params) { diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ErrorMessageUtil.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ErrorMessageUtil.java index 56dfe3f..8758ef7 100644 --- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ErrorMessageUtil.java +++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ErrorMessageUtil.java @@ -27,6 +27,7 @@ import java.util.Map; import java.util.Properties; +import org.apache.hyracks.api.exceptions.IFormattedException; import org.apache.hyracks.api.exceptions.SourceLocation; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; @@ -113,4 +114,11 @@ return e.getMessage(); } } + + public static String getCauseMessage(Throwable t) { + if (t instanceof IFormattedException) { + return t.getMessage(); + } + return String.valueOf(t); + } } -- To view, visit https://asterix-gerrit.ics.uci.edu/2720 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: If167755a000e60ca082bd1cc4692c747a502f6ae Gerrit-PatchSet: 6 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: Murtadha Hubail <[email protected]> Gerrit-Reviewer: Till Westmann <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
