if (key == null) {
Key keyAnnot = getAnnotation(Key.class);
if (keyAnnot != null) {
key = keyAnnot.value();
} else {
GenerateKeys keyGenAnnot = getAnnotation(GenerateKeys.class);
try {
KeyGenerator keyGen = MessageUtils.getKeyGenerator(keyGenAnnot);
key = keyGen.generateKey(this);
} catch (KeyGeneratorException e) {
keyGenException = e;
}
}
}
if (key == null) {
GenerateKeys keyGenAnnot = getAnnotation(GenerateKeys.class);
// If we were unable to get a key, things will fail later. Instead, fail
// here where the backtrace has useful information about the cause.
throw new RuntimeException("null key on "
+ getMessageInterface().getQualifiedName() + "." + getMethodName()
+ ", @GenerateKeys=" + keyGenAnnot + ", defmsg=" + defaultMessage