Program: 47085
Project: 47085
Buggy source:
/** 
 * Stores the cover   {@link Blob} with the given mBID in the database
 * @param mBID the MBID to store
 * @param cover the cover as a {@link Blob}
 */
public static void writeMBID(final String mBID,final byte[] cover){
  boolean trace=LOGGER.isTraceEnabled();
  try (Connection connection=database.getConnection()){
    String query="String_Node_Str" + TABLE_NAME + contructMBIDWhere(mBID);
    if (trace) {
      LOGGER.trace("String_Node_Str",query);
    }
    tableLock.writeLock().lock();
    try (Statement statement=connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE)){
      connection.setAutoCommit(false);
      try (ResultSet result=statement.executeQuery(query)){
        if (result.next()) {
          if (cover != null || result.getBlob("String_Node_Str") == null) {
            if (trace) {
              LOGGER.trace("String_Node_Str",mBID);
            }
            result.updateTimestamp("String_Node_Str",new Timestamp(System.currentTimeMillis()));
            if (cover != null) {
              result.updateString("String_Node_Str",mBID);
            }
 else {
              result.updateNull("String_Node_Str");
            }
            result.updateRow();
          }
 else           if (trace) {
            LOGGER.trace("String_Node_Str",result.getInt("String_Node_Str"));
          }
        }
 else {
          if (trace) {
            LOGGER.trace("String_Node_Str",mBID);
          }
          result.moveToInsertRow();
          result.updateTimestamp("String_Node_Str",new Timestamp(System.currentTimeMillis()));
          result.updateString("String_Node_Str",mBID);
          if (cover != null) {
            result.updateBytes("String_Node_Str",cover);
          }
          result.insertRow();
        }
      }
  finally {
        connection.commit();
      }
    }
  finally {
      tableLock.writeLock().unlock();
    }
  }
 catch (  SQLException e) {
    LOGGER.error("String_Node_Str",mBID,e.getMessage());
    LOGGER.trace("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Stores the cover   {@link Blob} with the given mBID in the database
 * @param mBID the MBID to store
 * @param cover the cover as a {@link Blob}
 */
public static void writeMBID(final String mBID,final byte[] cover){
  boolean trace=LOGGER.isTraceEnabled();
  try (Connection connection=database.getConnection()){
    String query="String_Node_Str" + TABLE_NAME + contructMBIDWhere(mBID);
    if (trace) {
      LOGGER.trace("String_Node_Str",query);
    }
    tableLock.writeLock().lock();
    try (Statement statement=connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE)){
      connection.setAutoCommit(false);
      try (ResultSet result=statement.executeQuery(query)){
        if (result.next()) {
          if (cover != null || result.getBlob("String_Node_Str") == null) {
            if (trace) {
              LOGGER.trace("String_Node_Str",mBID);
            }
            result.updateTimestamp("String_Node_Str",new Timestamp(System.currentTimeMillis()));
            if (cover != null) {
              result.updateBytes("String_Node_Str",cover);
            }
 else {
              result.updateNull("String_Node_Str");
            }
            result.updateRow();
          }
 else           if (trace) {
            LOGGER.trace("String_Node_Str",result.getInt("String_Node_Str"));
          }
        }
 else {
          if (trace) {
            LOGGER.trace("String_Node_Str",mBID);
          }
          result.moveToInsertRow();
          result.updateTimestamp("String_Node_Str",new Timestamp(System.currentTimeMillis()));
          result.updateString("String_Node_Str",mBID);
          if (cover != null) {
            result.updateBytes("String_Node_Str",cover);
          }
          result.insertRow();
        }
      }
  finally {
        connection.commit();
      }
    }
  finally {
      tableLock.writeLock().unlock();
    }
  }
 catch (  SQLException e) {
    LOGGER.error("String_Node_Str",mBID,e.getMessage());
    LOGGER.trace("String_Node_Str",e);
  }
}