This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 02a14247c0b79dddd1085fd769f1032d6eca3d5a
Author: Michael Blow <[email protected]>
AuthorDate: Fri Jun 25 15:06:14 2021 -0400

    [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 <[email protected]>
    Integration-Tests: Jenkins <[email protected]>
    Reviewed-by: Michael Blow <[email protected]>
    Reviewed-by: Hussain Towaileb <[email protected]>
---
 .../apache/hyracks/api/exceptions/IFormattedException.java  | 11 +++++++++++
 .../java/org/apache/hyracks/api/exceptions/Warning.java     | 13 ++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

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 @@ public interface IFormattedException {
     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 @@ public class Warning implements Serializable {
     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 class Warning implements Serializable {
 
     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 @@ public class Warning implements Serializable {
         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 @@ public class Warning implements Serializable {
         return "Warning{" + "component='" + component + '\'' + ", 
srcLocation=" + srcLocation + ", code=" + code
                 + ", message='" + message + '\'' + '}';
     }
+
+    public Serializable[] getParams() {
+        return params;
+    }
 }

Reply via email to