We have AWT based application fetching values from DB. Doing upgrade Java6 to 8. At one place in application, we are trying handle exceptions as below -
This part works well for Java6. However for Java8 the if condition is failing even though SQLState ="23000" and VendorCode=2292. I debug in eclipse and got the values at runtime.
One more thing I would like to add; In Java8 I am getting SQLIntegrityConstaintViolationException. However I hope that is not related or causing issue.
catch (SQLException ex)
{
if ((ex.getSQLState() == "23000") && (ex.getErrorCode() == 2292))
throw new PersistentValidationException("DBCustomer: Delete restricted",ex);
else
throw new PersistentUIException(" DBCustomer:delete --- " +
"SQL error occurred.",ex);
}
Any suggestions