In the following code I receive 2 errors:
Unhandled exception type ValidationException at line xxx
Unreachable catch block for ValidationException. This exception is never thrown from the try statement body at line yyy
public void validateExistingTemplate() {
try{
dummyObject.validate(); //line xxx
}
catch(ValidationException e){ // line yyy
//to do
}
}
try {
List emailOptionsList = someHelper.someMethod(SomeClass.class,
criterion, null, false);
if(emailOptionsList.size() > 0) {
operationContext.addErrorMessages(new Message("ERROR_MESSAGE"));
}
} catch (ServiceApplicationException ex) {
throw new ValidationException();
}
}
I am not sure how to get rid of this. what am i doing wrong here?