Program: 117423
Project: 117423
Buggy source:
@Override protected void installData(OrientDbWebApplication application,ODatabaseDocument database){
  OrienteerWebApplication app=(OrienteerWebApplication)application;
  ODatabaseDocument db=(ODatabaseDocument)database;
  OSchema schema=db.getMetadata().getSchema();
  OClass oModuleClass=schema.getClass(OMODULE_CLASS);
  if (oModuleClass == null) {
    oModuleClass=schema.createClass(OMODULE_CLASS);
  }
  if (!oModuleClass.existsProperty(OMODULE_NAME)) {
    OProperty nameProperty=oModuleClass.createProperty(OMODULE_NAME,OType.STRING);
    CustomAttributes.PROP_NAME.setValue(oModuleClass,nameProperty);
  }
  if (!oModuleClass.existsProperty(OMODULE_VERSION)) {
    oModuleClass.createProperty(OMODULE_VERSION,OType.INTEGER);
  }
  Map<String,Integer> installedModules=new HashMap<String,Integer>();
  for (  ODocument doc : db.browseClass(OMODULE_CLASS)) {
    installedModules.put((String)doc.field(OMODULE_NAME),(Integer)doc.field(OMODULE_VERSION,Integer.class));
  }
  for (  Map.Entry<String,IOrienteerModule> entry : app.getRegisteredModules().entrySet()) {
    String name=entry.getKey();
    IOrienteerModule module=entry.getValue();
    int version=module.getVersion();
    Integer oldVersion=installedModules.get(name);
    if (oldVersion == null) {
      module.onInstall(app,db);
      ODocument moduleDoc=new ODocument(oModuleClass);
      moduleDoc.field(OMODULE_NAME,module.getName());
      moduleDoc.field(OMODULE_VERSION,module.getVersion());
      moduleDoc.save();
    }
 else     if (!oldVersion.equals(version)) {
      module.onUpdate(app,db,oldVersion,version);
    }
    module.onInitialize(app,db);
  }
}

Fixed version (ground truth):
@Override protected void installData(OrientDbWebApplication application,ODatabaseDocument database){
  OrienteerWebApplication app=(OrienteerWebApplication)application;
  ODatabaseDocument db=(ODatabaseDocument)database;
  OSchema schema=db.getMetadata().getSchema();
  OClass oModuleClass=schema.getClass(OMODULE_CLASS);
  if (oModuleClass == null) {
    oModuleClass=schema.createClass(OMODULE_CLASS);
  }
  if (!oModuleClass.existsProperty(OMODULE_NAME)) {
    OProperty nameProperty=oModuleClass.createProperty(OMODULE_NAME,OType.STRING);
    CustomAttributes.PROP_NAME.setValue(oModuleClass,nameProperty);
  }
  if (!oModuleClass.existsProperty(OMODULE_VERSION)) {
    oModuleClass.createProperty(OMODULE_VERSION,OType.INTEGER);
  }
  Map<String,ODocument> installedModules=new HashMap<String,ODocument>();
  for (  ODocument doc : db.browseClass(OMODULE_CLASS)) {
    installedModules.put((String)doc.field(OMODULE_NAME),doc);
  }
  for (  Map.Entry<String,IOrienteerModule> entry : app.getRegisteredModules().entrySet()) {
    String name=entry.getKey();
    IOrienteerModule module=entry.getValue();
    int version=module.getVersion();
    ODocument moduleDoc=installedModules.get(name);
    Integer oldVersion=moduleDoc != null ? (Integer)moduleDoc.field(OMODULE_VERSION,Integer.class) : null;
    if (moduleDoc == null || oldVersion == null) {
      module.onInstall(app,db);
      moduleDoc=new ODocument(oModuleClass);
      moduleDoc.field(OMODULE_NAME,module.getName());
      moduleDoc.field(OMODULE_VERSION,module.getVersion());
      moduleDoc.save();
    }
 else     if (oldVersion < version) {
      module.onUpdate(app,db,oldVersion,version);
      moduleDoc.field(OMODULE_VERSION,version);
      moduleDoc.save();
    }
    module.onInitialize(app,db);
  }
}