I'm testing exception handling between a JVM COBOL class and a calling Java class.
An exception is raised in a JVM COBOL class, such as
raise new MyException("Blah blah")
When the exception is checked for in a try/catch block of a calling Java class, such as
RaiseException test = new RaiseException();
try {
test.instanceMethod();
}
catch (MyException e) {
System.out.println(e.getMessage());
}
the compiler reports "This exception is never thrown from the try statement body".
Exceptions raised in JVM COBOL do not seem to be recognised by calling Java programs. Not what I would expect. Am I missing something?