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

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

ajfabbri commented on code in PR #8594:
URL: https://github.com/apache/hadoop/pull/8594#discussion_r3634084602


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/file/tfile/TestTFileComparators.java:
##########
@@ -73,45 +73,28 @@ public void tearDown() throws IOException {
 
   // bad comparator format
   @Test
-  public void testFailureBadComparatorNames() throws IOException {
-    try {
-      writer = new Writer(out, BLOCK_SIZE, compression, "badcmp", conf);
-      fail("Failed to catch unsupported comparator names");
-    }
-    catch (Exception e) {
-      // noop, expecting exceptions
-      e.printStackTrace();
-    }
+  public void testFailureBadComparatorNames() throws Exception {
+    intercept(IllegalArgumentException.class, "Unsupported comparator", () ->
+        new Writer(out, BLOCK_SIZE, compression, "badcmp", conf));
   }

Review Comment:
   `out` *is* closed in `tearDown()`, resolving





> TFile parsing is too brittle
> ----------------------------
>
>                 Key: HADOOP-19936
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19936
>             Project: Hadoop Common
>          Issue Type: Improvement
>          Components: io
>    Affects Versions: 3.5.0, 3.4.3
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>            Priority: Minor
>              Labels: pull-request-available
>
> TFile parser doesn't validate its inputs before allocating memory or 
> attempting to instantiate a class. This is old code, but still used in places.



--
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