nus-yam/ex-repair huggingface dataset:
Program: 145025
Project: 145025
Buggy source:
/** 
 * Process the response to the current message (may have side effects).
 * @param message A completed transport message with an available response.
 * @return A string with the user facing messages which were parsed out from that response. 
 * @throws InvalidStructureException If the response is present, but incorrectly structured
 * @throws IOException 
 * @throws UnfullfilledRequirementsException If the isn't capable of processing the provided messagefor well recognized reasons (Like the API version of the response being above that currently understood) 
 * @throws XmlPullParserException
 */
public String processResponse(SimpleHttpTransportMessage message) throws InvalidStructureException, IOException, UnfullfilledRequirementsException, XmlPullParserException {
  if (message.getResponseProperties() != null && message.getResponseProperties().getORApiVersion().equals(ONE_OH)) {
    byte[] response=message.getResponseBody();
    CommCareTransactionParserFactory factory=new CommCareTransactionParserFactory(true);
    DataModelPullParser parser=new DataModelPullParser(new ByteArrayInputStream(response),factory);
    boolean success=parser.parse();
    if (factory.getResponseMessage() != null) {
      return factory.getResponseMessage();
    }
 else {
      return null;
    }
  }
  throw new UnfullfilledRequirementsException("String_Node_Str",UnfullfilledRequirementsException.SEVERITY_ENVIRONMENT);
}

Fixed version (ground truth):
/** 
 * Process the response to the current message (may have side effects).
 * @param message A completed transport message with an available response.
 * @return A string with the user facing messages which were parsed out from that response. 
 * @throws InvalidStructureException If the response is present, but incorrectly structured
 * @throws IOException 
 * @throws UnfullfilledRequirementsException If the isn't capable of processing the provided messagefor well recognized reasons (Like the API version of the response being above that currently understood) 
 * @throws XmlPullParserException
 */
public String processResponse(SimpleHttpTransportMessage message) throws InvalidStructureException, IOException, UnfullfilledRequirementsException, XmlPullParserException {
  if (message.getResponseProperties() != null && ONE_OH.equals(message.getResponseProperties().getORApiVersion())) {
    byte[] response=message.getResponseBody();
    CommCareTransactionParserFactory factory=new CommCareTransactionParserFactory(true);
    DataModelPullParser parser=new DataModelPullParser(new ByteArrayInputStream(response),factory);
    boolean success=parser.parse();
    if (factory.getResponseMessage() != null) {
      return factory.getResponseMessage();
    }
 else {
      return null;
    }
  }
  throw new UnfullfilledRequirementsException("String_Node_Str",UnfullfilledRequirementsException.SEVERITY_ENVIRONMENT);
}
Program: 145026
Project: 145026
Buggy source:
/** 
 * Whether the processor knows that it is capable of processing the response to the current message.
 * @param message A completed transport message with an available response.
 * @return true if the processor should be able to handle the response. false otherwise.
 */
