steveloughran commented on code in PR #5064:
URL: https://github.com/apache/hadoop/pull/5064#discussion_r1002684463
##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestKeyProvider.java:
##########
@@ -62,6 +62,12 @@ public void testParseVersionName() throws Exception {
} catch (IOException e) {
assertTrue(true);
}
+ try {
Review Comment:
LambdaTestUtils.intercept, which is
1. simpler
2. returns the value of getBaseName in the exception
3. rethrows the caught exception if class/name doesn't match
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/crypto/key/KeyProvider.java:
##########
@@ -639,13 +639,16 @@ public void invalidateCache(String name) throws
IOException {
public abstract void flush() throws IOException;
/**
- * Split the versionName in to a base name. Converts "/aaa/bbb/3" to
+ * Split the versionName in to a base name. Converts "/aaa/bbb@3" to
* "/aaa/bbb".
* @param versionName the version name to split
* @return the base name of the key
* @throws IOException raised on errors performing I/O.
*/
public static String getBaseName(String versionName) throws IOException {
+ if (versionName == null) {
+ throw new IOException("Null string found in key path");
Review Comment:
it's ok to raise NPEs on bad data, so we can just use Objects.nonNull() but
at least add a meaningful message
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]