I have this snipped code:
try{
JAXB.xmlJavaConverter(clientCommand);
} catch (Exception e){
nServerFifo.add(clientCommand);
}
I want to call remote Java method JAXB.xmlJavaConverter(clientCommand);. If this some reason fails I want to insert the data into Buffer nServerFifo.add(clientCommand);. How I can do this without stopping the code execution. I’m sure that I must replace Exception e with something else but I’m not sure what type of exeption I need without sopping the code execution.
If you catch
Exception, thecatchblock will be entered for any exception.Your existing code should work.
If you only want to enter the
catchblock for a specific type of Exception (which your question does not seem to imply), you would writeIf you did do that,
would be executed only if the code in the
tryblock throwsMoreSpecificException.