[ 
https://issues.apache.org/jira/browse/HADOOP-19259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17931193#comment-17931193
 ] 

ASF GitHub Bot commented on HADOOP-19259:
-----------------------------------------

steveloughran commented on code in PR #7428:
URL: https://github.com/apache/hadoop/pull/7428#discussion_r1973737619


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java:
##########
@@ -801,6 +802,48 @@ public void testBindToLocalAddress() throws Exception {
         .bindToLocalAddress(NetUtils.getLocalInetAddress("127.0.0.1"), true));
   }
 
+  public static class WrappedIOException extends IOException {
+    public WrappedIOException(String msg, Throwable cause) {
+      super(msg, cause);
+    }
+  }
+
+  private static class PrivateIOException extends IOException {
+    PrivateIOException(String msg, Throwable cause) {
+      super(msg, cause);
+    }
+  }
+
+  @Test
+  public void testAddNodeNameToIOException() {
+    IOException e0 = new IOException("test123");
+    assertNull(e0.getCause());

Review Comment:
   can we have assertj here..as we do that move to junit5, best to start off 
with the cross-version test asserts.
   
   actually, given there's so many assertNull(throwable.getCause(), what about 
a new method `assertNullCause(Throwable)` and use through this



##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/net/TestNetUtils.java:
##########
@@ -801,6 +802,48 @@ public void testBindToLocalAddress() throws Exception {
         .bindToLocalAddress(NetUtils.getLocalInetAddress("127.0.0.1"), true));
   }
 
+  public static class WrappedIOException extends IOException {
+    public WrappedIOException(String msg, Throwable cause) {
+      super(msg, cause);
+    }
+  }
+
+  private static class PrivateIOException extends IOException {
+    PrivateIOException(String msg, Throwable cause) {
+      super(msg, cause);
+    }
+  }
+
+  @Test
+  public void testAddNodeNameToIOException() {
+    IOException e0 = new IOException("test123");
+    assertNull(e0.getCause());
+    IOException new0 = NetUtils.addNodeNameToIOException(e0, "node123");
+    assertNull(new0.getCause());
+    assertEquals("node123: test123", new0.getMessage());
+
+    IOException e1 = new IOException("test456", new 
IllegalStateException("deliberate"));
+    IOException new1 = NetUtils.addNodeNameToIOException(e1, "node456");
+    assertEquals(e1.getCause(), new1.getCause());

Review Comment:
   assertEquals or assertSame?





> upgrade to jackson 2.14.3
> -------------------------
>
>                 Key: HADOOP-19259
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19259
>             Project: Hadoop Common
>          Issue Type: Task
>          Components: common
>            Reporter: PJ Fanning
>            Priority: Major
>              Labels: pull-request-available
>
> see HADOOP-19230 and HADOOP-18332
> Jackson 2.18 is causing some trouble but Jackson 2.14 has some useful 
> changes. I can follow up later and try to use a newer version of Jackson but 
> this is a start.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to