I have this code snippet for handling special exceptions
private static final String CONNECTION_REFUSED_EXCEPTION = "java.net.ConnectException: Connection refused: connect";
...
} catch (org.apache.axis.AxisFault af) {
if (af.getFaultString().equals(CONNECTION_REFUSED_EXCEPTION))
{
}
}
This works fine in a Windows development environment
However, when I deploy to a unix machine for testing, the failure line is different as shown below (note: there is no connection at the end)
- Windows Failure String: java.net.ConnectException: Connection refused: connect
- Unix Failure Line: java.net.ConnectException: Connection refused
Why is this so?
For the record, I believe the following would be better suited for matching the failure string:
...
if(af.getCause() instanceof java.net.ConnectException)
...
Jimmy source
share