/**
* @param message the reason for the failure.
*/
public EncodeException(String message) {
super(-1, checkNotNull(message, "message"));
}
/**
* @param message possibly null reason for the failure.
* @param cause the cause of the error.
*/
public EncodeException(String message, Throwable cause) {
super(-1, message, checkNotNull(cause, "cause"));
}
It seems like that EncodeException's message is not null in 1st constructor, BUT, when a exception with null message is throw (eg. new NegativeArraySizeException() ), you will get a null message EncodeException, such as below codes in RequestTemplateFactoryResolver.
protected RequestTemplate resolve(Object[] argv, RequestTemplate mutable,
Map<String, Object> variables) {
Object body = argv[metadata.bodyIndex()];
checkArgument(body != null, "Body parameter %s was null", metadata.bodyIndex());
try {
encoder.encode(body, metadata.bodyType(), mutable);
} catch (EncodeException e) {
throw e;
} catch (RuntimeException e) {
throw new EncodeException(e.getMessage(), e);
}
return super.resolve(argv, mutable, variables);
}