recordAlreadyExists is silently eaten with no warning to logs

Description

This code in BasicSqlService.java effectively means that SqlServiceUniqueViolationException will never be thrown (as the if (recordAlreadyExists) block is unreachable).

As nothing seems to actually catch SqlServiceUniqueViolationException, that block should just be removed.

1223 // if asked to fail quietly, just return false if we find this error.
1224 if (recordAlreadyExists || failQuiet) return false;
1225
1226 // perhaps due to a mysql deadlock?
1227 if (sqlServiceSql.isDeadLockError(e.getErrorCode()))
1228 {
1229 // just a little fuss
1230 LOG.warn("Sql.dbWrite(): deadlock: error code: " + e.getErrorCode() + " sql: " + sql + " binds: " + debugFields(fields) + " " + e.toString());
1231 throw new SqlServiceDeadlockException(e);
1232 }
1233
1234 else if (recordAlreadyExists)
1235 {
1236 // just a little fuss
1237 LOG.warn("Sql.dbWrite(): unique violation: error code: " + e.getErrorCode() + " sql: " + sql + " binds: " + debugFields(fields) + " " + e.toString());
1238 throw new SqlServiceUniqueViolationException(e);
1239 }

Attachments

1

Activity

Show:
Fixed

Details

Priority

Affects versions

Fix versions

Components

Assignee

Reporter

Created October 5, 2007 at 12:34 AM
Updated April 25, 2018 at 3:18 PM
Resolved May 27, 2014 at 3:14 PM
Loading...