[NO ISSUE][HYR] Expose getParams/getSourceLocation on IFormattedException,Warning

Change-Id: Id6c6807bfe727e8164ac69dd8e8a18fcf1840cce
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/12064
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Reviewed-by: Hussain Towaileb <hussainht@gmail.com>
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/IFormattedException.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/IFormattedException.java
index fd40e3f..cdd17bd 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/IFormattedException.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/IFormattedException.java
@@ -18,6 +18,7 @@
  */
 package org.apache.hyracks.api.exceptions;
 
+import java.io.Serializable;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.stream.Stream;
@@ -53,6 +54,16 @@
     Optional<IError> getError();
 
     /**
+     * @return the source location
+     */
+    SourceLocation getSourceLocation();
+
+    /**
+     * @return the parameters to use when formatting
+     */
+    Serializable[] getParams();
+
+    /**
      * Indicates whether this exception matches the supplied error code
      */
     default boolean matches(IError candidate) {
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/Warning.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/Warning.java
index d82f17d..b38c7ac 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/Warning.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/Warning.java
@@ -33,12 +33,14 @@
     private final SourceLocation srcLocation;
     private final int code;
     private final String message;
+    private final Serializable[] params;
 
-    private Warning(String component, SourceLocation srcLocation, int code, String message) {
+    private Warning(String component, SourceLocation srcLocation, int code, String message, Serializable... params) {
         this.component = component;
         this.srcLocation = srcLocation;
         this.code = code;
         this.message = message;
+        this.params = params;
     }
 
     /**
@@ -59,7 +61,7 @@
 
     public static Warning of(SourceLocation srcLocation, IError code, Serializable... params) {
         return new Warning(code.component(), srcLocation, code.intValue(), ErrorMessageUtil
-                .formatMessage(code.component(), code.intValue(), code.errorMessage(), srcLocation, params));
+                .formatMessage(code.component(), code.intValue(), code.errorMessage(), srcLocation, params), params);
     }
 
     public String getComponent() {
@@ -106,7 +108,8 @@
         String comp = input.readUTF();
         int code = input.readInt();
         String msg = input.readUTF();
-        return new Warning(comp, SourceLocation.create(input), code, msg);
+        SourceLocation sourceLocation = SourceLocation.create(input);
+        return new Warning(comp, sourceLocation, code, msg);
     }
 
     @Override
@@ -114,4 +117,8 @@
         return "Warning{" + "component='" + component + '\'' + ", srcLocation=" + srcLocation + ", code=" + code
                 + ", message='" + message + '\'' + '}';
     }
+
+    public Serializable[] getParams() {
+        return params;
+    }
 }