Program: 16008
Project: 16008
Buggy source:
/** 
 * Call the fire method of the user-defined trigger class if required. This method does nothing if the trigger is not defined for the given action. This method is called before or after a row is processed, possibly many times for each statement.
 * @param session the session
 * @param oldRow the old row
 * @param newRow the new row
 * @param beforeAction true if this method is called before the operation isapplied
 * @param rollback when the operation occurred within a rollback
 * @return true if no further action is required (for 'instead of' triggers)
 */
public boolean fireRow(Session session,Row oldRow,Row newRow,boolean beforeAction,boolean rollback){
  if (!rowBased || before != beforeAction) {
    return false;
  }
  if (rollback && !onRollback) {
    return false;
  }
  load();
  Object[] oldList;
  Object[] newList;
  boolean fire=false;
  if ((typeMask & Trigger.INSERT) != 0) {
    if (oldRow == null && newRow != null) {
      fire=true;
    }
  }
  if ((typeMask & Trigger.UPDATE) != 0) {
    if (oldRow != null && newRow != null) {
      fire=true;
    }
  }
  if ((typeMask & Trigger.DELETE) != 0) {
    if (oldRow != null && newRow == null) {
      fire=true;
    }
  }
  if (!fire) {
    return false;
  }
  oldList=convertToObjectList(oldRow);
  newList=convertToObjectList(newRow);
  Object[] newListBackup;
  if (before && newList != null) {
    newListBackup=new Object[newList.length];
    for (int i=0; i < newList.length; i++) {
      newListBackup[i]=newList[i];
    }
  }
 else {
    newListBackup=null;
  }
  Connection c2=session.createConnection(false);
  boolean old=session.getAutoCommit();
  boolean oldDisabled=session.setCommitOrRollbackDisabled(true);
  Value identity=session.getScopeIdentity();
  try {
    session.setAutoCommit(false);
    triggerCallback.fire(c2,oldList,newList);
    if (newListBackup != null) {
      for (int i=0; i < newList.length; i++) {
        Object o=newList[i];
        if (o != newListBackup[i]) {
          Value v=DataType.convertToValue(session,o,Value.UNKNOWN);
          newRow.setValue(i,v);
        }
      }
    }
  }
 catch (  Exception e) {
    if (onRollback) {
    }
 else {
      throw DbException.convert(e);
    }
  }
 finally {
    session.setScopeIdentity(identity);
    session.setCommitOrRollbackDisabled(oldDisabled);
    session.setAutoCommit(old);
  }
  return insteadOf;
}

Fixed version (ground truth):
/** 
 * Call the fire method of the user-defined trigger class if required. This method does nothing if the trigger is not defined for the given action. This method is called before or after a row is processed, possibly many times for each statement.
 * @param session the session
 * @param oldRow the old row
 * @param newRow the new row
 * @param beforeAction true if this method is called before the operation isapplied
 * @param rollback when the operation occurred within a rollback
 * @return true if no further action is required (for 'instead of' triggers)
 */
public boolean fireRow(Session session,Row oldRow,Row newRow,boolean beforeAction,boolean rollback){
  if (!rowBased || before != beforeAction) {
    return false;
  }
  if (rollback && !onRollback) {
    return false;
  }
  load();
  Object[] oldList;
  Object[] newList;
  boolean fire=false;
  if ((typeMask & Trigger.INSERT) != 0) {
    if (oldRow == null && newRow != null) {
      fire=true;
    }
  }
  if ((typeMask & Trigger.UPDATE) != 0) {
    if (oldRow != null && newRow != null) {
      fire=true;
    }
  }
  if ((typeMask & Trigger.DELETE) != 0) {
    if (oldRow != null && newRow == null) {
      fire=true;
    }
  }
  if (!fire) {
    return false;
  }
  oldList=convertToObjectList(oldRow);
  newList=convertToObjectList(newRow);
  Object[] newListBackup;
  if (before && newList != null) {
    newListBackup=new Object[newList.length];
    System.arraycopy(newList,0,newListBackup,0,newList.length);
  }
 else {
    newListBackup=null;
  }
  Connection c2=session.createConnection(false);
  boolean old=session.getAutoCommit();
  boolean oldDisabled=session.setCommitOrRollbackDisabled(true);
  Value identity=session.getScopeIdentity();
  try {
    session.setAutoCommit(false);
    triggerCallback.fire(c2,oldList,newList);
    if (newListBackup != null) {
      for (int i=0; i < newList.length; i++) {
        Object o=newList[i];
        if (o != newListBackup[i]) {
          Value v=DataType.convertToValue(session,o,Value.UNKNOWN);
          newRow.setValue(i,v);
        }
      }
    }
  }
 catch (  Exception e) {
    if (onRollback) {
    }
 else {
      throw DbException.convert(e);
    }
  }
 finally {
    session.setScopeIdentity(identity);
    session.setCommitOrRollbackDisabled(oldDisabled);
    session.setAutoCommit(old);
  }
  return insteadOf;
}