Skip to content

Commit

Permalink
prevent NPE
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Jun 8, 2023
1 parent 35f376c commit 2258b8e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
Expand Down Expand Up @@ -145,6 +145,10 @@ protected Class<?> findClass(final String name)
}
String path = "/".concat(name.replace('.', '/').concat(".class"));
try (InputStream in = MethodUtil.class.getResourceAsStream(path)) {
if (in == null) {
throw new ClassNotFoundException(path);
}

byte[] b = readAllBytes(in);
return defineClass(name, b);
} catch (IOException e) {
Expand Down

0 comments on commit 2258b8e

Please sign in to comment.