nus-yam/ex-repair huggingface dataset:
Program: 144857
Project: 144857
Buggy source:
public User getUser(){
  if (loggedInUserID != null) {
    return (User)((IStorageUtilityIndexed)StorageManager.getStorage(User.STORAGE_KEY)).getRecordForValue(User.META_UID,loggedInUserID);
  }
 else   if (loggedInUserID == User.DEMO_USER) {
    return User.FactoryDemoUser();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public User getUser(){
  if (User.DEMO_USER.equals(loggedInUserID)) {
    return User.FactoryDemoUser();
  }
 else   if (loggedInUserID != null) {
    return (User)((IStorageUtilityIndexed)StorageManager.getStorage(User.STORAGE_KEY)).getRecordForValue(User.META_UID,loggedInUserID);
  }
 else {
    return null;
  }
}
Program: 144859
Project: 144859
Buggy source:
public void purge(){
  this.purger.purge(logIDs);
}

Fixed version (ground truth):
public void purge(){
  if (purger != null) {
    this.purger.purge(logIDs);
  }
}
Program: 144860
Project: 144860
Buggy source:
public void serializeLogs(StreamLogSerializer serializer,int limit) throws IOException {
  if (storageBroken) {
    return;
  }
  ;
  int count=0;
  IStorageIterator li;
synchronized (logStorage) {
    li=logStorage.iterate();
  }
  while (li.hasMore() && count < limit) {
    int id=li.peekID();
    LogEntry log=(LogEntry)li.nextRecord();
    serializer.serializeLog(id,log);
    count++;
  }
  serializer.setPurger(new StreamLogSerializer.Purger(){
    public void purge(    SortedIntSet IDs){
      clearLogs(IDs);
    }
  }
);
}

Fixed version (ground truth):
public void serializeLogs(StreamLogSerializer serializer,int limit) throws IOException {
  if (storageBroken) {
    return;
  }
  ;
  Vector<Integer> logIds=new Vector<Integer>();
  Object lock=logStorage.getAccessLock();
synchronized (lock) {
    int count=0;
    IStorageIterator li=logStorage.iterate();
    while (li.hasMore() && count < limit) {
      int id=li.nextID();
      logIds.addElement(DataUtil.integer(id));
      count++;
    }
  }
  System.out.println("String_Node_Str" + logIds.size() + "String_Node_Str");
  for (  Integer logId : logIds) {
    LogEntry log=(LogEntry)logStorage.read(logId.intValue());
    if (log != null) {
      serializer.serializeLog(logId.intValue(),log);
    }
  }
  serializer.setPurger(new StreamLogSerializer.Purger(){
    public void purge(    SortedIntSet IDs){
      clearLogs(IDs);
    }
  }
);
}
Program: 144861
Project: 144861
Buggy source:
private void logError(Vector errors,StatusReportException sre){
  errors.addElement(new String[]{sre.getReportName(),sre.getMessage()});
}

Fixed version (ground truth):
private void logError(Vector errors,StatusReportException sre){
  if (sre.getParent() != null) {
    sre.getParent().printStackTrace();
  }
  errors.addElement(new String[]{sre.getReportName(),sre.getMessage()});
}
Program: 144862
Project: 144862
Buggy source:
protected IAnswerData getWidgetValue() throws InvalidDataException {
  String s=textField().getString();
  if (s == null || s.equals("String_Node_Str")) {
    return null;
  }
  try {
    return template.cast(new UncastData(s.trim()));
  }
 catch (  IllegalArgumentException iae) {
    String message;
    if (template instanceof LongData) {
      message=Localization.get("String_Node_Str",new String[]{s});
    }
 else     if (template instanceof IntegerData) {
      message=Localization.get("String_Node_Str",new String[]{s});
    }
 else     if (template instanceof DecimalData) {
      message=Localization.get("String_Node_Str",new String[]{s});
    }
 else {
      message=Localization.get("String_Node_Str",new String[]{s,template.getClass().getName()});
    }
    throw new InvalidDataException(message,new UncastData(s));
  }
}

Fixed version (ground truth):
protected IAnswerData getWidgetValue() throws InvalidDataException {
  String s=textField().getString().trim();
  if (s == null || s.equals("String_Node_Str")) {
    return null;
  }
  try {
    return template.cast(new UncastData(s));
  }
 catch (  IllegalArgumentException iae) {
    String message;
    if (template instanceof LongData) {
      message=Localization.get("String_Node_Str",new String[]{s});
    }
 else     if (template instanceof IntegerData) {
      message=Localization.get("String_Node_Str",new String[]{s});
    }
 else     if (template instanceof DecimalData) {
      message=Localization.get("String_Node_Str",new String[]{s});
    }
 else {
      message=Localization.get("String_Node_Str",new String[]{s,template.getClass().getName()});
    }
    throw new InvalidDataException(message,new UncastData(s));
  }
}
Program: 144863
Project: 144863
Buggy source:
protected IAnswerData getWidgetValue() throws InvalidDataException {
  String s=textField().getString();
  return (s == null || s.equals("String_Node_Str") ? null : new StringData(s.trim()));
}

Fixed version (ground truth):
protected IAnswerData getWidgetValue() throws InvalidDataException {
  String s=textField().getString().trim();
  return (s == null || s.equals("String_Node_Str") ? null : new StringData(s));
}
Program: 144865
Project: 144865
Buggy source:
private void startOtaProcess(){
  if (authenticator == null) {
    authAttempts=0;
    getCredentials();
  }
 else {
    authAttempts=1;
    listener.refreshView();
    tryDownload(AuthenticatedHttpTransportMessage.AuthenticatedHttpRequest(restoreURI,authenticator,new SecurityFailureListener(){
      public void onSecurityException(      SecurityException e){
        PeriodicEvent.schedule(new PermissionsEvent());
      }
    }
));
  }
}

Fixed version (ground truth):
private void startOtaProcess(){
  if (authenticator == null) {
    getCredentials();
  }
 else {
    listener.refreshView();
    tryDownload(AuthenticatedHttpTransportMessage.AuthenticatedHttpRequest(restoreURI,authenticator,new SecurityFailureListener(){
      public void onSecurityException(      SecurityException e){
        PeriodicEvent.schedule(new PermissionsEvent());
      }
    }
));
  }
}
Program: 144868
Project: 144868
Buggy source:
/** 
 * @return The indices of which fields should be used for sorting and their order
 */
public int[] getSortOrder(){
  Vector<Integer> indices=new Vector<Integer>();
  outer:   for (int i=0; i < fields.length; ++i) {
    int order=fields[i].getSortOrder();
    if (order < 1) {
      continue;
    }
    for (int j=0; j < indices.size(); ++j) {
      if (indices.size() > 0 || order < fields[indices.elementAt(j).intValue()].getSortOrder()) {
        indices.insertElementAt(new Integer(i),j);
        continue outer;
      }
    }
    indices.addElement(new Integer(i));
    continue;
  }
  if (indices.size() == 0) {
    return new int[]{};
  }
 else {
    int[] ret=new int[indices.size()];
    for (int i=0; i < ret.length; ++i) {
      ret[i]=indices.elementAt(i).intValue();
    }
    return ret;
  }
}

Fixed version (ground truth):
/** 
 * @return The indices of which fields should be used for sorting and their order
 */
public int[] getSortOrder(){
  Vector<Integer> indices=new Vector<Integer>();
  outer:   for (int i=0; i < fields.length; ++i) {
    int order=fields[i].getSortOrder();
    if (order < 1) {
      continue;
    }
    for (int j=0; j < indices.size(); ++j) {
      if (order < fields[indices.elementAt(j).intValue()].getSortOrder()) {
        indices.insertElementAt(new Integer(i),j);
        continue outer;
      }
    }
    indices.addElement(new Integer(i));
    continue;
  }
  if (indices.size() == 0) {
    return new int[]{};
  }
 else {
    int[] ret=new int[indices.size()];
    for (int i=0; i < ret.length; ++i) {
      ret[i]=indices.elementAt(i).intValue();
    }
    return ret;
  }
}
Program: 144869
Project: 144869
Buggy source:
public void releaseMedia(){
  detachVideo();
  detachImage();
}

Fixed version (ground truth):
public void releaseMedia(){
  detachVideo();
  detachImage();
  getMultimediaController().stopAudio();
}
Program: 144870
Project: 144870
Buggy source:
protected FormMultimediaController getMultimediaController(){
  if (this.multimediaController == null) {
    return new FormMultimediaController(){
      public void playAudioOnLoad(      FormEntryPrompt fep){
      }
      public void playAudioOnDemand(      FormEntryPrompt fep){
      }
      public int playAudioOnDemand(      FormEntryPrompt fep,      SelectChoice select){
        return 0;
      }
      public void attachVideoPlayer(      Player player){
      }
      public void detachVideoPlayer(      Player player){
      }
    }
;
  }
 else {
    return multimediaController;
  }
}

Fixed version (ground truth):
protected FormMultimediaController getMultimediaController(){
  if (this.multimediaController == null) {
    return new FormMultimediaController(){
      public void playAudioOnLoad(      FormEntryPrompt fep){
      }
      public void playAudioOnDemand(      FormEntryPrompt fep){
      }
      public int playAudioOnDemand(      FormEntryPrompt fep,      SelectChoice select){
        return 0;
      }
      public void attachVideoPlayer(      Player player){
      }
      public void detachVideoPlayer(      Player player){
      }
      public void stopAudio(){
      }
    }
;
  }
 else {
    return multimediaController;
  }
}
Program: 144871
Project: 144871
Buggy source:
public void reset(){
  detachImage();
  detachVideo();
  prompt=null;
  entryWidget=null;
}

Fixed version (ground truth):
public void reset(){
  detachImage();
  detachVideo();
  getMultimediaController().stopAudio();
  prompt=null;
  entryWidget=null;
}
Program: 144872
Project: 144872
Buggy source:
public static int playAudio(String jrRefURI){
  String curAudioURI=jrRefURI;
  int retcode=AUDIO_SUCCESS;
  try {
    Reference curAudRef=ReferenceManager._().DeriveReference(curAudioURI);
    String format=getFileFormat(curAudioURI);
    if (format == null)     return AUDIO_NOT_RECOGNIZED;
    if (audioPlayer != null) {
      audioPlayer.deallocate();
      audioPlayer.close();
    }
    audioPlayer=MediaUtils.getPlayerLoose(curAudRef);
    audioPlayer.realize();
    crankAudio(audioPlayer);
    audioPlayer.start();
  }
 catch (  InvalidReferenceException ire) {
    retcode=AUDIO_ERROR;
    System.err.println("String_Node_Str" + curAudioURI + "String_Node_Str"+ ire.getMessage());
  }
catch (  IOException ioe) {
    retcode=AUDIO_ERROR;
    System.err.println("String_Node_Str" + curAudioURI + "String_Node_Str"+ ioe.getMessage());
  }
catch (  MediaException e) {
    retcode=AUDIO_ERROR;
    System.err.println("String_Node_Str" + curAudioURI + "String_Node_Str"+ e.getMessage());
  }
catch (  SecurityException e) {
  }
  return retcode;
}

Fixed version (ground truth):
public static int playAudio(String jrRefURI){
synchronized (audioLock) {
    String curAudioURI=jrRefURI;
    int retcode=AUDIO_SUCCESS;
    try {
      Reference curAudRef=ReferenceManager._().DeriveReference(curAudioURI);
      String format=getFileFormat(curAudioURI);
      if (format == null)       return AUDIO_NOT_RECOGNIZED;
      if (audioPlayer != null) {
        audioPlayer.deallocate();
        audioPlayer.close();
      }
      audioPlayer=MediaUtils.getPlayerLoose(curAudRef);
      audioPlayer.realize();
      crankAudio(audioPlayer);
      audioPlayer.start();
    }
 catch (    InvalidReferenceException ire) {
      retcode=AUDIO_ERROR;
      System.err.println("String_Node_Str" + curAudioURI + "String_Node_Str"+ ire.getMessage());
    }
catch (    IOException ioe) {
      retcode=AUDIO_ERROR;
      System.err.println("String_Node_Str" + curAudioURI + "String_Node_Str"+ ioe.getMessage());
    }
catch (    MediaException e) {
      retcode=AUDIO_ERROR;
      System.err.println("String_Node_Str" + curAudioURI + "String_Node_Str"+ e.getMessage());
    }
catch (    SecurityException e) {
    }
    return retcode;
  }
}
Program: 144873
Project: 144873
Buggy source:
public void refreshView(){
  if (model.getEvent() == FormEntryController.EVENT_QUESTION) {
    FormEntryPrompt prompt=model.getQuestionPrompt();
    SingleQuestionScreen last=currentQuestionScreen;
    SingleQuestionScreen view=getView(prompt,this.goingForward);
    if (last != null && last != currentQuestionScreen) {
      last.releaseMedia();
    }
    J2MEDisplay.setView(view);
    view.showNotify();
  }
 else   if (model.getEvent() == FormEntryController.EVENT_PROMPT_NEW_REPEAT) {
    FormEntryCaption[] hierachy=model.getCaptionHierarchy(model.getFormIndex());
    repeatScreen=new NewRepeatScreen("String_Node_Str" + (model.getFormIndex().getElementMultiplicity() == 0 ? "String_Node_Str" : "String_Node_Str") + hierachy[hierachy.length - 1].getLongText()+ "String_Node_Str");
    repeatScreen.setCommandListener(this);
    if (currentQuestionScreen != null) {
      currentQuestionScreen.releaseMedia();
    }
    J2MEDisplay.setView(repeatScreen);
  }
}

Fixed version (ground truth):
public void refreshView(){
  if (model.getEvent() == FormEntryController.EVENT_QUESTION) {
    FormEntryPrompt prompt=model.getQuestionPrompt();
    SingleQuestionScreen last=currentQuestionScreen;
    if (last != null) {
      last.releaseMedia();
    }
    SingleQuestionScreen view=getView(prompt,this.goingForward);
    J2MEDisplay.setView(view);
    view.showNotify();
  }
 else   if (model.getEvent() == FormEntryController.EVENT_PROMPT_NEW_REPEAT) {
    FormEntryCaption[] hierachy=model.getCaptionHierarchy(model.getFormIndex());
    repeatScreen=new NewRepeatScreen("String_Node_Str" + (model.getFormIndex().getElementMultiplicity() == 0 ? "String_Node_Str" : "String_Node_Str") + hierachy[hierachy.length - 1].getLongText()+ "String_Node_Str");
    repeatScreen.setCommandListener(this);
    if (currentQuestionScreen != null) {
      currentQuestionScreen.releaseMedia();
    }
    J2MEDisplay.setView(repeatScreen);
  }
}
Program: 144874
Project: 144874
Buggy source:
public void releaseMedia(){
  detachVideo();
  detachImage();
  getMultimediaController().stopAudio();
}

Fixed version (ground truth):
public void releaseMedia(){
  detachVideo();
  detachImage();
  if (mediaAttached) {
    getMultimediaController().stopAudio();
    mediaAttached=false;
  }
}
Program: 144875
Project: 144875
Buggy source:
public void refreshWidget(FormEntryPrompt fep,int changeFlags){
  if (changeFlags == FormElementStateListener.CHANGE_INIT) {
    ImageItem newImItem=ExpandedWidget.getImageItem(fep,scrHeight / 2,scrWidth - 16);
    if (newImItem != null) {
      detachImage();
      fullPrompt.add(newImItem);
      imItem=newImItem;
    }
    VideoItem newVItem=ExpandedWidget.getVideoItem(fep);
    if (newVItem != null) {
      detachVideo();
      getMultimediaController().attachVideoPlayer(newVItem.getPlayer());
      fullPrompt.add(newVItem);
      vItem=newVItem;
    }
    getMultimediaController().playAudioOnLoad(fep);
  }
  prompt.setText(fep.getLongText());
  updateWidget(fep);
  IAnswerData data=fep.getAnswerValue();
  if (data != null && changeFlags == FormElementStateListener.CHANGE_INIT) {
    setWidgetValue(cast(data).getValue());
  }
}

Fixed version (ground truth):
public void refreshWidget(FormEntryPrompt fep,int changeFlags){
  if (changeFlags == FormElementStateListener.CHANGE_INIT) {
    ImageItem newImItem=ExpandedWidget.getImageItem(fep,scrHeight / 2,scrWidth - 16);
    if (newImItem != null) {
      detachImage();
      fullPrompt.add(newImItem);
      imItem=newImItem;
    }
    VideoItem newVItem=ExpandedWidget.getVideoItem(fep);
    if (newVItem != null) {
      detachVideo();
      getMultimediaController().attachVideoPlayer(newVItem.getPlayer());
      fullPrompt.add(newVItem);
      vItem=newVItem;
    }
    getMultimediaController().playAudioOnLoad(fep);
    mediaAttached=true;
  }
  prompt.setText(fep.getLongText());
  updateWidget(fep);
  IAnswerData data=fep.getAnswerValue();
  if (data != null && changeFlags == FormElementStateListener.CHANGE_INIT) {
    setWidgetValue(cast(data).getValue());
  }
}
Program: 144876
Project: 144876
Buggy source:
public void reset(){
  detachImage();
  detachVideo();
  getMultimediaController().stopAudio();
  prompt=null;
  entryWidget=null;
}

Fixed version (ground truth):
public void reset(){
  releaseMedia();
  prompt=null;
  entryWidget=null;
}
Program: 144877
Project: 144877
Buggy source:
public TreeReference contextualize(TreeReference contextRef){
  if (!contextRef.isAbsolute()) {
    return null;
  }
  TreeReference newRef=anchor(contextRef);
  newRef.setContext(contextRef.getContext());
  for (int i=0; i < contextRef.size() && i < newRef.size(); i++) {
    if (TreeReference.NAME_WILDCARD.equals(newRef.getName(i)) && !TreeReference.NAME_WILDCARD.equals(contextRef.getName(i))) {
      newRef.data.setElementAt(newRef.data.elementAt(i).setName(contextRef.getName(i)),i);
    }
    if (contextRef.getName(i).equals(newRef.getName(i))) {
      if (newRef.getPredicate(i) == null) {
        newRef.setMultiplicity(i,contextRef.getMultiplicity(i));
      }
    }
 else {
      break;
    }
  }
  return newRef;
}

Fixed version (ground truth):
public TreeReference contextualize(TreeReference contextRef){
  if (!contextRef.isAbsolute()) {
    return null;
  }
  if (this.isAbsolute()) {
    if (this.getInstanceName() == null) {
      if (contextRef.getInstanceName() != null) {
        return this.clone();
      }
    }
 else     if (!this.getInstanceName().equals(contextRef.getInstanceName())) {
      return this.clone();
    }
  }
  TreeReference newRef=anchor(contextRef);
  newRef.setContext(contextRef.getContext());
  for (int i=0; i < contextRef.size() && i < newRef.size(); i++) {
    if (TreeReference.NAME_WILDCARD.equals(newRef.getName(i)) && !TreeReference.NAME_WILDCARD.equals(contextRef.getName(i))) {
      newRef.data.setElementAt(newRef.data.elementAt(i).setName(contextRef.getName(i)),i);
    }
    if (contextRef.getName(i).equals(newRef.getName(i))) {
      if (newRef.getPredicate(i) == null) {
        newRef.setMultiplicity(i,contextRef.getMultiplicity(i));
      }
    }
 else {
      break;
    }
  }
  return newRef;
}
Program: 144878
Project: 144878
Buggy source:
public void contextualization(){
  TreeReference abc=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference ab=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference ac=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference floatc=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference floatc2=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference backc=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference testabc=floatc.contextualize(ab);
  TreeReference testabc2=floatc2.contextualize(ab);
  TreeReference testac=backc.contextualize(ab);
  TreeReference invalid=floatc.contextualize(floatc2);
  if (!abc.equals(testabc)) {
    fail("String_Node_Str" + abc.toString(true) + "String_Node_Str"+ testabc.toString(true));
  }
  if (!abc.equals(testabc2)) {
    fail("String_Node_Str" + abc.toString(true) + "String_Node_Str"+ testabc2.toString(true));
  }
  if (!ac.equals(testac)) {
    fail("String_Node_Str" + ac.toString(true) + "String_Node_Str"+ testac.toString(true));
  }
  if (invalid != null) {
    fail("String_Node_Str" + invalid.toString(true));
  }
}

Fixed version (ground truth):
public void contextualization(){
  TreeReference abc=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference ab=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference ac=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference floatc=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference floatc2=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference backc=XPathReference.getPathExpr("String_Node_Str").getReference();
  TreeReference testabc=floatc.contextualize(ab);
  TreeReference testabc2=floatc2.contextualize(ab);
  TreeReference testac=backc.contextualize(ab);
  TreeReference invalid=floatc.contextualize(floatc2);
  if (!abc.equals(testabc)) {
    fail("String_Node_Str" + abc.toString(true) + "String_Node_Str"+ testabc.toString(true));
  }
  if (!abc.equals(testabc2)) {
    fail("String_Node_Str" + abc.toString(true) + "String_Node_Str"+ testabc2.toString(true));
  }
  if (!ac.equals(testac)) {
    fail("String_Node_Str" + ac.toString(true) + "String_Node_Str"+ testac.toString(true));
  }
  if (invalid != null) {
    fail("String_Node_Str" + invalid.toString(true));
  }
  TreeReference a2extc=a2ext.contextualize(a2);
  if (a2extc.getMultLast() == 2) {
    fail("String_Node_Str");
  }
}
Program: 144879
Project: 144879
Buggy source:
public void initStuff(){
  root=TreeReference.rootRef();
  a=root.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  b=root.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  ac=a.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  bc=b.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  acd=ac.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  ace=ac.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  dot=TreeReference.selfRef();
  dotc=dot.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
}

Fixed version (ground truth):
public void initStuff(){
  root=TreeReference.rootRef();
  a=root.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  b=root.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  ac=a.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  bc=b.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  acd=ac.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  ace=ac.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  dot=TreeReference.selfRef();
  dotc=dot.extendRef("String_Node_Str",TreeReference.DEFAULT_MUTLIPLICITY);
  a2=root.extendRef("String_Node_Str",2);
  a2ext=root.extendRef("String_Node_Str",-1);
  a2ext.setInstanceName("String_Node_Str");
}
Program: 144880
Project: 144880
Buggy source:
private InstanceInitializationFactory createIIF(){
  return new MockupProviderFactory(mockup.getInstances());
}

Fixed version (ground truth):
private InstanceInitializationFactory createIIF(){
  return new MockupProviderFactory(mockup == null ? new Hashtable() : mockup.getInstances());
}
Program: 144882
Project: 144882
Buggy source:
public int read() throws IOException {
  if (position == count) {
    fillBuffer();
  }
  if (count == -1) {
    return -1;
  }
  return buffer[position++];
}

Fixed version (ground truth):
public int read() throws IOException {
  if (position == count) {
    fillBuffer();
  }
  if (count == -1) {
    return -1;
  }
  return buffer[position++] & 0xFF;
}
Program: 144883
Project: 144883
Buggy source:
public int available() throws IOException {
  return in.available() + (count - position);
}

Fixed version (ground truth):
public int available() throws IOException {
  if (count == -1) {
    return 0;
  }
  return in.available() + (count - position);
}
Program: 144884
Project: 144884
Buggy source:
public static boolean arraysEqual(Object[] array1,Object[] array2){
  if (array1.length != array2.length) {
    return false;
  }
  boolean retVal=true;
  for (int i=0; i < array1.length; ++i) {
    if (!array1[i].equals(array2[i])) {
      retVal=false;
    }
  }
  return retVal;
}

Fixed version (ground truth):
public static boolean arraysEqual(byte[] array1,byte[] array2){
  if (array1.length != array2.length) {
    return false;
  }
  boolean retVal=true;
  for (int i=0; i < array1.length; ++i) {
    if (array1[i] != array2[i]) {
      retVal=false;
    }
  }
  return retVal;
}
Program: 144885
Project: 144885
Buggy source:
public V put(K key,V value){
  if (key == null) {
    throw new NullPointerException();
  }
  if (super.containsKey(key)) {
    int i=orderedKeys.indexOf(key);
    if (i == -1) {
      throw new IllegalStateException("String_Node_Str" + key);
    }
    orderedKeys.setElementAt(key,i);
  }
 else {
    orderedKeys.addElement(key);
  }
  return super.put(key,value);
}

Fixed version (ground truth):
public V put(K key,V value){
  if (key == null) {
    throw new NullPointerException();
  }
  V v=super.put(key,value);
  if (super.size() > orderedKeys.size()) {
    orderedKeys.addElement(key);
  }
  return v;
}
Program: 144886
Project: 144886
Buggy source:
public void clearCaches(){
}

Fixed version (ground truth):
public void clearCaches(){
  expireReferenceCache();
}
Program: 144887
Project: 144887
Buggy source:
public DataModelSerializer(OutputStream stream,InstanceInitializationFactory factory) throws IOException {
  serializer=new KXmlSerializer();
  serializer.setOutput(stream,"String_Node_Str");
  this.factory=factory;
}

Fixed version (ground truth):
public DataModelSerializer(KXmlSerializer serializer){
  this.serializer=serializer;
}
Program: 144888
Project: 144888
Buggy source:
public static void main(String[] args){
  if (args.length == 0) {
    System.out.println("String_Node_Str");
  }
  if (args.length == 1) {
    XFormPlayer xfp=new XFormPlayer(System.in,System.out);
    try {
      xfp.start(args[0]);
      Session s=xfp.environment.getSessionRecording();
    }
 catch (    FileNotFoundException e) {
      System.out.println("String_Node_Str" + args[0] + "String_Node_Str");
    }
  }
 else   if (args.length == 2) {
    XFormPlayer xfp=new XFormPlayer(System.in,System.out);
    try {
      xfp.start(args[0]);
      Session s=xfp.environment.getSessionRecording();
      xfp=new XFormPlayer(System.in,System.out);
      xfp.start(args[1],s);
    }
 catch (    FileNotFoundException e) {
      System.out.println("String_Node_Str" + args[0] + "String_Node_Str");
    }
  }
  System.exit(0);
}

Fixed version (ground truth):
public static void main(String[] args){
  if (args.length == 0) {
    System.out.println("String_Node_Str");
  }
  if (args.length == 1) {
    XFormPlayer xfp=new XFormPlayer(System.in,System.out,null);
    try {
      xfp.start(args[0]);
      Session s=xfp.environment.getSessionRecording();
    }
 catch (    FileNotFoundException e) {
      System.out.println("String_Node_Str" + args[0] + "String_Node_Str");
    }
  }
 else {
    try {
      if (args[0].equals("String_Node_Str")) {
        Mockup m=getMockup(args[1]);
        XFormPlayer xfp=new XFormPlayer(System.in,System.out,m);
        xfp.start(args[2]);
        Session s=xfp.environment.getSessionRecording();
        MockupEditor e=m.getEditor();
        e.addSession(s);
        e.commit();
        updateMockup(args[1],m);
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  System.exit(0);
}
Program: 144889
Project: 144889
Buggy source:
private InstanceInitializationFactory createIIF(){
  return null;
}

Fixed version (ground truth):
private InstanceInitializationFactory createIIF(){
  return new MockupProviderFactory(mockup.getInstances());
}
Program: 144890
Project: 144890
Buggy source:
public XFormEnvironment(FormDef form,Session session){
  this.form=form;
  this.session=session;
  recording=false;
}

Fixed version (ground truth):
public XFormEnvironment(FormDef form,Mockup mockup){
  this(form);
  this.mockup=mockup;
}
Program: 144891
Project: 144891
Buggy source:
public Object eval(Object[] args,EvaluationContext ec){
  return today;
}

Fixed version (ground truth):
public Object eval(Object[] args,EvaluationContext ec){
  if (mockup != null && mockup.getDate() != null) {
    return mockup.getDate();
  }
 else {
    return new Date();
  }
}
Program: 144892
Project: 144892
Buggy source:
public XFormPlayer(InputStream in,PrintStream out){
  this.in=in;
  this.out=out;
}

Fixed version (ground truth):
public XFormPlayer(InputStream in,PrintStream out,Mockup mockup){
  this.in=in;
  this.out=out;
  this.mockup=mockup;
}
Program: 144893
Project: 144893
Buggy source:
public void start(FormDef form){
  this.environment=new XFormEnvironment(form);
  fec=environment.setup();
  reader=new BufferedReader(new InputStreamReader(in));
  processLoop();
}

Fixed version (ground truth):
public void start(FormDef form){
  this.environment=new XFormEnvironment(form,mockup);
  fec=environment.setup();
  reader=new BufferedReader(new InputStreamReader(in));
  processLoop();
}
Program: 144894
Project: 144894
Buggy source:
public Hashtable<String,DataInstance> getInstances(){
  return instances;
}

Fixed version (ground truth):
public Hashtable<String,FormInstance> getInstances(){
  return instances;
}
Program: 144895
Project: 144895
Buggy source:
public void addSession(Session session){
  this.sessions.addElement(session);
}

Fixed version (ground truth):
public void addSession(Session s){
  m.sessions.add(s);
}
Program: 144896
Project: 144896
Buggy source:
public Mockup(){
}

Fixed version (ground truth):
public Mockup(){
  sessions=new Vector<Session>();
  instances=new Hashtable<String,FormInstance>();
}
Program: 144898
Project: 144898
Buggy source:
public UnfullfilledRequirementsException(String message,int severity,int requirement,int maR,int miR,int maA,int miA,boolean majorIsProblem){
  super(message);
  this.severity=severity;
  this.requirement=requirement;
  required=maR + "String_Node_Str" + miR;
  available=maA + "String_Node_Str" + miA;
}

Fixed version (ground truth):
public UnfullfilledRequirementsException(String message,int severity,int requirement,int maR,int miR,int maA,int miA,boolean majorIsProblem){
  super(message);
  this.severity=severity;
  this.requirement=requirement;
  required=maR + "String_Node_Str" + miR;
  available=maA + "String_Node_Str" + miA;
  this.majorIsProblem=majorIsProblem;
}
Program: 144900
Project: 144900
Buggy source:
protected void serializeLog(LogEntry log) throws IOException {
  o.startTag(ns,"String_Node_Str");
  o.attribute(null,"String_Node_Str",DateUtils.formatDateTime(log.getTime(),DateUtils.FORMAT_ISO8601));
  o.startTag(ns,"String_Node_Str");
  o.text(log.getType());
  o.endTag(ns,"String_Node_Str");
  o.startTag(ns,"String_Node_Str");
  o.text(log.getMessage());
  o.endTag(ns,"String_Node_Str");
  o.endTag(ns,"String_Node_Str");
}

Fixed version (ground truth):
protected void serializeLog(LogEntry log) throws IOException {
  o.startTag(ns,"String_Node_Str");
  try {
    o.attribute(null,"String_Node_Str",DateUtils.formatDateTime(log.getTime(),DateUtils.FORMAT_ISO8601));
    o.startTag(ns,"String_Node_Str");
    try {
      o.text(log.getType());
    }
  finally {
      o.endTag(ns,"String_Node_Str");
    }
    o.startTag(ns,"String_Node_Str");
    try {
      o.text(log.getMessage());
    }
  finally {
      o.endTag(ns,"String_Node_Str");
    }
  }
  finally {
    o.endTag(ns,"String_Node_Str");
  }
}
Program: 144901
Project: 144901
Buggy source:
private void createDeviceLogSubreport(XmlSerializer o,Vector errors) throws IOException {
  try {
    Logger.log("String_Node_Str",Logger._().logSize() + "String_Node_Str");
    o.startTag(XMLNS,"String_Node_Str");
    logSerializer=new XmlStreamLogSerializer(o,XMLNS);
    Logger._().serializeLogs(logSerializer);
    o.endTag(XMLNS,"String_Node_Str");
  }
 catch (  Exception e) {
    logError(errors,new StatusReportException(e,"String_Node_Str","String_Node_Str"));
  }
}

Fixed version (ground truth):
private void createDeviceLogSubreport(XmlSerializer o,Vector errors) throws IOException {
  Logger.log("String_Node_Str",Logger._().logSize() + "String_Node_Str");
  o.startTag(XMLNS,"String_Node_Str");
  try {
    logSerializer=new XmlStreamLogSerializer(o,XMLNS);
    Logger._().serializeLogs(logSerializer);
  }
 catch (  Exception e) {
    logError(errors,new StatusReportException(e,"String_Node_Str","String_Node_Str"));
  }
 finally {
    o.endTag(XMLNS,"String_Node_Str");
  }
}
Program: 144902
Project: 144902
Buggy source:
private void createTransportSubreport(XmlSerializer o,Vector errors) throws IOException {
  try {
    o.startTag(XMLNS,"String_Node_Str");
    o.startTag(XMLNS,"String_Node_Str");
    o.text(String.valueOf(TransportService.getCachedMessagesSize()));
    o.endTag(XMLNS,"String_Node_Str");
    o.endTag(XMLNS,"String_Node_Str");
  }
 catch (  Exception e) {
    logError(errors,new StatusReportException(e,"String_Node_Str","String_Node_Str"));
  }
}

Fixed version (ground truth):
private void createTransportSubreport(XmlSerializer o,Vector errors) throws IOException {
  o.startTag(XMLNS,"String_Node_Str");
  o.startTag(XMLNS,"String_Node_Str");
  try {
    o.text(String.valueOf(TransportService.getCachedMessagesSize()));
  }
 catch (  Exception e) {
    logError(errors,new StatusReportException(e,"String_Node_Str","String_Node_Str"));
  }
 finally {
    o.endTag(XMLNS,"String_Node_Str");
    o.endTag(XMLNS,"String_Node_Str");
  }
}
Program: 144903
Project: 144903
Buggy source:
public Object getValue(){
  return gp;
}

Fixed version (ground truth):
public double[] getValue(){
  return gp;
}
Program: 144904
Project: 144904
Buggy source:
public static XPathPathExpr getPathExpr(String nodeset){
  XPathExpression path;
  boolean validNonPathExpr=false;
  try {
    path=XPathParseTool.parseXPath(nodeset);
    if (!(path instanceof XPathPathExpr)) {
      validNonPathExpr=true;
      throw new XPathSyntaxException();
    }
  }
 catch (  XPathSyntaxException xse) {
    if (validNonPathExpr) {
      throw new RuntimeException("String_Node_Str" + nodeset + "String_Node_Str");
    }
 else {
      throw new RuntimeException("String_Node_Str" + nodeset + "String_Node_Str");
    }
  }
  return (XPathPathExpr)path;
}

Fixed version (ground truth):
public static XPathPathExpr getPathExpr(String nodeset){
  XPathExpression path;
  boolean validNonPathExpr=false;
  try {
    path=XPathParseTool.parseXPath(nodeset);
    if (!(path instanceof XPathPathExpr)) {
      validNonPathExpr=true;
      throw new XPathSyntaxException();
    }
  }
 catch (  XPathSyntaxException xse) {
    if (validNonPathExpr) {
      throw new RuntimeException("String_Node_Str" + nodeset + "String_Node_Str"+ xse.getMessage());
    }
 else {
      xse.printStackTrace();
      throw new RuntimeException("String_Node_Str" + nodeset + "String_Node_Str"+ (xse.getMessage() == null ? "String_Node_Str" : "String_Node_Str" + xse.getMessage()));
    }
  }
  return (XPathPathExpr)path;
}
Program: 144905
Project: 144905
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 {
      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;
}

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());
        }
 else         if (b instanceof Long) {
          val=new Double(((Long)b).doubleValue());
        }
 else         if (b instanceof Float) {
          val=new Double(((Float)b).doubleValue());
        }
 else         if (b instanceof Short) {
          val=new Double(((Short)b).shortValue());
        }
 else         if (b instanceof Byte) {
          val=new Double(((Byte)b).byteValue());
        }
 else {
          if (b instanceof String) {
            try {
              val=(Double)new DecimalData().cast(new UncastData((String)b)).getValue();
            }
 catch (            Exception e) {
              throw new UnpivotableExpressionException("String_Node_Str" + b);
            }
          }
 else {
            throw new UnpivotableExpressionException("String_Node_Str" + b);
          }
        }
      }
      pivots.addElement(new CmpPivot(val.doubleValue(),op));
      return true;
    }
  }
  return false;
}
Program: 144906
Project: 144906
Buggy source:
public Object pivot(DataInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  Object aval=a.pivot(model,evalContext,pivots,sentinal);
  Object bval=b.pivot(model,evalContext,pivots,sentinal);
  if (handled(aval,bval,sentinal,pivots) || handled(bval,aval,sentinal,pivots)) {
    return null;
  }
  return this.eval(model,evalContext);
}

