dimas-b commented on code in PR #2176:
URL: https://github.com/apache/polaris/pull/2176#discussion_r2228630805


##########
polaris-core/src/main/java/org/apache/polaris/core/connection/ConnectionConfigInfoDpo.java:
##########
@@ -115,15 +113,12 @@ public String serialize() {
     }
   }
 
-  public static @Nullable ConnectionConfigInfoDpo deserialize(
-      @Nonnull PolarisDiagnostics diagnostics, final @Nonnull String jsonStr) {
+  public static ConnectionConfigInfoDpo deserialize(final @Nonnull String 
jsonStr) {
     try {
       return DEFAULT_MAPPER.readValue(jsonStr, ConnectionConfigInfoDpo.class);
-    } catch (JsonProcessingException exception) {
-      diagnostics.fail(
-          "fail_to_deserialize_connection_configuration", exception, 
"jsonStr={}", jsonStr);
+    } catch (JsonProcessingException ex) {
+      throw new RuntimeException("deserialize failed", ex);

Review Comment:
   nit: Add `ex`'s message to the re-thrown exception message for each of 
trouble-shooting?



##########
polaris-core/src/main/java/org/apache/polaris/core/persistence/PolarisObjectMapperUtil.java:
##########
@@ -50,42 +48,39 @@ private static ObjectMapper configureMapper() {
     return mapper;
   }
 
+  private PolarisObjectMapperUtil() {
+    // utility class
+  }
+
   /**
    * Given the internal property as a map of key/value pairs, serialize it to 
a String
    *
    * @param properties a map of key/value pairs
    * @return a String, the JSON representation of the map
    */
-  public static String serializeProperties(
-      PolarisCallContext callCtx, Map<String, String> properties) {
-
-    String jsonString = null;
+  public static String serializeProperties(Map<String, String> properties) {
     try {
       // Deserialize the JSON string to a Map<String, String>
-      jsonString = MAPPER.writeValueAsString(properties);
+      return MAPPER.writeValueAsString(properties);
     } catch (JsonProcessingException ex) {
-      callCtx.getDiagServices().fail("got_json_processing_exception", 
ex.getMessage());
+      throw new RuntimeException("serializeProperties failed", ex);
     }
-
-    return jsonString;
   }
 
-  public static String serialize(PolarisCallContext callCtx, Object object) {
+  public static String serialize(Object object) {
     try {
       return MAPPER.writeValueAsString(object);
     } catch (JsonProcessingException e) {
-      callCtx.getDiagServices().fail("got_json_processing_exception", 
e.getMessage());
+      throw new RuntimeException("serialize failed", e);
     }
-    return "";
   }
 
-  public static <T> T deserialize(PolarisCallContext callCtx, String text, 
Class<T> klass) {
+  public static <T> T deserialize(String text, Class<T> klass) {
     try {
       return MAPPER.readValue(text, klass);
     } catch (JsonProcessingException e) {
-      callCtx.getDiagServices().fail("got_json_processing_exception", 
e.getMessage());
+      throw new RuntimeException("deserialize failed", e);

Review Comment:
   nit: add `ex`'s message to the re-thrown exception's message (everywhere)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to