Program: 146781
Project: 146781
Buggy source:
public void configureApp(MIDlet m,InitializationListener listener){
  failsafeInit(m);
  Logger.log("String_Node_Str","String_Node_Str");
  this.midlet=m;
  setProperties();
  loadModules();
  registerAddtlStorage();
  StorageManager.repairAll();
  RMSTransaction.cleanup();
  initReferences();
  Localization.registerLanguageReference("String_Node_Str","String_Node_Str");
  Localization.registerLanguageReference("String_Node_Str","String_Node_Str");
  final CommCareStartupInteraction interaction=new CommCareStartupInteraction(CommCareStartupInteraction.failSafeText("String_Node_Str","String_Node_Str"));
  Display.getDisplay(m).setCurrent(interaction);
  CommCareInitializer initializer=new CommCareInitializer(){
    int currentProgress=0;
    int block=0;
    private String validate(){
      this.setMessage(CommCareStartupInteraction.failSafeText("String_Node_Str","String_Node_Str"));
      SizeBoundVector<MissingMediaException> problems=new SizeBoundVector<MissingMediaException>(10);
      global.verifyInstallation(problems);
      if (problems.size() > 0) {
        int badImageRef=problems.getBadImageReferenceCount();
        int badAudioRef=problems.getBadAudioReferenceCount();
        int badVideoRef=problems.getBadVideoReferenceCount();
        String errorMessage="String_Node_Str";
        String message=CommCareStartupInteraction.failSafeText("String_Node_Str",errorMessage,new String[]{"String_Node_Str" + badImageRef,"String_Node_Str" + badAudioRef,"String_Node_Str" + badVideoRef});
        Hashtable<String,Vector<String>> problemList=new Hashtable<String,Vector<String>>();
        for (Enumeration en=problems.elements(); en.hasMoreElements(); ) {
          MissingMediaException ure=(MissingMediaException)en.nextElement();
          String res=ure.getResource().getResourceId();
          Vector<String> list;
          if (problemList.containsKey(res)) {
            list=problemList.get(res);
          }
 else {
            list=new Vector<String>();
          }
          int substringIndex=ure.getMessage().indexOf("String_Node_Str");
          String shortenedMessage=(ure.getMessage()).substring(substringIndex + 1);
          list.addElement(shortenedMessage);
          problemList.put(res,list);
        }
        message+="String_Node_Str";
        for (Enumeration en=problemList.keys(); en.hasMoreElements(); ) {
          String resource=(String)en.nextElement();
          for (          String s : problemList.get(resource)) {
            message+="String_Node_Str" + s;
          }
        }
        if (problems.getAdditional() > 0) {
          message+="String_Node_Str" + problems.getAdditional() + "String_Node_Str";
        }
        return message;
      }
      return null;
    }
    protected boolean runWrapper() throws UnfullfilledRequirementsException {
      updateProgress(10);
      ((IStorageUtilityIndexed)StorageManager.getStorage(FormDef.STORAGE_KEY)).getIDsForValue("String_Node_Str","String_Node_Str");
      CommCareContext.ClearUpdateTable();
      manager=new CommCarePlatform(CommCareUtil.getMajorVersion(),CommCareUtil.getMinorVersion());
      try {
        ResourceTable global=RetrieveGlobalResourceTable();
        ResourceTable upgrade=CommCareContext.CreateTemporaryResourceTable(CommCareUpgradeState.UPGRADE_TABLE_NAME);
        if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) {
          global.rollbackCommits();
        }
        if (upgrade.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) {
          upgrade.rollbackCommits();
        }
        if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNSTAGED) {
          global.repairTable(upgrade);
        }
        global.setStateListener(new TableStateListener(){
          static final int INSTALL_SCORE=5;
          public void resourceStateUpdated(          ResourceTable table){
            int score=0;
            int max=0;
            Vector<Resource> resources=CommCarePlatform.getResourceListFromProfile(table);
            max=resources.size() * INSTALL_SCORE;
            if (max <= INSTALL_SCORE * 2) {
              return;
            }
            for (            Resource r : resources) {
switch (r.getStatus()) {
case Resource.RESOURCE_STATUS_INSTALLED:
                score+=INSTALL_SCORE;
              break;
default :
            score+=1;
          break;
      }
    }
    updateProgress(10 + (int)Math.ceil(50 * (score * 1.0 / max)));
  }
  public void incrementProgress(  int complete,  int total){
    updateProgress(currentProgress + (int)Math.ceil(block * (complete * 1.0 / total)));
  }
}
);
if (global.isEmpty()) {
  this.setMessage(CommCareStartupInteraction.failSafeText("String_Node_Str","String_Node_Str"));
}
manager.init(CommCareUtil.getProfileReference(),global,false);
updateProgress(60);
}
 catch (UnfullfilledRequirementsException e) {
if (e.getSeverity() == UnfullfilledRequirementsException.SEVERITY_PROMPT) {
  String message=e.getMessage();
  if (e.getRequirementCode() == UnfullfilledRequirementsException.REQUIREMENT_MAJOR_APP_VERSION || e.getRequirementCode() == UnfullfilledRequirementsException.REQUIREMENT_MAJOR_APP_VERSION) {
    message=CommCareStartupInteraction.failSafeText("String_Node_Str","String_Node_Str");
  }
  if (this.blockForResponse(message)) {
    try {
      RetrieveGlobalResourceTable().clear();
      manager.init(CommCareUtil.getProfileReference(),RetrieveGlobalResourceTable(),true);
    }
 catch (    UnfullfilledRequirementsException e1) {
      throw e1;
    }
catch (    UnresolvedResourceException e3) {
      throw new RuntimeException(e3.getMessage());
    }
  }
 else {
    throw e;
  }
}
 else {
  throw e;
}
}
catch (UnresolvedResourceException e) {
throw new RuntimeException(e.getMessage());
}
currentProgress=60;
block=30;
if (!CommCareUtil.getAppProperty("String_Node_Str","String_Node_Str").equals("String_Node_Str") && !CommCareProperties.PROPERTY_YES.equals(PropertyManager._().getSingularProperty(CommCareProperties.CONTENT_VALIDATED))) {
String failureMessage=this.validate();
while (failureMessage != null) {
  Logger.log("String_Node_Str","String_Node_Str");
  this.blockForResponse(failureMessage,"String_Node_Str","String_Node_Str");
  if (this.response == CommCareInitializer.RESPONSE_YES) {
    failureMessage=this.validate();
  }
 else {
    CommCareContext.this.exitApp();
    return false;
  }
}
PropertyManager._().setProperty(CommCareProperties.CONTENT_VALIDATED,CommCareProperties.PROPERTY_YES);
}
updateProgress(90);
Localization.setLocale("String_Node_Str");
manager.initialize(RetrieveGlobalResourceTable());
purgeScheduler(false);
postProfilePropertyInit();
initUserFramework();
LogReportUtils.initPendingDates(new Date().getTime());
LanguageUtils.initializeLanguage(true,"String_Node_Str");
updateProgress(95);
J2MEDisplay.init(CommCareContext.this.midlet);
if (CommCareSense.isAutoSendEnabled()) {
AutomatedSenderService.InitializeAndSpawnSenderService();
}
return true;
}
protected void askForResponse(String message,YesNoListener yesNoListener,boolean yesNo){
if (yesNo) {
interaction.AskYesNo(message,yesNoListener);
}
 else {
interaction.PromptResponse(message,yesNoListener);
}
}
protected void askForResponse(String message,YesNoListener yesNoListener,boolean yesNo,String left,String right){
if (yesNo) {
interaction.AskYesNo(message,yesNoListener,left,right);
}
 else {
interaction.PromptResponse(message,yesNoListener);
}
}
protected void setMessage(String message){
interaction.setMessage(message,true);
}
protected void updateProgress(int progress){
interaction.updateProgess(progress);
}
}
;
initializer.initialize(listener);
}