Fixed version (ground truth):
public Object pivot(DataInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  Object aval=a.pivot(model,evalContext,pivots,sentinal);
  Object bval=b.pivot(model,evalContext,pivots,sentinal);
  if (bval instanceof XPathNodeset) {
    bval=((XPathNodeset)bval).unpack();
  }
  if (handled(aval,bval,sentinal,pivots) || handled(bval,aval,sentinal,pivots)) {
    return null;
  }
  return this.eval(model,evalContext);
}
Program: 144907
Project: 144907
Buggy source:
public Object pivot(DataInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  TreeReference ref=this.getReference();
  if (ref.equals(sentinal) || (ref.getRefLevel() == 0)) {
    return sentinal;
  }
 else {
    return this.eval(model,evalContext);
  }
}

Fixed version (ground truth):
public Object pivot(DataInstance model,EvaluationContext evalContext,Vector<Object> pivots,Object sentinal) throws UnpivotableExpressionException {
  TreeReference ref=this.getReference();
  if (ref.equals(sentinal) || (ref.getRefLevel() == 0)) {
    return sentinal;
  }
 else {
    for (int i=0; i < ref.size(); ++i) {
      if (ref.getPredicate(i) != null && ref.getPredicate(i).size() > 0) {
        throw new UnpivotableExpressionException("String_Node_Str" + ref.toString(true) + "String_Node_Str");
      }
    }
    return this.eval(model,evalContext);
  }
}
Program: 144909
Project: 144909
Buggy source:
private static void parseBalanced(ASTNode node,SubNodeFactory snf,int lToken,int rToken) throws XPathSyntaxException {
  if (node instanceof ASTNodeAbstractExpr) {
    ASTNodeAbstractExpr absNode=(ASTNodeAbstractExpr)node;
    int i=0;
    while (i < absNode.content.size()) {
      int type=absNode.getTokenType(i);
      if (type == rToken) {
        throw new XPathSyntaxException();
      }
 else       if (type == lToken) {
        int j=absNode.indexOfBalanced(i,rToken,lToken,rToken);
        if (j == -1) {
          throw new XPathSyntaxException();
        }
        absNode.condense(snf.newNode(absNode.extract(i + 1,j)),i,j + 1);
      }
      i++;
    }
  }
  for (Enumeration e=node.getChildren().elements(); e.hasMoreElements(); ) {
    parseBalanced((ASTNode)e.nextElement(),snf,lToken,rToken);
  }
}

