Skip to content

Commit

Permalink
Merge pull request #1188 from jbescos/issue1187
Browse files Browse the repository at this point in the history
 ClassLoader issue in embedded Arquillian (additional null check)
  • Loading branch information
scottmarlow authored Aug 1, 2023
2 parents 4ea3145 + b623624 commit 82a976e
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
@ApplicationScoped
public class KeysProducer {

private static final String PUB_KEY = "/key.pub";
private PublicKey publicKey;

/**
Expand All @@ -40,7 +41,8 @@ private void loadKeys() {
try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
byte[] pubKeyData;
try (InputStream keyIS = classLoader.getResourceAsStream("/key.pub")) {
try (InputStream keyIS = classLoader != null ?
classLoader.getResourceAsStream(PUB_KEY) : getClass().getResourceAsStream(PUB_KEY)) {
if (keyIS == null) {
throw new IllegalStateException("Failed to find /key.pub");
}
Expand Down

0 comments on commit 82a976e

Please sign in to comment.