Adding few NPE guards
@@ -245,7 +245,7 @@ public final class JwkUtils {
public static JsonWebKeys loadJwkSet(Message m, Properties props, PrivateKeyPasswordProvider cb) {
String key = (String)props.get(JoseConstants.RSSEC_KEY_STORE_FILE);
JsonWebKeys jwkSet = null;
- if (key != null) {
+ if (key != null && m != null) {
Object jwkSetProp = m.getExchange().get(key);
if (jwkSetProp != null && !(jwkSetProp instanceof JsonWebKeys)) {
throw new JwkException("Unexpected key store class: " + jwkSetProp.getClass().getName());
@@ -254,8 +254,8 @@ public final class JwkUtils {
}
}
if (jwkSet == null) {
- jwkSet = loadJwkSet(props, m.getExchange().getBus(), cb);
- if (key != null) {
+ jwkSet = loadJwkSet(props, m != null ? m.getExchange().getBus() : null, cb);
+ if (key != null && m != null) {
m.getExchange().put(key, jwkSet);
}
}