Fixed version (ground truth):
private static void parseBalanced(ASTNode node,SubNodeFactory snf,int lToken,int rToken) throws XPathSyntaxException {
  if (node instanceof ASTNodeAbstractExpr) {
    ASTNodeAbstractExpr absNode=(ASTNodeAbstractExpr)node;
    int i=0;
    while (i < absNode.content.size()) {
      int type=absNode.getTokenType(i);
      if (type == rToken) {
        throw new XPathSyntaxException("String_Node_Str");
      }
 else       if (type == lToken) {
        int j=absNode.indexOfBalanced(i,rToken,lToken,rToken);
        if (j == -1) {
          throw new XPathSyntaxException();
        }
        absNode.condense(snf.newNode(absNode.extract(i + 1,j)),i,j + 1);
      }
      i++;
    }
  }
  for (Enumeration e=node.getChildren().elements(); e.hasMoreElements(); ) {
    parseBalanced((ASTNode)e.nextElement(),snf,lToken,rToken);
  }
}
Program: 144911
Project: 144911
Buggy source:
private void commitAndSave(){
  ChatterboxWidget frame=(activeIsInterstitial ? null : activeFrame());
  if (frame != null) {
    controller.answerQuestion(this.model.getFormIndex(),frame.getData());
  }
  controller.saveAndExit(true);
}