public boolean handlesResponse(SimpleHttpTransportMessage message){
  if (message.getResponseProperties() != null && message.getResponseProperties().getORApiVersion().equals(ONE_OH)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Whether the processor knows that it is capable of processing the response to the current message.
 * @param message A completed transport message with an available response.
 * @return true if the processor should be able to handle the response. false otherwise.
 */
public boolean handlesResponse(SimpleHttpTransportMessage message){
  if (message.getResponseProperties() != null && ONE_OH.equals(message.getResponseProperties().getORApiVersion())) {
    return true;
  }
  return false;
}
Program: 145027
Project: 145027
Buggy source:
private boolean handled(Object a,Object b,Object sentinal,Vector<Object> pivots) throws UnpivotableExpressionException {
  if (sentinal == a) {
    if (b == null) {
      throw new UnpivotableExpressionException();
    }
 else     if (sentinal == b) {
      throw new UnpivotableExpressionException();
    }
 else {
      pivots.addElement(new CmpPivot(((Double)b).doubleValue(),op));
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean handled(Object a,Object b,Object sentinal,Vector<Object> pivots) throws UnpivotableExpressionException {
  if (sentinal == a) {
    if (b == null) {
      throw new UnpivotableExpressionException();
    }
 else     if (sentinal == b) {
      throw new UnpivotableExpressionException();
    }
 else {
      Double val=null;
      if (b instanceof Double) {
        val=(Double)b;
      }
 else {
        if (b instanceof Integer) {
          val=new Double(((Integer)b).doubleValue());
        }
        if (b instanceof Long) {
          val=new Double(((Long)b).doubleValue());
        }
        if (b instanceof Float) {
          val=new Double(((Float)b).doubleValue());
        }
        if (b instanceof Short) {
          val=new Double(((Short)b).shortValue());
        }
        if (b instanceof Byte) {
          val=new Double(((Byte)b).byteValue());
        }
 else {
          throw new UnpivotableExpressionException("String_Node_Str" + b);
        }
      }
      pivots.addElement(new CmpPivot(val.doubleValue(),op));
      return true;
    }
  }
  return false;
}
Program: 145028
Project: 145028
Buggy source:
public void loggedIn(User u,String password){
  CommCareContext._().setUser(u,password == null ? null : new DefaultHttpCredentialProvider(u.getUsername(),password));
  Logger.log("String_Node_Str",PropertyUtils.trim(u.getUniqueId(),8) + "String_Node_Str" + u.getUsername());
  CommCareContext._().toggleDemoMode(User.DEMO_USER.equals(u.getUserType()));
  J2MEDisplay.startStateWithLoadingScreen(new DeviceReportState(){
    public String getDestURL(){
      String url=PropertyManager._().getSingularProperty(LogPropertyRules.LOG_SUBMIT_URL);
      if (url == null) {
        url=CommCareContext._().getSubmitURL();
      }
      return url;
    }
    public void done(){
      J2MEDisplay.startStateWithLoadingScreen(new PeriodicWrapperState(CommCareContext._().getEventDescriptors()){
        public void done(){
          J2MEDisplay.startStateWithLoadingScreen(new CommCareHomeState());
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
public void loggedIn(User u,String password){
  CommCareContext._().setUser(u,password == null ? null : new DefaultHttpCredentialProvider(u.getUsername(),password));
  Logger.log("String_Node_Str",PropertyUtils.trim(u.getUniqueId(),8) + "String_Node_Str" + u.getUsername());
  CommCareContext._().toggleDemoMode(User.DEMO_USER.equals(u.getUserType()));
  CommCareUtil.launchHomeWithSchedulers();
}
Program: 145029
Project: 145029
Buggy source:
public static void launchFirstState(){
  if (!CommCareContext._().getManager().getCurrentProfile().isFeatureActive("String_Node_Str")) {
    CommCareUtil.launchHomeState();
    return;
  }
  if (CommCareProperties.FIRST_RUN_YES.equals(PropertyManager._().getSingularProperty(CommCareProperties.IS_FIRST_RUN))) {
    J2MEDisplay.startStateWithLoadingScreen(new CommCareFirstStartState());
  }
 else {
    J2MEDisplay.startStateWithLoadingScreen(new CommCareLoginState());
  }
}

Fixed version (ground truth):
public static void launchFirstState(){
  if (!CommCareContext._().getManager().getCurrentProfile().isFeatureActive("String_Node_Str")) {
    CommCareUtil.launchHomeWithSchedulers();
    return;
  }
  if (CommCareProperties.FIRST_RUN_YES.equals(PropertyManager._().getSingularProperty(CommCareProperties.IS_FIRST_RUN))) {
    J2MEDisplay.startStateWithLoadingScreen(new CommCareFirstStartState());
  }
 else {
    J2MEDisplay.startStateWithLoadingScreen(new CommCareLoginState());
  }
}
Program: 145030
Project: 145030
Buggy source:
public void requestConstraintHint(ConstraintHint hint) throws UnpivotableExpressionException {
  hint.init(new EvaluationContext(new EvaluationContext(),mTreeElement.getRef()),mTreeElement.getConstraint().constraint,this.form.getInstance());
}

Fixed version (ground truth):
public void requestConstraintHint(ConstraintHint hint) throws UnpivotableExpressionException {
  Constraint c=mTreeElement.getConstraint();
  if (c != null) {
    hint.init(new EvaluationContext(new EvaluationContext(),mTreeElement.getRef()),c.constraint,this.form.getInstance());
  }
 else {
    throw new UnpivotableExpressionException();
  }
}
Program: 145031
Project: 145031
Buggy source:
public Object pivot(FormInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  return eval(model,evalContext);
}

Fixed version (ground truth):
/** 
 * Pivot this expression, returning values if appropriate, and adding any pivots to the list. 
 * @param model The model to evaluate the current expression against
 * @param evalContext The evaluation context to evaluate against
 * @param pivots The list of pivot points in the xpath being evaluated. Pivots should be added to this list.
 * @param sentinal The value which is being pivoted around.
 * @return null - If a pivot was identified in this expression sentinal - If the current expression represents the sentinal being pivoted any other value - The result of the expression if no pivots are detected
 * @throws UnpivotableExpressionException If the expression is too complex to pivot
 */
public Object pivot(FormInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  return eval(model,evalContext);
}
Program: 145033
Project: 145033
Buggy source:
protected Item getEntryWidget(FormEntryPrompt prompt){
  return wec.wrapEntryWidget(textField);
}

Fixed version (ground truth):
protected Item getEntryWidget(FormEntryPrompt prompt){
  try {
    StringLengthRangeHint hint=new StringLengthRangeHint();
    prompt.requestConstraintHint(hint);
    StringData maxexample=hint.getMax();
    if (maxexample.getValue() != null) {
      textField.setMaxSize(((String)maxexample.getValue()).length());
    }
  }
 catch (  UnpivotableExpressionException e) {
  }
  return wec.wrapEntryWidget(textField);
}
Program: 145034
Project: 145034
Buggy source:
public void _commandAction(Command c,Displayable d){
  if (c.equals(CommCareOTACredentialEntry.DOWNLOAD)) {
    if (userExists(entry.getUsername())) {
      entry.sendMessage(Localization.get("String_Node_Str"));
      return;
    }
    tryDownload(getClientMessage());
  }
 else   if (d == entry && c.equals(CommCareOTACredentialEntry.CANCEL)) {
    transitions.cancel();
  }
 else   if (c.equals(view.FINISHED)) {
    transitions.done(errorsOccurred);
  }
}

Fixed version (ground truth):
public void _commandAction(Command c,Displayable d){
  if (c.equals(CommCareOTACredentialEntry.DOWNLOAD)) {
    if (userExists(entry.getUsername()) && !isSync) {
      entry.sendMessage(Localization.get("String_Node_Str"));
      return;
    }
    tryDownload(getClientMessage());
  }
 else   if (d == entry && c.equals(CommCareOTACredentialEntry.CANCEL)) {
    transitions.cancel();
  }
 else   if (c.equals(view.FINISHED)) {
    transitions.done(errorsOccurred);
  }
}
Program: 145035
Project: 145035
Buggy source:
public CommCareAddUserState(){
  super(PropertyManager._().getSingularProperty(CommCareProperties.USER_REG_NAMESPACE),CommCareContext._().getPreloaders(),CommCareContext._().getFuncHandlers());
}

Fixed version (ground truth):
public CommCareAddUserState(){
  super(PropertyManager._().getSingularProperty(CommCareProperties.USER_REG_NAMESPACE),filterPreloaders(CommCareContext._().getPreloaders()),CommCareContext._().getFuncHandlers());
}
Program: 145036
Project: 145036
Buggy source:
public CommCareEditUserState(User u){
  super(u,PropertyManager._().getSingularProperty(CommCareProperties.USER_REG_NAMESPACE),CommCareContext._().getPreloaders(),CommCareContext._().getFuncHandlers());
}

Fixed version (ground truth):
public CommCareEditUserState(User u){
  super(u,PropertyManager._().getSingularProperty(CommCareProperties.USER_REG_NAMESPACE),CommCareAddUserState.filterPreloaders(CommCareContext._().getPreloaders()),CommCareContext._().getFuncHandlers());
}
Program: 145037
Project: 145037
Buggy source:
public void done(boolean errorsOccurred){
  done();
}

Fixed version (ground truth):
public abstract void done();
Program: 145038
Project: 145038
Buggy source:
public void createView(){
  if (prompt.isRequired()) {
    cg=new ChoiceGroup("String_Node_Str" + prompt.getLongText(),ChoiceGroup.MULTIPLE);
  }
 else {
    cg=new ChoiceGroup(prompt.getLongText(),ChoiceGroup.MULTIPLE);
  }
  Vector<SelectChoice> choices=prompt.getSelectChoices();
  Enumeration itr=choices.elements();
  int i=0;
  boolean[] selectedFlags=new boolean[choices.size()];
  IAnswerData data=this.prompt.getAnswerValue();
  Vector<Selection> selected=null;
  if (data != null) {
    selected=(Vector<Selection>)data;
  }
  while (itr.hasMoreElements()) {
    SelectChoice choice=(SelectChoice)itr.nextElement();
    selectedFlags[i]=false;
    if (selected != null) {
      for (      Selection s : selected) {
        if (s.xmlValue.equals(choice.selection().xmlValue)) {
          selectedFlags[i]=true;
        }
      }
    }
    String label=this.prompt.getSelectChoiceText(choice);
    cg.append(label,null);
    i++;
  }
  cg.setSelectedFlags(selectedFlags);
  this.append(cg);
  this.addNavigationWidgets();
  if (prompt.getHelpText() != null) {
    setHint(prompt.getHelpText());
  }
}

Fixed version (ground truth):
public void createView(){
  if (prompt.isRequired()) {
    cg=new ChoiceGroup("String_Node_Str" + prompt.getLongText(),ChoiceGroup.MULTIPLE);
  }
 else {
    cg=new ChoiceGroup(prompt.getLongText(),ChoiceGroup.MULTIPLE);
  }
  Vector<SelectChoice> choices=prompt.getSelectChoices();
  Enumeration itr=choices.elements();
  int i=0;
  boolean[] selectedFlags=new boolean[choices.size()];
  IAnswerData data=this.prompt.getAnswerValue();
  Vector<Selection> selected=null;
  if (data != null) {
    selected=(Vector<Selection>)new SelectMultiData().cast(data.uncast()).getValue();
  }
  while (itr.hasMoreElements()) {
    SelectChoice choice=(SelectChoice)itr.nextElement();
    selectedFlags[i]=false;
    if (selected != null) {
      for (      Selection s : selected) {
        if (s.xmlValue.equals(choice.selection().xmlValue)) {
          selectedFlags[i]=true;
        }
      }
    }
    String label=this.prompt.getSelectChoiceText(choice);
    cg.append(label,null);
    i++;
  }
  cg.setSelectedFlags(selectedFlags);
  this.append(cg);
  this.addNavigationWidgets();
  if (prompt.getHelpText() != null) {
    setHint(prompt.getHelpText());
  }
}
Program: 145039
Project: 145039
Buggy source:
public void createView(){
  if (prompt.isRequired()) {
    cg=new CustomChoiceGroup("String_Node_Str" + prompt.getLongText(),ChoiceGroup.EXCLUSIVE,true);
  }
 else {
    cg=new CustomChoiceGroup(prompt.getLongText(),ChoiceGroup.EXCLUSIVE,true);
  }
  Enumeration itr=(prompt.getSelectChoices().elements());
  int preselectionIndex=-1;
  String presetAnswerLabel=prompt.getAnswerValue() != null ? prompt.getAnswerValue().getDisplayText() : null;
  int count=0;
  while (itr.hasMoreElements()) {
    SelectChoice choice=(SelectChoice)itr.nextElement();
    if ((presetAnswerLabel != null) && (choice.getValue().equals(presetAnswerLabel))) {
      preselectionIndex=count;
    }
    cg.append(prompt.getSelectChoiceText(choice),null);
    count++;
  }
  this.append(cg);
  if ((preselectionIndex > -1) && (preselectionIndex < cg.size())) {
    cg.setSelectedIndex(preselectionIndex,true);
  }
  this.addNavigationWidgets();
  if (prompt.getHelpText() != null) {
    setHint(prompt.getHelpText());
  }
  cg.setItemStateListener(this);
}

Fixed version (ground truth):
public void createView(){
  if (prompt.isRequired()) {
    cg=new CustomChoiceGroup("String_Node_Str" + prompt.getLongText(),ChoiceGroup.EXCLUSIVE,true);
  }
 else {
    cg=new CustomChoiceGroup(prompt.getLongText(),ChoiceGroup.EXCLUSIVE,true);
  }
  Enumeration itr=(prompt.getSelectChoices().elements());
  int preselectionIndex=-1;
  String xmlValue=null;
  if (prompt.getAnswerValue() != null) {
    xmlValue=((Selection)new SelectOneData().cast(prompt.getAnswerValue().uncast()).getValue()).xmlValue;
  }
  int count=0;
  while (itr.hasMoreElements()) {
    SelectChoice choice=(SelectChoice)itr.nextElement();
    if ((xmlValue != null) && (choice.getValue().equals(xmlValue))) {
      preselectionIndex=count;
    }
    cg.append(prompt.getSelectChoiceText(choice),null);
    count++;
  }
  this.append(cg);
  if ((preselectionIndex > -1) && (preselectionIndex < cg.size())) {
    cg.setSelectedIndex(preselectionIndex,true);
  }
  this.addNavigationWidgets();
  if (prompt.getHelpText() != null) {
    setHint(prompt.getHelpText());
  }
  cg.setItemStateListener(this);
}
Program: 145040
Project: 145040
Buggy source:
public void registerModule(){
  PropertyManager._().addRules(new FormManagerProperties());
  PropertyUtils.initializeProperty(FormManagerProperties.VIEW_TYPE_PROPERTY,FormManagerProperties.VIEW_CHATTERBOX);
  PropertyUtils.initializeProperty(FormManagerProperties.EXTRA_KEY_FORMAT,FormManagerProperties.EXTRA_KEY_LANGUAGE_CYCLE);
}

Fixed version (ground truth):
public void registerModule(){
  PropertyManager._().addRules(new FormManagerProperties());
}
Program: 145041
Project: 145041
Buggy source:
public CommCareOTARestoreState(boolean isSync,HttpAuthenticator authenticator){
  this.isSync=isSync;
  this.authenticator=authenticator;
  this.noPartial=getPartialRestoreSetting();
  controller=getController();
}

Fixed version (ground truth):
public CommCareOTARestoreState(boolean isSync,HttpAuthenticator authenticator){
  this.isSync=isSync;
  this.authenticator=authenticator;
  this.partial=getPartialRestoreSetting();
  controller=getController();
}
Program: 145042
Project: 145042
Buggy source:
protected CommCareOTARestoreController getController(){
  return new CommCareOTARestoreController(this,CommCareContext._().getOTAURL(),authenticator,isSync,noPartial);
}

Fixed version (ground truth):
protected CommCareOTARestoreController getController(){
  return new CommCareOTARestoreController(this,CommCareContext._().getOTAURL(),authenticator,isSync,!partial);
}
Program: 145043
Project: 145043
Buggy source:
public TransactionParser getParser(String name,String namespace,KXmlParser parser){
  if (name.toLowerCase().equals("String_Node_Str")) {
    return new CaseXmlParser(parser,caseTallies);
  }
 else   if (name.toLowerCase().equals("String_Node_Str")) {
    return new UserXmlParser(parser);
  }
 else   if (name.equalsIgnoreCase("String_Node_Str")) {
    return new TransactionParser<String>(parser,"String_Node_Str",null){
      public void commit(      String parsed) throws IOException {
      }
      public String parse() throws XmlPullParserException, IOException {
        String restoreID=parser.nextText().trim();
        restoreIDWrapper[0]=restoreID;
        return restoreID;
      }
    }
;
  }
  return null;
}

Fixed version (ground truth):
public TransactionParser getParser(String name,String namespace,KXmlParser parser){
  if (name.toLowerCase().equals("String_Node_Str")) {
    return new CaseXmlParser(parser,caseTallies,!noPartial);
  }
 else   if (name.toLowerCase().equals("String_Node_Str")) {
    return new UserXmlParser(parser);
  }
 else   if (name.equalsIgnoreCase("String_Node_Str")) {
    return new TransactionParser<String>(parser,"String_Node_Str",null){
      public void commit(      String parsed) throws IOException {
      }
      public String parse() throws XmlPullParserException, IOException {
        String restoreID=parser.nextText().trim();
        restoreIDWrapper[0]=restoreID;
        return restoreID;
      }
    }
;
  }
  return null;
}
Program: 145045
Project: 145045
Buggy source:
protected void setProperties(){
  PropertyManager._().addRules(new JavaRosaPropertyRules());
  PropertyManager._().addRules(new CommCareProperties());
  PropertyManager._().addRules(new FormManagerProperties());
  PropertyUtils.initializeProperty("String_Node_Str",PropertyUtils.genGUID(25));
  PropertyUtils.initializeProperty(CommCareProperties.IS_FIRST_RUN,CommCareProperties.FIRST_RUN_YES);
  PropertyUtils.initializeProperty(FormManagerProperties.EXTRA_KEY_FORMAT,FormManagerProperties.EXTRA_KEY_LANGUAGE_CYCLE);
  PropertyUtils.initializeProperty(CommCareProperties.ENTRY_MODE,CommCareProperties.ENTRY_MODE_QUICK);
  PropertyManager._().setProperty(CommCareProperties.COMMCARE_VERSION,CommCareUtil.getVersion());
  PropertyUtils.initializeProperty(CommCareProperties.DEPLOYMENT_MODE,CommCareProperties.DEPLOY_DEFAULT);
}

Fixed version (ground truth):
protected void setProperties(){
  PropertyManager._().addRules(new JavaRosaPropertyRules());
  PropertyManager._().addRules(new CommCareProperties());
  PropertyManager._().addRules(new FormManagerProperties());
  PropertyUtils.initializeProperty("String_Node_Str",PropertyUtils.genGUID(25));
  PropertyUtils.initializeProperty(CommCareProperties.IS_FIRST_RUN,CommCareProperties.FIRST_RUN_YES);
  PropertyManager._().setProperty(CommCareProperties.COMMCARE_VERSION,CommCareUtil.getVersion());
  PropertyUtils.initializeProperty(CommCareProperties.DEPLOYMENT_MODE,CommCareProperties.DEPLOY_DEFAULT);
}
Program: 145046
Project: 145046
Buggy source:
private void postProfilePropertyInit(){
  PropertyUtils.initializeProperty(CommCareProperties.SEND_STYLE,CommCareProperties.SEND_STYLE_HTTP);
  PropertyUtils.initializeProperty(CommCareProperties.OTA_RESTORE_OFFLINE,"String_Node_Str");
  PropertyUtils.initializeProperty(CommCareProperties.RESTORE_TOLERANCE,CommCareProperties.REST_TOL_LOOSE);
  PropertyUtils.initializeProperty(CommCareProperties.DEMO_MODE,CommCareProperties.DEMO_ENABLED);
  PropertyUtils.initializeProperty(CommCareProperties.TETHER_MODE,CommCareProperties.TETHER_PUSH_ONLY);
}

Fixed version (ground truth):
private void postProfilePropertyInit(){
  PropertyUtils.initializeProperty(FormManagerProperties.EXTRA_KEY_FORMAT,FormManagerProperties.EXTRA_KEY_LANGUAGE_CYCLE);
  PropertyUtils.initializeProperty(CommCareProperties.ENTRY_MODE,CommCareProperties.ENTRY_MODE_QUICK);
  PropertyUtils.initializeProperty(CommCareProperties.SEND_STYLE,CommCareProperties.SEND_STYLE_HTTP);
  PropertyUtils.initializeProperty(CommCareProperties.OTA_RESTORE_OFFLINE,"String_Node_Str");
  PropertyUtils.initializeProperty(CommCareProperties.RESTORE_TOLERANCE,CommCareProperties.REST_TOL_LOOSE);
  PropertyUtils.initializeProperty(CommCareProperties.DEMO_MODE,CommCareProperties.DEMO_ENABLED);
  PropertyUtils.initializeProperty(CommCareProperties.TETHER_MODE,CommCareProperties.TETHER_PUSH_ONLY);
}
Program: 145047
Project: 145047
Buggy source:
public CaseXmlParser(KXmlParser parser,int[] tallies){
  super(parser,"String_Node_Str",null);
  this.tallies=tallies;
}

Fixed version (ground truth):
public CaseXmlParser(KXmlParser parser,int[] tallies,boolean acceptCreateOverwrites){
  super(parser,"String_Node_Str",null);
  this.tallies=tallies;
  this.acceptCreateOverwrites=acceptCreateOverwrites;
}
Program: 145049
Project: 145049
Buggy source:
public ReferralXmlParser(KXmlParser parser,String caseId,Date created){
  super(parser,"String_Node_Str",null);
  this.caseId=caseId;
  this.created=created;
}

Fixed version (ground truth):
public ReferralXmlParser(KXmlParser parser,String caseId,Date created,boolean acceptCreateOverwrites){
  super(parser,"String_Node_Str",null);
  this.caseId=caseId;
  this.created=created;
  this.acceptCreateOverwrites=acceptCreateOverwrites;
}
Program: 145051
Project: 145051
Buggy source:
/** 
 * This method is generally used to retrieve special forms for a  (select or 1select) item, e.g. "audio", "video", etc.
 * @param sel - The Item whose text you're trying to retrieve.
 * @param form - Special text form of Item you're trying to retrieve. 
 * @return Special Form Text. <code>null</code> if no text for this element exists (with the specified special form).
 * @throws RunTimeException if this method is called on an element that is NOT a QuestionDef
 * @throws IllegalArgumentException if <code>sel == null</code>
 */
public String getSpecialFormSelectItemText(Selection sel,String form){
  if (sel == null)   throw new IllegalArgumentException("String_Node_Str");
  String textID=sel.choice.getTextID();
  if (textID == null || textID.equals("String_Node_Str"))   return null;
  String returnText=getIText(textID,form);
  return substituteStringArgs(returnText);
}

Fixed version (ground truth):
/** 
 * This method is generally used to retrieve special forms for a  (select or 1select) item, e.g. "audio", "video", etc.
 * @param sel - The Item whose text you're trying to retrieve.
 * @param form - Special text form of Item you're trying to retrieve. 
 * @return Special Form Text. <code>null</code> if no text for this element exists (with the specified special form).
 * @throws RunTimeException if this method is called on an element that is NOT a QuestionDef
 * @throws IllegalArgumentException if <code>sel == null</code>
 */
public String getSpecialFormSelectItemText(Selection sel,String form){
  if (sel == null)   throw new IllegalArgumentException("String_Node_Str");
  if (sel.index == -1) {
    sel.attachChoice(this.getQuestion());
  }
  String textID=sel.choice.getTextID();
  if (textID == null || textID.equals("String_Node_Str"))   return null;
  String returnText=getIText(textID,form);
  return substituteStringArgs(returnText);
}
Program: 145052
Project: 145052
Buggy source:
/** 
 * Attempts to return the specified Item (from a select or 1select) text. Will check for text in the following order:<br/> Localized Text (long form) -> Localized Text (no special form) <br /> If no textID is available, method will return this item's labelInnerText.
 * @param sel the selection (item), if <code>null</code> will throw a IllegalArgumentException
 * @return Question Text.  <code>null</code> if no text for this element exists (after all fallbacks).
 * @throws RunTimeException if this method is called on an element that is NOT a QuestionDef
 * @throws IllegalArgumentException if Selection is <code>null</code>
 */
public String getSelectItemText(Selection sel){
  if (!(getFormElement() instanceof QuestionDef))   throw new RuntimeException("String_Node_Str");
  if (sel == null)   throw new IllegalArgumentException("String_Node_Str");
  String tid=sel.choice.getTextID();
  if (tid == null || tid == "String_Node_Str")   return substituteStringArgs(sel.choice.getLabelInnerText());
  String returnText;
  returnText=getIText(tid,"String_Node_Str");
  if (returnText == null)   returnText=getIText(tid,null);
  return substituteStringArgs(returnText);
}

Fixed version (ground truth):
/** 
 * Attempts to return the specified Item (from a select or 1select) text. Will check for text in the following order:<br/> Localized Text (long form) -> Localized Text (no special form) <br /> If no textID is available, method will return this item's labelInnerText.
 * @param sel the selection (item), if <code>null</code> will throw a IllegalArgumentException
 * @return Question Text.  <code>null</code> if no text for this element exists (after all fallbacks).
 * @throws RunTimeException if this method is called on an element that is NOT a QuestionDef
 * @throws IllegalArgumentException if Selection is <code>null</code>
 */
public String getSelectItemText(Selection sel){
  if (!(getFormElement() instanceof QuestionDef))   throw new RuntimeException("String_Node_Str");
  if (sel == null)   throw new IllegalArgumentException("String_Node_Str");
  if (sel.index == -1) {
    sel.attachChoice(this.getQuestion());
  }
  String tid=sel.choice.getTextID();
  if (tid == null || tid == "String_Node_Str")   return substituteStringArgs(sel.choice.getLabelInnerText());
  String returnText;
  returnText=getIText(tid,"String_Node_Str");
  if (returnText == null)   returnText=getIText(tid,null);
  return substituteStringArgs(returnText);
}
Program: 145053
Project: 145053
Buggy source:
public int getContentLength(){
  return getContent().length;
}

Fixed version (ground truth):
public int getContentLength(){
  if (this.getContent() != null) {
    return getContent().length;
  }
 else {
    return -1;
  }
}
Program: 145055
Project: 145055
Buggy source:
public void fetchList(){
  SimpleHttpTransportMessage message=new SimpleHttpTransportMessage(getListUrl + credentials);
  try {
    thread=TransportService.send(message,1,0);
    thread.addListener(this);
  }
 catch (  TransportException e) {
    fail("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
public void fetchList(){
  SimpleHttpTransportMessage message=new SimpleHttpTransportMessage(getListUrl);
  try {
    thread=TransportService.send(message,1,0);
    thread.addListener(this);
  }
 catch (  TransportException e) {
    fail("String_Node_Str" + e.getMessage());
  }
}
Program: 145056
Project: 145056
Buggy source:
public boolean markSupported(){
  return is.markSupported();
}

Fixed version (ground truth):
public boolean markSupported(){
  System.err.println("String_Node_Str");
  return is.markSupported();
}
Program: 145057
Project: 145057
Buggy source:
public int available() throws IOException {
  return is.available();
}

Fixed version (ground truth):
public int available() throws IOException {
  System.err.println("String_Node_Str");
  return is.available();
}
Program: 145058
Project: 145058
Buggy source:
public int read(byte[] b,int off,int len) throws IOException {
  try {
    int k=is.read(b,off,len);
    read+=k;
    return k;
  }
 catch (  IOException ioe) {
    log(true);
    throw ioe;
  }
}

Fixed version (ground truth):
public int read(byte[] b,int off,int len) throws IOException {
  try {
    int k=is.read(b,off,len);
    read+=Math.max(k,0);
    return k;
  }
 catch (  IOException ioe) {
    log(true);
    throw ioe;
  }
}
Program: 145059
Project: 145059
Buggy source:
public void reset() throws IOException {
  is.reset();
}

Fixed version (ground truth):
public void reset() throws IOException {
  System.err.println("String_Node_Str");
  is.reset();
}
Program: 145060
Project: 145060
Buggy source:
public void mark(int rl){
  is.mark(rl);
}

Fixed version (ground truth):
public void mark(int rl){
  System.err.println("String_Node_Str");
  is.mark(rl);
}
Program: 145061
Project: 145061
Buggy source:
public void setHttpConnectionMethod(String method){
  if (HttpConnection.GET.equals(method)) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void setHttpConnectionMethod(String method){
  if (HttpConnection.GET.equals(method)) {
    throw new RuntimeException("String_Node_Str");
  }
  super.setHttpConnectionMethod(method);
}
Program: 145062
Project: 145062
Buggy source:
public void setCacheable(boolean cacheable){
  if (cacheable) {
    throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void setCacheable(boolean cacheable){
  if (cacheable) {
    throw new RuntimeException("String_Node_Str");
  }
  super.setCacheable(cacheable);
}
Program: 145063
Project: 145063
Buggy source:
public void start(){
  if (reportFormat == LogReportUtils.REPORT_FORMAT_SKIP) {
    if (Logger.isLoggingEnabled()) {
      determineLogFallback(LOG_ROLLOVER_SIZE);
    }
    done();
    return;
  }
  try {
    TransportMessage message=new StreamingHTTPMessage(getDestURL()){
      public void writeBody(      OutputStream os) throws IOException {
        KXmlSerializer serializer=new KXmlSerializer();
        serializer.setOutput(os,"String_Node_Str");
        createReport(serializer);
      }
    }
;
    Logger.log("String_Node_Str","String_Node_Str");
    SenderThread s=TransportService.send(message);
    if (message.isCacheable()) {
      onSuccess();
    }
    s.addListener(this);
  }
 catch (  Exception e) {
    e.printStackTrace();
    dumpLogFallback();
  }
  done();
}

Fixed version (ground truth):
public void start(){
  if (reportFormat == LogReportUtils.REPORT_FORMAT_SKIP) {
    if (Logger.isLoggingEnabled()) {
      determineLogFallback(LOG_ROLLOVER_SIZE);
    }
    done();
    return;
  }
  try {
    TransportMessage message=new StreamingHTTPMessage(getDestURL()){
      public void writeBody(      OutputStream os) throws IOException {
        KXmlSerializer serializer=new KXmlSerializer();
        serializer.setOutput(os,"String_Node_Str");
        createReport(serializer);
      }
    }
;
    Logger.log("String_Node_Str","String_Node_Str");
    SenderThread s=TransportService.send(message);
    if (message.isCacheable()) {
      onSuccess();
    }
    s.addListener(this);
  }
 catch (  Exception e) {
    e.printStackTrace();
    dumpLogFallback();
    Logger.exception("String_Node_Str",e);
  }
  done();
}
Program: 145064
Project: 145064
Buggy source:
/** 
 * Add a Condition to the form's Collection.
 * @param condition the condition to be set
 */
public Triggerable addTriggerable(Triggerable t){
  int existingIx=triggerables.indexOf(t);
  if (existingIx >= 0) {
    return (Triggerable)triggerables.elementAt(existingIx);
  }
 else {
    triggerables.addElement(t);
    triggerablesInOrder=false;
    Vector triggers=t.getTriggers();
    for (int i=0; i < triggers.size(); i++) {
      TreeReference trigger=(TreeReference)triggers.elementAt(i);
      if (!triggerIndex.containsKey(trigger)) {
        triggerIndex.put(trigger,new Vector());
      }
      Vector triggered=(Vector)triggerIndex.get(trigger);
      if (!triggered.contains(t)) {
        triggered.addElement(t);
      }
    }
    if (t instanceof Condition) {
      Vector targets=t.getTargets();
      for (int i=0; i < targets.size(); i++) {
        TreeReference target=(TreeReference)targets.elementAt(i);
        if (instance.getTemplate(target) != null) {
          conditionRepeatTargetIndex.put(target,(Condition)t);
        }
      }
    }
    return t;
  }
}

Fixed version (ground truth):
/** 
 * Add a Condition to the form's Collection.
 * @param condition the condition to be set
 */
public Triggerable addTriggerable(Triggerable t){
  int existingIx=triggerables.indexOf(t);
  if (existingIx >= 0) {
    return (Triggerable)triggerables.elementAt(existingIx);
  }
 else {
    triggerables.addElement(t);
    triggerablesInOrder=false;
    Vector triggers=t.getTriggers();
    for (int i=0; i < triggers.size(); i++) {
      TreeReference trigger=(TreeReference)triggers.elementAt(i);
      if (!triggerIndex.containsKey(trigger)) {
        triggerIndex.put(trigger,new Vector());
      }
      Vector triggered=(Vector)triggerIndex.get(trigger);
      if (!triggered.contains(t)) {
        triggered.addElement(t);
      }
    }
    return t;
  }
}
Program: 145066
Project: 145066
Buggy source:
/** 
 */
public FormDef(){
  setID(-1);
  setChildren(null);
  triggerables=new Vector();
  triggerablesInOrder=true;
  triggerIndex=new Hashtable();
  conditionRepeatTargetIndex=new Hashtable();
  setEvaluationContext(new EvaluationContext());
  outputFragments=new Vector();
}

Fixed version (ground truth):
/** 
 */
public FormDef(){
  setID(-1);
  setChildren(null);
  triggerables=new Vector();
  triggerablesInOrder=true;
  triggerIndex=new Hashtable();
  setEvaluationContext(new EvaluationContext());
  outputFragments=new Vector();
}
Program: 145067
Project: 145067
Buggy source:
private static void parseInstance(FormDef f,Element e){
  TreeElement root=buildInstanceStructure(e,null);
  FormInstance instanceModel=new FormInstance(root);
  instanceModel.setName(f.getTitle());
  Vector usedAtts=new Vector();
  usedAtts.addElement("String_Node_Str");
  usedAtts.addElement("String_Node_Str");
  String schema=e.getNamespace();
  if (schema != null && schema.length() > 0 && !schema.equals(defaultNamespace)) {
    instanceModel.schema=schema;
  }
  instanceModel.formVersion=e.getAttributeValue(null,"String_Node_Str");
  instanceModel.uiVersion=e.getAttributeValue(null,"String_Node_Str");
  loadNamespaces(e,instanceModel);
  processRepeats(instanceModel);
  verifyBindings(f,instanceModel);
  applyInstanceProperties(instanceModel);
  loadInstanceData(e,root,f);
  checkDependencyCycles(f);
  f.finalizeTriggerables();
  f.setInstance(instanceModel);
  if (XFormUtils.showUnusedAttributeWarning(e,usedAtts)) {
    System.out.println(XFormUtils.unusedAttWarning(e,usedAtts));
  }
}

Fixed version (ground truth):
private static void parseInstance(FormDef f,Element e){
  TreeElement root=buildInstanceStructure(e,null);
  FormInstance instanceModel=new FormInstance(root);
  instanceModel.setName(f.getTitle());
  Vector usedAtts=new Vector();
  usedAtts.addElement("String_Node_Str");
  usedAtts.addElement("String_Node_Str");
  String schema=e.getNamespace();
  if (schema != null && schema.length() > 0 && !schema.equals(defaultNamespace)) {
    instanceModel.schema=schema;
  }
  instanceModel.formVersion=e.getAttributeValue(null,"String_Node_Str");
  instanceModel.uiVersion=e.getAttributeValue(null,"String_Node_Str");
  loadNamespaces(e,instanceModel);
  processRepeats(instanceModel);
  verifyBindings(f,instanceModel);
  applyInstanceProperties(instanceModel);
  loadInstanceData(e,root,f);
  checkDependencyCycles(f);
  f.setInstance(instanceModel);
  f.finalizeTriggerables();
  if (XFormUtils.showUnusedAttributeWarning(e,usedAtts)) {
    System.out.println(XFormUtils.unusedAttWarning(e,usedAtts));
  }
}
Program: 145068
Project: 145068
Buggy source:
public void start(){
  view=new CommCareSuiteView(m.getName().evaluate());
  view.setCommandListener(this);
  configView();
  J2MEDisplay.setView(view);
}

Fixed version (ground truth):
public void start(){
  view=new CommCareSuiteView(m.getName().evaluate());
  view.setCommandListener(this);
  J2MEDisplay.setView(view);
}
Program: 145069
Project: 145069
Buggy source:
public CommCareConfigEngine(OutputStream output){
  this.output=output;
  this.print=new PrintStream(output);
  suites=new Vector<Suite>();
  this.instance=new CommCareInstance(){
    public void registerSuite(    Suite s){
      CommCareConfigEngine.this.suites.add(s);
    }
    public void setProfile(    Profile p){
      CommCareConfigEngine.this.profile=p;
    }
    public int getMajorVersion(){
      return 1;
    }
    public int getMinorVersion(){
      return 1;
    }
    public int getMajorVersion(){
      return 1;
    }
    public int getMinorVersion(){
      return 0;
    }
  }
;
  setRoots();
  table=ResourceTable.RetrieveTable(new DummyIndexedStorageUtility());
  StorageManager.setStorageFactory(new IStorageFactory(){
    public IStorageUtility newStorage(    String name,    Class type){
      return new DummyIndexedStorageUtility();
    }
  }
);
  StorageManager.registerStorage(Profile.STORAGE_KEY,Profile.class);
  StorageManager.registerStorage(Suite.STORAGE_KEY,Suite.class);
  StorageManager.registerStorage(FormDef.STORAGE_KEY,Suite.class);
}

Fixed version (ground truth):
public CommCareConfigEngine(OutputStream output){
  this.output=output;
  this.print=new PrintStream(output);
  suites=new Vector<Suite>();
  this.instance=new CommCareInstance(){
    public void registerSuite(    Suite s){
      CommCareConfigEngine.this.suites.add(s);
    }
    public void setProfile(    Profile p){
      CommCareConfigEngine.this.profile=p;
    }
    public int getMajorVersion(){
      return 1;
    }
    public int getMinorVersion(){
      return 1;
    }
  }
;
  setRoots();
  table=ResourceTable.RetrieveTable(new DummyIndexedStorageUtility());
  StorageManager.setStorageFactory(new IStorageFactory(){
    public IStorageUtility newStorage(    String name,    Class type){
      return new DummyIndexedStorageUtility();
    }
  }
);
  StorageManager.registerStorage(Profile.STORAGE_KEY,Profile.class);
  StorageManager.registerStorage(Suite.STORAGE_KEY,Suite.class);
  StorageManager.registerStorage(FormDef.STORAGE_KEY,Suite.class);
}
Program: 145070
Project: 145070
Buggy source:
public int getMinorVersion(){
  return 0;
}

Fixed version (ground truth):
public int getMinorVersion(){
  return 1;
}
Program: 145071
Project: 145071
Buggy source:
/** 
 * Deletes the inner-most repeat that this node belongs to and returns the corresponding FormIndex. Behavior is currently undefined if you call this method on a node that is not contained within a repeat.
 * @param index
 * @return
 */
public FormIndex deleteRepeat(FormIndex index){
  Vector indexes=new Vector();
  Vector multiplicities=new Vector();
  Vector elements=new Vector();
  collapseIndex(index,indexes,multiplicities,elements);
  for (int i=elements.size() - 1; i >= 0; i--) {
    IFormElement e=(IFormElement)elements.elementAt(i);
    if (e instanceof GroupDef && ((GroupDef)e).getRepeat()) {
      break;
    }
 else {
      indexes.removeElementAt(i);
      multiplicities.removeElementAt(i);
      elements.removeElementAt(i);
    }
  }
  FormIndex newIndex=buildIndex(indexes,multiplicities,elements);
  TreeReference deleteRef=getChildInstanceRef(newIndex);
  TreeElement deleteElement=instance.resolveReference(deleteRef);
  TreeReference parentRef=deleteRef.getParentRef();
  TreeElement parentElement=instance.resolveReference(parentRef);
  int childMult=deleteElement.getMult();
  parentElement.removeChild(deleteElement);
  for (int i=0; i < parentElement.getNumChildren(); i++) {
    TreeElement child=parentElement.getChildAt(i);
    if (child.getMult() > childMult) {
      child.setMult(child.getMult() - 1);
    }
  }
  triggerTriggerables(parentRef);
  return newIndex;
}

Fixed version (ground truth):
/** 
 * Deletes the inner-most repeat that this node belongs to and returns the corresponding FormIndex. Behavior is currently undefined if you call this method on a node that is not contained within a repeat.
 * @param index
 * @return
 */
public FormIndex deleteRepeat(FormIndex index){
  Vector indexes=new Vector();
  Vector multiplicities=new Vector();
  Vector elements=new Vector();
  collapseIndex(index,indexes,multiplicities,elements);
  for (int i=elements.size() - 1; i >= 0; i--) {
    IFormElement e=(IFormElement)elements.elementAt(i);
    if (e instanceof GroupDef && ((GroupDef)e).getRepeat()) {
      break;
    }
 else {
      indexes.removeElementAt(i);
      multiplicities.removeElementAt(i);
      elements.removeElementAt(i);
    }
  }
  FormIndex newIndex=buildIndex(indexes,multiplicities,elements);
  TreeReference deleteRef=getChildInstanceRef(newIndex);
  TreeElement deleteElement=instance.resolveReference(deleteRef);
  TreeReference parentRef=deleteRef.getParentRef();
  TreeElement parentElement=instance.resolveReference(parentRef);
  int childMult=deleteElement.getMult();
  parentElement.removeChild(deleteElement);
  for (int i=0; i < parentElement.getNumChildren(); i++) {
    TreeElement child=parentElement.getChildAt(i);
    if (child.getMult() > childMult) {
      child.setMult(child.getMult() - 1);
    }
  }
  triggerTriggerables(deleteRef);
  return newIndex;
}
Program: 145072
Project: 145072
Buggy source:
public FormIndex descendIntoRepeat(FormIndex index,int repIndex){
  Vector indexes=new Vector();
  Vector multiplicities=new Vector();
  Vector elements=new Vector();
  if (!index.isInForm()) {
    throw new RuntimeException("String_Node_Str");
  }
  collapseIndex(index,indexes,multiplicities,elements);
  if (!(elements.lastElement() instanceof GroupDef) || !((GroupDef)elements.lastElement()).getRepeat()) {
    throw new RuntimeException("String_Node_Str");
  }
  TreeElement node=instance.resolveReference(getChildInstanceRef(elements,multiplicities));
  String name=node.getName();
  int numRepetitions=node.getParent().getChildMultiplicity(name);
  if (repIndex < 0 || repIndex >= numRepetitions) {
    throw new RuntimeException("String_Node_Str");
  }
  multiplicities.setElementAt(new Integer(repIndex),multiplicities.size() - 1);
  return buildIndex(indexes,multiplicities,elements);
}

Fixed version (ground truth):
public FormIndex descendIntoRepeat(FormIndex index,int repIndex){
  Vector indexes=new Vector();
  Vector multiplicities=new Vector();
  Vector elements=new Vector();
  if (!index.isInForm()) {
    throw new RuntimeException("String_Node_Str");
  }
  collapseIndex(index,indexes,multiplicities,elements);
  if (!(elements.lastElement() instanceof GroupDef) || !((GroupDef)elements.lastElement()).getRepeat()) {
    throw new RuntimeException("String_Node_Str");
  }
  TreeElement node=instance.resolveReference(getChildInstanceRef(elements,multiplicities));
  int numRepetitions=0;
  if (node != null) {
    String name=node.getName();
    numRepetitions=node.getParent().getChildMultiplicity(name);
  }
  if (repIndex < 0 || repIndex >= numRepetitions) {
    throw new RuntimeException("String_Node_Str");
  }
  multiplicities.setElementAt(new Integer(repIndex),multiplicities.size() - 1);
  return buildIndex(indexes,multiplicities,elements);
}
Program: 145073
Project: 145073
Buggy source:
public Vector<String> getAvailableRepetitions(FormIndex index){
  Vector indexes=new Vector();
  Vector multiplicities=new Vector();
  Vector elements=new Vector();
  collapseIndex(index,indexes,multiplicities,elements);
  TreeElement node=instance.resolveReference(getChildInstanceRef(elements,multiplicities));
  String name=node.getName();
  int numRepetitions=node.getParent().getChildMultiplicity(name);
  Vector<String> reps=new Vector<String>();
  for (int i=0; i < numRepetitions; i++) {
    reps.addElement("String_Node_Str" + (i + 1));
  }
  return reps;
}

Fixed version (ground truth):
public Vector<String> getAvailableRepetitions(FormIndex index){
  Vector indexes=new Vector();
  Vector multiplicities=new Vector();
  Vector elements=new Vector();
  collapseIndex(index,indexes,multiplicities,elements);
  TreeElement node=instance.resolveReference(getChildInstanceRef(elements,multiplicities));
  int numRepetitions=0;
  if (node != null) {
    String name=node.getName();
    numRepetitions=node.getParent().getChildMultiplicity(name);
  }
  Vector<String> reps=new Vector<String>();
  for (int i=0; i < numRepetitions; i++) {
    reps.addElement("String_Node_Str" + (i + 1));
  }
  return reps;
}
Program: 145076
Project: 145076
Buggy source:
public int add(FormIndex index){
  int i=indexOf(index,false);
  if (i != -1 && get(i) == index) {
    return -1;
  }
 else {
    v.insertElementAt(index,i + 1);
    return i + 1;
  }
}

Fixed version (ground truth):
public int add(FormIndex index){
  int i=indexOf(index,false);
  if (i != -1 && get(i).equals(index)) {
    return -1;
  }
 else {
    v.insertElementAt(index,i + 1);
    return i + 1;
  }
}
Program: 145077
Project: 145077
Buggy source:
private void createHeaderForElement(FormIndex questionIndex){
  FormEntryCaption prompt=model.getCaptionPrompt(questionIndex);
  String headerText;
  if (prompt.getAvailableTextForms().contains(FormEntryCaption.TEXT_FORM_LONG)) {
    headerText=prompt.getLongText();
  }
 else   if (prompt.getAvailableTextForms().contains(FormEntryCaption.TEXT_FORM_SHORT)) {
    headerText=prompt.getShortText();
  }
 else {
    headerText=prompt.getDefaultText();
  }
  if (headerText != null) {
    ChatterboxWidget headerWidget=widgetFactory.getNewLabelWidget(questionIndex,headerText);
    this.append(headerWidget);
    this.questionIndexes.add(questionIndex);
    headerWidget.setPinned(true);
  }
}

Fixed version (ground truth):
private void createHeaderForElement(FormIndex questionIndex,boolean newRepeat){
  FormEntryCaption prompt=model.getCaptionPrompt(questionIndex);
  String headerText;
  if (prompt.getAvailableTextForms().contains(FormEntryCaption.TEXT_FORM_LONG)) {
    headerText=prompt.getLongText();
  }
 else   if (prompt.getAvailableTextForms().contains(FormEntryCaption.TEXT_FORM_SHORT)) {
    headerText=prompt.getShortText();
  }
 else {
    headerText=prompt.getDefaultText();
  }
  if (headerText != null) {
    if (newRepeat) {
      removeFrame(activeQuestionIndex);
    }
    ChatterboxWidget headerWidget=widgetFactory.getNewLabelWidget(questionIndex,headerText);
    this.append(headerWidget);
    this.questionIndexes.add(questionIndex);
    headerWidget.setPinned(true);
  }
}