[
https://issues.apache.org/jira/browse/HADOOP-19079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17834263#comment-17834263
]
ASF GitHub Bot commented on HADOOP-19079:
-----------------------------------------
steveloughran commented on code in PR #6557:
URL: https://github.com/apache/hadoop/pull/6557#discussion_r1553455963
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java:
##########
@@ -509,61 +508,6 @@ public static <T, E extends Throwable> E intercept(
return ex;
}
- /**
- * Intercept an exception; throw an {@code AssertionError} if one not raised.
- * The caught exception is rethrown if it is of the wrong class or
- * does not contain the text defined in {@code contained}.
- * <p>
- * Example: expect deleting a nonexistent file to raise a
- * {@code FileNotFoundException} with the {@code toString()} value
- * containing the text {@code "missing"}.
- * <pre>
- * FileNotFoundException ioe = intercept(FileNotFoundException.class,
- * "missing",
- * "path should not be found",
- * () -> {
- * filesystem.delete(new Path("/missing"), false);
- * });
- * </pre>
- *
- * @param clazz class of exception; the raised exception must be this class
- * <i>or a subclass</i>.
- * @param contains strings which must be in the {@code toString()} value
- * of the exception (order does not matter)
- * @param message any message tho include in exception/log messages
- * @param eval expression to eval
- * @param <T> return type of expression
- * @param <E> exception class
- * @return the caught exception if it was of the expected type and contents
- * @throws Exception any other exception raised
- * @throws AssertionError if the evaluation call didn't raise an exception.
- * The error includes the {@code toString()} value of the result, if this
- * can be determined.
- * @see GenericTestUtils#assertExceptionContains(String, Throwable)
- */
- public static <T, E extends Throwable> E intercept(
Review Comment:
I do think this is a good feature, it's just we need to give it a name which
doesn't run any risk of causing compilation problems.
alternatively, in `GenericTestUtils` add a new method
`assertExceptionContainsAllStrings()` taking a varargs list of strings.
> check that class that is loaded is really an exception
> ------------------------------------------------------
>
> Key: HADOOP-19079
> URL: https://issues.apache.org/jira/browse/HADOOP-19079
> Project: Hadoop Common
> Issue Type: Task
> Components: common, security
> Reporter: PJ Fanning
> Priority: Major
> Labels: pull-request-available
>
> It can be dangerous taking class names as inputs from HTTP messages even if
> we control the source. Issue is in HttpExceptionUtils in hadoop-common
> (validateResponse method).
> I can provide a PR that will highlight the issue.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]