Fixed version (ground truth):
public void configureApp(MIDlet m,InitializationListener listener){
  failsafeInit(m);
  Logger.log("String_Node_Str","String_Node_Str");
  this.midlet=m;
  setProperties();
  loadModules();
  registerAddtlStorage();
  StorageManager.repairAll();
  RMSTransaction.cleanup();
  initReferences();
  Localization.registerLanguageReference("String_Node_Str","String_Node_Str");
  Localization.registerLanguageReference("String_Node_Str","String_Node_Str");
  final CommCareStartupInteraction interaction=new CommCareStartupInteraction(CommCareStartupInteraction.failSafeText("String_Node_Str","String_Node_Str"));
  Display.getDisplay(m).setCurrent(interaction);
  CommCareInitializer initializer=new CommCareInitializer(){
    int currentProgress=0;
    int block=0;
    private String validate(){
      this.setMessage(CommCareStartupInteraction.failSafeText("String_Node_Str","String_Node_Str"));
      SizeBoundUniqueVector<MissingMediaException> problems=new SizeBoundUniqueVector<MissingMediaException>(10);
      global.verifyInstallation(problems);
      if (problems.size() > 0) {
        int badImageRef=problems.getBadImageReferenceCount();
        int badAudioRef=problems.getBadAudioReferenceCount();
        int badVideoRef=problems.getBadVideoReferenceCount();
        String errorMessage="String_Node_Str";
        String message=CommCareStartupInteraction.failSafeText("String_Node_Str",errorMessage,new String[]{"String_Node_Str" + badImageRef,"String_Node_Str" + badAudioRef,"String_Node_Str" + badVideoRef});
        Hashtable<String,Vector<String>> problemList=new Hashtable<String,Vector<String>>();
        for (Enumeration en=problems.elements(); en.hasMoreElements(); ) {
          MissingMediaException ure=(MissingMediaException)en.nextElement();
          String res=ure.getResource().getResourceId();
          Vector<String> list;
          if (problemList.containsKey(res)) {
            list=problemList.get(res);
          }
 else {
            list=new Vector<String>();
          }
          int substringIndex=ure.getMessage().indexOf("String_Node_Str");
          String shortenedMessage=(ure.getMessage()).substring(substringIndex + 1);
          list.addElement(shortenedMessage);
          problemList.put(res,list);
        }
        message+="String_Node_Str";
        for (Enumeration en=problemList.keys(); en.hasMoreElements(); ) {
          String resource=(String)en.nextElement();
          for (          String s : problemList.get(resource)) {
            message+="String_Node_Str" + s;
          }
        }
        if (problems.getAdditional() > 0) {
          message+="String_Node_Str" + problems.getAdditional() + "String_Node_Str";
        }
        return message;
      }
      return null;
    }
    protected boolean runWrapper() throws UnfullfilledRequirementsException {
      updateProgress(10);
      ((IStorageUtilityIndexed)StorageManager.getStorage(FormDef.STORAGE_KEY)).getIDsForValue("String_Node_Str","String_Node_Str");
      CommCareContext.ClearUpdateTable();
      manager=new CommCarePlatform(CommCareUtil.getMajorVersion(),CommCareUtil.getMinorVersion());
      try {
        ResourceTable global=RetrieveGlobalResourceTable();
        ResourceTable upgrade=CommCareContext.CreateTemporaryResourceTable(CommCareUpgradeState.UPGRADE_TABLE_NAME);
        if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) {
          global.rollbackCommits();
        }
        if (upgrade.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNCOMMITED) {
          upgrade.rollbackCommits();
        }
        if (global.getTableReadiness() == ResourceTable.RESOURCE_TABLE_UNSTAGED) {
          global.repairTable(upgrade);
        }
        global.setStateListener(new TableStateListener(){
          static final int INSTALL_SCORE=5;
          public void resourceStateUpdated(          ResourceTable table){
            int score=0;
            int max=0;
            Vector<Resource> resources=CommCarePlatform.getResourceListFromProfile(table);
            max=resources.size() * INSTALL_SCORE;
            if (max <= INSTALL_SCORE * 2) {
              return;
            }
            for (            Resource r : resources) {
switch (r.getStatus()) {
case Resource.RESOURCE_STATUS_INSTALLED:
                score+=INSTALL_SCORE;
              break;
default :
            score+=1;
          break;
      }
    }
    updateProgress(10 + (int)Math.ceil(50 * (score * 1.0 / max)));
  }
  public void incrementProgress(  int complete,  int total){
    updateProgress(currentProgress + (int)Math.ceil(block * (complete * 1.0 / total)));
  }
}
);
if (global.isEmpty()) {
  this.setMessage(CommCareStartupInteraction.failSafeText("String_Node_Str","String_Node_Str"));
}
manager.init(CommCareUtil.getProfileReference(),global,false);
updateProgress(60);
}
 catch (UnfullfilledRequirementsException e) {
if (e.getSeverity() == UnfullfilledRequirementsException.SEVERITY_PROMPT) {
  String message=e.getMessage();
  if (e.getRequirementCode() == UnfullfilledRequirementsException.REQUIREMENT_MAJOR_APP_VERSION || e.getRequirementCode() == UnfullfilledRequirementsException.REQUIREMENT_MAJOR_APP_VERSION) {
    message=CommCareStartupInteraction.failSafeText("String_Node_Str","String_Node_Str");
  }
  if (this.blockForResponse(message)) {
    try {
      RetrieveGlobalResourceTable().clear();
      manager.init(CommCareUtil.getProfileReference(),RetrieveGlobalResourceTable(),true);
    }
 catch (    UnfullfilledRequirementsException e1) {
      throw e1;
    }
catch (    UnresolvedResourceException e3) {
      throw new RuntimeException(e3.getMessage());
    }
  }
 else {
    throw e;
  }
}
 else {
  throw e;
}
}
catch (UnresolvedResourceException e) {
throw new RuntimeException(e.getMessage());
}
currentProgress=60;
block=30;
if (!CommCareUtil.getAppProperty("String_Node_Str","String_Node_Str").equals("String_Node_Str") && !CommCareProperties.PROPERTY_YES.equals(PropertyManager._().getSingularProperty(CommCareProperties.CONTENT_VALIDATED))) {
String failureMessage=this.validate();
while (failureMessage != null) {
  Logger.log("String_Node_Str","String_Node_Str");
  this.blockForResponse(failureMessage,"String_Node_Str","String_Node_Str");
  if (this.response == CommCareInitializer.RESPONSE_YES) {
    failureMessage=this.validate();
  }
 else {
    CommCareContext.this.exitApp();
    return false;
  }
}
PropertyManager._().setProperty(CommCareProperties.CONTENT_VALIDATED,CommCareProperties.PROPERTY_YES);
}
updateProgress(90);
Localization.setLocale("String_Node_Str");
manager.initialize(RetrieveGlobalResourceTable());
purgeScheduler(false);
postProfilePropertyInit();
initUserFramework();
LogReportUtils.initPendingDates(new Date().getTime());
LanguageUtils.initializeLanguage(true,"String_Node_Str");
updateProgress(95);
J2MEDisplay.init(CommCareContext.this.midlet);
if (CommCareSense.isAutoSendEnabled()) {
AutomatedSenderService.InitializeAndSpawnSenderService();
}
return true;
}
protected void askForResponse(String message,YesNoListener yesNoListener,boolean yesNo){
if (yesNo) {
interaction.AskYesNo(message,yesNoListener);
}
 else {
interaction.PromptResponse(message,yesNoListener);
}
}
protected void askForResponse(String message,YesNoListener yesNoListener,boolean yesNo,String left,String right){
if (yesNo) {
interaction.AskYesNo(message,yesNoListener,left,right);
}
 else {
interaction.PromptResponse(message,yesNoListener);
}
}
protected void setMessage(String message){
interaction.setMessage(message,true);
}
protected void updateProgress(int progress){
interaction.updateProgess(progress);
}
}
;
initializer.initialize(listener);
}