Fixed version (ground truth):
private void commitAndSave(){
  ChatterboxWidget frame=(activeIsInterstitial ? null : activeFrame());
  if (frame != null) {
    try {
      controller.answerQuestion(this.model.getFormIndex(),frame.getData());
    }
 catch (    InvalidDataException ide) {
    }
  }
  controller.saveAndExit(true);
}
Program: 144912
Project: 144912
Buggy source:
public IAnswerData getData(){
  if (viewState == VIEW_EXPANDED) {
    return expandedStyle.getData();
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}

Fixed version (ground truth):
public IAnswerData getData() throws InvalidDataException {
  if (viewState == VIEW_EXPANDED) {
    return expandedStyle.getData();
  }
 else {
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 144913
Project: 144913
Buggy source:
public boolean canCreateRepeat(TreeReference repeatRef,FormIndex repeatIndex){
  GroupDef repeat=(GroupDef)this.getChild(repeatIndex);
  if (repeat.noAddRemove) {
    if (repeat.getCountReference() != null) {
      int currentMultiplicity=repeatIndex.getElementMultiplicity();
      AbstractTreeElement countNode=this.getMainInstance().resolveReference(repeat.getCountReference());
      if (countNode == null) {
        throw new RuntimeException("String_Node_Str" + repeat.getCountReference().getReference().toString());
      }
      long fullcount=((Integer)countNode.getValue().getValue()).intValue();
      if (fullcount <= currentMultiplicity) {
        return false;
      }
    }
 else {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean canCreateRepeat(TreeReference repeatRef,FormIndex repeatIndex){
  GroupDef repeat=(GroupDef)this.getChild(repeatIndex);
  if (repeat.noAddRemove) {
    if (repeat.getCountReference() != null) {
      int currentMultiplicity=repeatIndex.getElementMultiplicity();
      AbstractTreeElement countNode=this.getMainInstance().resolveReference(repeat.getCountReference());
      if (countNode == null) {
        throw new RuntimeException("String_Node_Str" + repeat.getCountReference().getReference().toString());
      }
      IAnswerData count=countNode.getValue();
      long fullcount=count == null ? 0 : ((Integer)count.getValue()).intValue();
      if (fullcount <= currentMultiplicity) {
        return false;
      }
    }
 else {
      return false;
    }
  }
  return true;
}
Program: 144914
Project: 144914
Buggy source:
/** 
 * Writes the form definition object to the supplied stream.
 * @param dos - the stream to write to.
 * @throws IOException
 */
public void writeExternal(DataOutputStream dos) throws IOException {
  ExtUtil.writeNumeric(dos,getID());
  ExtUtil.writeString(dos,ExtUtil.emptyIfNull(getName()));
  ExtUtil.write(dos,new ExtWrapNullable(getTitle()));
  ExtUtil.write(dos,new ExtWrapListPoly(getChildren()));
  ExtUtil.write(dos,getMainInstance());
  ExtUtil.write(dos,new ExtWrapNullable(localizer));
  Vector conditions=new Vector();
  Vector recalcs=new Vector();
  for (int i=0; i < triggerables.size(); i++) {
    Triggerable t=(Triggerable)triggerables.elementAt(i);
    if (t instanceof Condition) {
      conditions.addElement(t);
    }
 else     if (t instanceof Recalculate) {
      recalcs.addElement(t);
    }
  }
  ExtUtil.write(dos,new ExtWrapList(conditions));
  ExtUtil.write(dos,new ExtWrapList(recalcs));
  ExtUtil.write(dos,new ExtWrapListPoly(outputFragments));
  ExtUtil.write(dos,new ExtWrapMap(submissionProfiles));
  ExtUtil.write(dos,new ExtWrapMap(formInstances,new ExtWrapTagged()));
  ExtUtil.write(dos,new ExtWrapMap(eventListeners,new ExtWrapListPoly()));
}

Fixed version (ground truth):
/** 
 * Writes the form definition object to the supplied stream.
 * @param dos - the stream to write to.
 * @throws IOException
 */
public void writeExternal(DataOutputStream dos) throws IOException {
  ExtUtil.writeNumeric(dos,getID());
  ExtUtil.writeString(dos,ExtUtil.emptyIfNull(getName()));
  ExtUtil.write(dos,new ExtWrapNullable(getTitle()));
  ExtUtil.write(dos,new ExtWrapListPoly(getChildren()));
  ExtUtil.write(dos,getMainInstance());
  ExtUtil.write(dos,new ExtWrapNullable(localizer));
  Vector conditions=new Vector();
  Vector recalcs=new Vector();
  for (int i=0; i < triggerables.size(); i++) {
    Triggerable t=(Triggerable)triggerables.elementAt(i);
    if (t instanceof Condition) {
      conditions.addElement(t);
    }
 else     if (t instanceof Recalculate) {
      recalcs.addElement(t);
    }
  }
  ExtUtil.write(dos,new ExtWrapList(conditions));
  ExtUtil.write(dos,new ExtWrapList(recalcs));
  ExtUtil.write(dos,new ExtWrapListPoly(outputFragments));
  ExtUtil.write(dos,new ExtWrapMap(submissionProfiles));
  ExtUtil.write(dos,new ExtWrapMap(formInstances,new ExtWrapTagged()));
  ExtUtil.write(dos,new ExtWrapMap(eventListeners,new ExtWrapListPoly()));
  ExtUtil.write(dos,new ExtWrapListPoly(extensions));
}
Program: 144916
Project: 144916
Buggy source:
/** 
 */
public FormDef(){
  setID(-1);
  setChildren(null);
  triggerables=new Vector();
  triggerablesInOrder=true;
  triggerIndex=new Hashtable();
  setEvaluationContext(new EvaluationContext(null));
  outputFragments=new Vector();
  submissionProfiles=new Hashtable<String,SubmissionProfile>();
  formInstances=new Hashtable<String,DataInstance>();
  eventListeners=new Hashtable<String,Vector<Action>>();
}

Fixed version (ground truth):
/** 
 */
public FormDef(){
  setID(-1);
  setChildren(null);
  triggerables=new Vector();
  triggerablesInOrder=true;
  triggerIndex=new Hashtable();
  setEvaluationContext(new EvaluationContext(null));
  outputFragments=new Vector();
  submissionProfiles=new Hashtable<String,SubmissionProfile>();
  formInstances=new Hashtable<String,DataInstance>();
  eventListeners=new Hashtable<String,Vector<Action>>();
  extensions=new Vector<XFormExtension>();
}
Program: 144917
Project: 144917
Buggy source:
public TreeReference contextualize(TreeReference contextRef){
  if (!contextRef.isAbsolute()) {
    return null;
  }
  TreeReference newRef=anchor(contextRef);
  newRef.setContext(contextRef.getContext());
  for (int i=0; i < contextRef.size() && i < newRef.size(); i++) {
    if (TreeReference.NAME_WILDCARD.equals(newRef.getName(i)) && !TreeReference.NAME_WILDCARD.equals(contextRef.getName(i))) {
      data.setElementAt(data.elementAt(i).setName(contextRef.getName(i)),i);
    }
    if (contextRef.getName(i).equals(newRef.getName(i))) {
      if (newRef.getPredicate(i) == null) {
        newRef.setMultiplicity(i,contextRef.getMultiplicity(i));
      }
    }
 else {
      break;
    }
  }
  return newRef;
}

Fixed version (ground truth):
public TreeReference contextualize(TreeReference contextRef){
  if (!contextRef.isAbsolute()) {
    return null;
  }
  TreeReference newRef=anchor(contextRef);
  newRef.setContext(contextRef.getContext());
  for (int i=0; i < contextRef.size() && i < newRef.size(); i++) {
    if (TreeReference.NAME_WILDCARD.equals(newRef.getName(i)) && !TreeReference.NAME_WILDCARD.equals(contextRef.getName(i))) {
      newRef.data.setElementAt(newRef.data.elementAt(i).setName(contextRef.getName(i)),i);
    }
    if (contextRef.getName(i).equals(newRef.getName(i))) {
      if (newRef.getPredicate(i) == null) {
        newRef.setMultiplicity(i,contextRef.getMultiplicity(i));
      }
    }
 else {
      break;
    }
  }
  return newRef;
}