Program: 145448
Project: 145448
Buggy source:
@Override protected int commit(final String aDatasourceId,final List<Change> aLog) throws Exception {
  for (  String validatorName : validators.keySet()) {
    Collection<String> datasourcesUnderControl=validators.get(validatorName);
    if (((datasourcesUnderControl == null || datasourcesUnderControl.isEmpty()) && aDatasourceId == null) || (datasourcesUnderControl != null && datasourcesUnderControl.contains(aDatasourceId))) {
      JSObject validator=ScriptUtils.createModule(validatorName);
      if (validator != null) {
        Object oValidate=validator.getMember("String_Node_Str");
        if (oValidate instanceof JSObject) {
          JSObject fValidate=(JSObject)oValidate;
          Object oResult=ScriptUtils.toJava(fValidate.call(validator,new Object[]{ScriptUtils.toJs(aLog.toArray()),aDatasourceId}));
          if (oResult != null && Boolean.FALSE.equals(ScriptUtils.toJava(oResult))) {
            break;
          }
        }
 else {
          Logger.getLogger(ScriptedDatabasesClient.class.getName()).log(Level.WARNING,"String_Node_Str",validatorName);
        }
      }
 else {
        Logger.getLogger(ScriptedDatabasesClient.class.getName()).log(Level.WARNING,"String_Node_Str",validatorName);
      }
    }
  }
  if (aDatasourceId != null) {
    ApplicationElement appElement=getAppCache().get(aDatasourceId);
    if (appElement != null && appElement.getType() == ClientConstants.ET_COMPONENT) {
      JSObject dataSourceApplier=ScriptUtils.createModule(aDatasourceId);
      if (dataSourceApplier != null) {
        Object oApply=dataSourceApplier.getMember("String_Node_Str");
        if (oApply instanceof JSObject && ((JSObject)oApply).isFunction()) {
          JSObject fApply=(JSObject)oApply;
          fApply.call(dataSourceApplier,new Object[]{ScriptUtils.toJs(aLog.toArray())});
        }
      }
    }
  }
  boolean consumed=true;
  for (  Change change : aLog) {
    if (!change.consumed) {
      consumed=false;
    }
  }
  if (!consumed) {
    return super.commit(aDatasourceId,aLog);
  }
 else {
    aLog.clear();
    return 0;
  }
}

Fixed version (ground truth):
@Override protected int commit(final String aDatasourceId,final List<Change> aLog) throws Exception {
  for (  String validatorName : validators.keySet()) {
    Collection<String> datasourcesUnderControl=validators.get(validatorName);
    if (((datasourcesUnderControl == null || datasourcesUnderControl.isEmpty()) && aDatasourceId == null) || (datasourcesUnderControl != null && datasourcesUnderControl.contains(aDatasourceId))) {
      JSObject validator=ScriptUtils.createModule(validatorName);
      if (validator != null) {
        Object oValidate=validator.getMember("String_Node_Str");
        if (oValidate instanceof JSObject) {
          JSObject fValidate=(JSObject)oValidate;
          Object oResult=ScriptUtils.toJava(fValidate.call(validator,new Object[]{ScriptUtils.toJs(aLog.toArray()),aDatasourceId}));
          if (oResult != null && Boolean.FALSE.equals(ScriptUtils.toJava(oResult))) {
            break;
          }
        }
 else {
          Logger.getLogger(ScriptedDatabasesClient.class.getName()).log(Level.WARNING,"String_Node_Str",validatorName);
        }
      }
 else {
        Logger.getLogger(ScriptedDatabasesClient.class.getName()).log(Level.WARNING,"String_Node_Str",validatorName);
      }
    }
  }
  if (aDatasourceId != null) {
    ApplicationElement appElement=getAppCache().get(aDatasourceId);
    if (appElement != null && appElement.getType() == ClientConstants.ET_COMPONENT) {
      JSObject dataSourceApplier=createModule(aDatasourceId);
      if (dataSourceApplier != null) {
        Object oApply=dataSourceApplier.getMember("String_Node_Str");
        if (oApply instanceof JSObject && ((JSObject)oApply).isFunction()) {
          JSObject fApply=(JSObject)oApply;
          fApply.call(dataSourceApplier,new Object[]{ScriptUtils.toJs(aLog.toArray())});
        }
      }
    }
  }
  boolean consumed=true;
  for (  Change change : aLog) {
    if (!change.consumed) {
      consumed=false;
    }
  }
  if (!consumed) {
    return super.commit(aDatasourceId,aLog);
  }
 else {
    aLog.clear();
    return 0;
  }
}