nus-yam/ex-repair huggingface dataset:
Program: 112468
Project: 112468
Buggy source:
@Test public void test_getCanonicalName_WhenTheDeploymentNodeHasAParent(){
  DeploymentNode parent=new DeploymentNode();
  parent.setName("String_Node_Str");
  DeploymentNode child=new DeploymentNode();
  child.setName("String_Node_Str");
  child.setParent(parent);
  assertEquals("String_Node_Str",child.getCanonicalName());
}

Fixed version (ground truth):
@Test public void test_getCanonicalName_WhenTheDeploymentNodeHasAParent(){
  DeploymentNode parent=model.addDeploymentNode("String_Node_Str","String_Node_Str","String_Node_Str");
  DeploymentNode child=parent.addDeploymentNode("String_Node_Str","String_Node_Str","String_Node_Str");
  assertEquals("String_Node_Str",child.getCanonicalName());
}
Program: 112469
Project: 112469
Buggy source:
/** 
 * Creates a new instance based upon a package to scan and a set of exclusions.
 * @param packageToScan     the fully qualified package name
 * @param exclusions        a Set of Pattern objects
 */
public DefaultTypeRepository(String packageToScan,Set<Pattern> exclusions){
  this.packageToScan=packageToScan;
  if (exclusions != null) {
    this.exclusions.addAll(exclusions);
  }
  Reflections reflections=new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forJavaClassPath()).filterInputsBy(new FilterBuilder().includePackage(packageToScan)).setScanners(new SubTypesScanner(false)));
  types=filter(reflections.getSubTypesOf(Object.class));
}

Fixed version (ground truth):
/** 
 * Creates a new instance based upon a package to scan and a set of exclusions.
 * @param packageToScan     the fully qualified package name
 * @param exclusions        a Set of Pattern objects
 */
DefaultTypeRepository(String packageToScan,Set<Pattern> exclusions){
  this.packageToScan=packageToScan;
  if (exclusions != null) {
    this.exclusions.addAll(exclusions);
  }
  AllTypesScanner allTypesScanner=new AllTypesScanner();
  Reflections reflections=new Reflections(new ConfigurationBuilder().setUrls(ClasspathHelper.forJavaClassPath()).filterInputsBy(new FilterBuilder().includePackage(packageToScan)).setScanners(new SubTypesScanner(false),allTypesScanner));
  types=new HashSet<>();
  types.addAll(ReflectionUtils.forNames(allTypesScanner.types,reflections.getConfiguration().getClassLoaders()));
  for (  Class<?> c : types) {
    System.out.println("String_Node_Str" + c);
  }
}
Program: 112470
Project: 112470
Buggy source:
@Override public void findDependencies() throws Exception {
  runJavaDoc();
  JavadocCommentFilter filter=new JavadocCommentFilter(maxDescriptionLength);
  for (  ClassDoc classDoc : ROOTDOC.classes()) {
    String type=classDoc.qualifiedTypeName();
    String comment=filter.filterAndTruncate(classDoc.commentText());
    String pathToSourceFile=classDoc.position().file().getCanonicalPath();
    typeToSourceFile.put(type,new File(pathToSourceFile));
    typeToDescription.put(type,comment);
  }
  for (  Component component : getComponentFinder().getContainer().getComponents()) {
    long count=0;
    File sourceFile=typeToSourceFile.get(component.getType());
    if (sourceFile != null) {
      count+=Files.lines(Paths.get(sourceFile.toURI())).count();
    }
    component.setDescription(typeToDescription.getOrDefault(component.getType(),null));
    for (    CodeElement codeElement : component.getCode()) {
      codeElement.setDescription(typeToDescription.getOrDefault(codeElement.getType(),null));
      sourceFile=typeToSourceFile.get(codeElement.getType());
      if (sourceFile != null) {
        long numberOfLinesInFile=Files.lines(Paths.get(sourceFile.toURI())).count();
        codeElement.setUrl(sourceFile.toURI().toString());
        codeElement.setSize(numberOfLinesInFile);
        count+=numberOfLinesInFile;
      }
    }
    if (count > 0) {
      component.setSize(count);
    }
  }
}

Fixed version (ground truth):
@Override public void findDependencies() throws Exception {
  runJavaDoc();
  JavadocCommentFilter filter=new JavadocCommentFilter(maxDescriptionLength);
  for (  ClassDoc classDoc : ROOTDOC.classes()) {
    String type=classDoc.qualifiedTypeName();
    String comment=filter.filterAndTruncate(classDoc.commentText());
    String pathToSourceFile=classDoc.position().file().getCanonicalPath();
    typeToSourceFile.put(type,new File(pathToSourceFile));
    typeToDescription.put(type,comment);
  }
  for (  Component component : getComponentFinder().getContainer().getComponents()) {
    long count=0;
    component.setDescription(typeToDescription.getOrDefault(component.getType(),null));
    for (    CodeElement codeElement : component.getCode()) {
      codeElement.setDescription(typeToDescription.getOrDefault(codeElement.getType(),null));
      File sourceFile=typeToSourceFile.get(codeElement.getType());
      if (sourceFile != null) {
        long numberOfLinesInFile=Files.lines(Paths.get(sourceFile.toURI())).count();
        codeElement.setUrl(sourceFile.toURI().toString());
        codeElement.setSize(numberOfLinesInFile);
        count+=numberOfLinesInFile;
      }
    }
    if (count > 0) {
      component.setSize(count);
    }
  }
}
Program: 112471
Project: 112471
Buggy source:
public static void main(String[] args){
  Workspace workspace=ExampleWorkspace.create(false);
  StringWriter stringWriter=new StringWriter();
  DotWriter dotWriter=new DotWriter();
  dotWriter.write(workspace,stringWriter);
  System.out.println(stringWriter);
}

Fixed version (ground truth):
public static void main(String[] args){
  Workspace workspace=ExampleWorkspace.create();
  StringWriter stringWriter=new StringWriter();
  DotWriter dotWriter=new DotWriter();
  dotWriter.write(workspace,stringWriter);
  System.out.println(stringWriter);
}
Program: 112472
Project: 112472
Buggy source:
private void addEfferentDependencies(Component component,String type,Set<String> typesVisited){
  typesVisited.add(type);
  try {
    ClassPool pool=ClassPool.getDefault();
    CtClass cc=pool.get(type);
    for (    Object referencedType : cc.getRefClasses()) {
      String referencedTypeName=(String)referencedType;
      Component destinationComponent=componentFinder.getContainer().getComponentOfType(referencedTypeName);
      if (destinationComponent != null) {
        if (component != destinationComponent) {
          component.uses(destinationComponent,"String_Node_Str");
        }
      }
 else       if (!typesVisited.contains(referencedTypeName)) {
        addEfferentDependencies(component,referencedTypeName,typesVisited);
      }
    }
  }
 catch (  NotFoundException nfe) {
    System.err.println(nfe.getMessage() + "String_Node_Str");
  }
catch (  Exception e) {
    System.err.println(e.getMessage());
  }
}

Fixed version (ground truth):
private void addEfferentDependencies(Component component,String type,Set<String> typesVisited){
  typesVisited.add(type);
  try {
    ClassPool pool=ClassPool.getDefault();
    CtClass cc=pool.get(type);
    for (    Object referencedType : cc.getRefClasses()) {
      String referencedTypeName=(String)referencedType;
      if (!isAJavaPlatformType(referencedTypeName)) {
        Component destinationComponent=componentFinder.getContainer().getComponentOfType(referencedTypeName);
        if (destinationComponent != null) {
          if (component != destinationComponent) {
            component.uses(destinationComponent,"String_Node_Str");
          }
        }
 else         if (!typesVisited.contains(referencedTypeName)) {
          addEfferentDependencies(component,referencedTypeName,typesVisited);
        }
      }
    }
  }
 catch (  NotFoundException nfe) {
    System.err.println(nfe.getMessage() + "String_Node_Str");
  }
catch (  Exception e) {
    System.err.println(e.getMessage());
  }
}
Program: 112473
Project: 112473
Buggy source:
private void findElementsToShow(Element element,Set<String> elementIds,int depth){
  if (elementViews.contains(new ElementView(element))) {
    elementIds.add(element.getId());
    if (depth < MAX_DEPTH) {
      element.getRelationships().forEach(r -> findElementsToShow(r.getDestination(),elementIds,depth + 1));
    }
  }
}

Fixed version (ground truth):
private void findElementsToShow(Element startingElement,Element element,Set<String> elementIdsToShow,Set<String> elementIdsVisited){
  if (!elementIdsVisited.contains(element.getId()) && elementViews.contains(new ElementView(element))) {
    elementIdsVisited.add(element.getId());
    elementIdsToShow.add(element.getId());
    if (!element.hasEfferentRelationshipWith(startingElement)) {
      element.getRelationships().forEach(r -> findElementsToShow(startingElement,r.getDestination(),elementIdsToShow,elementIdsVisited));
    }
  }
}
Program: 112474
Project: 112474
Buggy source:
/** 
 * Removes all elements that cannot be reached by traversing the graph of relationships starting with the specified element.
 * @param element       the starting element
 */
public void removeElementsThatCantBeReachedFrom(Element element){
  if (element != null) {
    Set<String> elementIdsToShow=new HashSet<>();
    findElementsToShow(element,elementIdsToShow,1);
    elementViews.removeIf(ev -> !elementIdsToShow.contains(ev.getId()));
  }
}

Fixed version (ground truth):
/** 
 * Removes all elements that cannot be reached by traversing the graph of relationships starting with the specified element.
 * @param element       the starting element
 */
public void removeElementsThatCantBeReachedFrom(Element element){
  if (element != null) {
    Set<String> elementIdsToShow=new HashSet<>();
    Set<String> elementIdsVisited=new HashSet<>();
    findElementsToShow(element,element,elementIdsToShow,elementIdsVisited);
    elementViews.removeIf(ev -> !elementIdsToShow.contains(ev.getId()));
  }
}
Program: 112475
Project: 112475
Buggy source:
/** 
 * Updates the hit object.
 * @param overlap true if the next object's start time has already passed
 * @param delta the delta interval since the last call
 * @param mouseX the x coordinate of the mouse
 * @param mouseY the y coordinate of the mouse
 * @param keyPressed whether or not a game key is currently pressed
 * @param trackPosition the track position
 * @return true if object ended
 */
public boolean update(boolean overlap,int delta,int mouseX,int mouseY,boolean keyPressed,int trackPosition);

Fixed version (ground truth):
/** 
 * Updates the hit object.
 * @param delta the delta interval since the last call
 * @param mouseX the x coordinate of the mouse
 * @param mouseY the y coordinate of the mouse
 * @param keyPressed whether or not a game key is currently pressed
 * @param trackPosition the track position
 * @return true if object ended
 */
public boolean update(int delta,int mouseX,int mouseY,boolean keyPressed,int trackPosition);
Program: 112479
Project: 112479
Buggy source:
@Override public void start() throws SlickException {
  try {
    setup();
    ErrorHandler.setGlString();
    getDelta();
    while (running())     gameLoop();
  }
  finally {
    close_sub();
    destroy();
    if (e != null) {
      ErrorHandler.error(null,e,true);
      e=null;
    }
  }
  if (forceExit) {
    Opsu.close();
    System.exit(0);
  }
}

Fixed version (ground truth):
@Override public void start() throws SlickException {
  try {
    setup();
    ErrorHandler.setGlString();
    getDelta();
    while (running())     gameLoop();
  }
 catch (  Exception e) {
    this.e=e;
  }
  try {
    close_sub();
  }
 catch (  Exception e) {
    if (this.e == null)     this.e=e;
  }
  destroy();
  if (e != null) {
    ErrorHandler.error(null,e,true);
    e=null;
    forceExit=true;
  }
  if (forceExit) {
    Opsu.close();
    System.exit(0);
  }
}
Program: 112480
Project: 112480
Buggy source:
@Override public boolean closeRequested(){
  int id=this.getCurrentStateID();
  if (id == STATE_GAME || id == STATE_GAMEPAUSEMENU || id == STATE_GAMERANKING) {
    SongMenu songMenu=(SongMenu)this.getState(Opsu.STATE_SONGMENU);
    if (id == STATE_GAMERANKING) {
      GameData data=((GameRanking)this.getState(Opsu.STATE_GAMERANKING)).getGameData();
      if (data != null && data.isGameplay())       songMenu.resetTrackOnLoad();
    }
 else {
      if (id == STATE_GAME) {
        MusicController.pause();
        MusicController.resume();
      }
 else       songMenu.resetTrackOnLoad();
    }
    if (UI.getCursor().isBeatmapSkinned())     UI.getCursor().reset();
    songMenu.resetGameDataOnLoad();
    this.enterState(Opsu.STATE_SONGMENU,new EasedFadeOutTransition(),new FadeInTransition());
    return false;
  }
  if (DownloadList.get().hasActiveDownloads() && UI.showExitConfirmation(DownloadList.EXIT_CONFIRMATION))   return false;
  if (Updater.get().getStatus() == Updater.Status.UPDATE_DOWNLOADING && UI.showExitConfirmation(Updater.EXIT_CONFIRMATION))   return false;
  return true;
}

Fixed version (ground truth):
@Override public boolean closeRequested(){
  int id=this.getCurrentStateID();
  if (id == STATE_GAME || id == STATE_GAMEPAUSEMENU || id == STATE_GAMERANKING) {
    SongMenu songMenu=(SongMenu)this.getState(Opsu.STATE_SONGMENU);
    if (id == STATE_GAMERANKING) {
      GameData data=((GameRanking)this.getState(Opsu.STATE_GAMERANKING)).getGameData();
      if (data != null && data.isGameplay())       songMenu.resetTrackOnLoad();
    }
 else {
      if (id == STATE_GAME) {
        MusicController.pause();
        MusicController.setPitch(1.0f);
        MusicController.resume();
      }
 else       songMenu.resetTrackOnLoad();
    }
    if (UI.getCursor().isBeatmapSkinned())     UI.getCursor().reset();
    songMenu.resetGameDataOnLoad();
    this.enterState(Opsu.STATE_SONGMENU,new EasedFadeOutTransition(),new FadeInTransition());
    return false;
  }
  if (DownloadList.get().hasActiveDownloads() && UI.showExitConfirmation(DownloadList.EXIT_CONFIRMATION))   return false;
  if (Updater.get().getStatus() == Updater.Status.UPDATE_DOWNLOADING && UI.showExitConfirmation(Updater.EXIT_CONFIRMATION))   return false;
  return true;
}
Program: 112483
Project: 112483
Buggy source:
@Override public void run(){
  File beatmapDir=Options.getBeatmapDir();
  if (fullReload) {
    BeatmapDB.clearDatabase();
    OszUnpacker.unpackAllFiles(Options.getOSZDir(),beatmapDir);
  }
  BeatmapParser.parseAllFiles(beatmapDir);
  if (BeatmapSetList.get().size() > 0) {
    BeatmapSetList.get().init();
    setFocus(BeatmapSetList.get().getRandomNode(),-1,true,true);
  }
 else   MusicController.playThemeSong();
  reloadThread=null;
}

Fixed version (ground truth):
@Override public void run(){
  try {
    reloadBeatmaps();
  }
  finally {
    finished=true;
  }
}
Program: 112484
Project: 112484
Buggy source:
/** 
 * Reloads all beatmaps.
 * @param fullReload if true, also clear the beatmap cache and invoke the unpacker
 */
private void reloadBeatmaps(final boolean fullReload){
  songFolderChanged=false;
  MusicController.reset();
  startNode=focusNode=null;
  scoreMap=null;
  focusScores=null;
  oldFocusNode=null;
  randomStack=new Stack<SongNode>();
  songInfo=null;
  hoverOffset.setTime(0);
  hoverIndex=null;
  search.setText("String_Node_Str");
  searchTimer=SEARCH_DELAY;
  searchTransitionTimer=SEARCH_TRANSITION_TIME;
  searchResultString=null;
  lastBackgroundImage=null;
  reloadThread=new Thread(){
    @Override public void run(){
      File beatmapDir=Options.getBeatmapDir();
      if (fullReload) {
        BeatmapDB.clearDatabase();
        OszUnpacker.unpackAllFiles(Options.getOSZDir(),beatmapDir);
      }
      BeatmapParser.parseAllFiles(beatmapDir);
      if (BeatmapSetList.get().size() > 0) {
        BeatmapSetList.get().init();
        setFocus(BeatmapSetList.get().getRandomNode(),-1,true,true);
      }
 else       MusicController.playThemeSong();
      reloadThread=null;
    }
  }
;
  reloadThread.start();
}

Fixed version (ground truth):
/** 
 * Reloads all beatmaps.
 * @param fullReload if true, also clear the beatmap cache and invoke the unpacker
 */
private void reloadBeatmaps(final boolean fullReload){
  songFolderChanged=false;
  MusicController.reset();
  startNode=focusNode=null;
  scoreMap=null;
  focusScores=null;
  oldFocusNode=null;
  randomStack=new Stack<SongNode>();
  songInfo=null;
  hoverOffset.setTime(0);
  hoverIndex=null;
  search.setText("String_Node_Str");
  searchTimer=SEARCH_DELAY;
  searchTransitionTimer=SEARCH_TRANSITION_TIME;
  searchResultString=null;
  lastBackgroundImage=null;
  reloadThread=new BeatmapReloadThread(fullReload);
  reloadThread.start();
}
Program: 112485
Project: 112485
Buggy source:
@Override public void mouseReleased(int button,int x,int y){
  startDownloadIndexPos.release();
  startResultPos.release();
}

Fixed version (ground truth):
@Override public void mouseReleased(int button,int x,int y){
  startDownloadIndexPos.released();
  startResultPos.released();
}
Program: 112486
Project: 112486
Buggy source:
/** 
 * Handles a slider tick result.
 * @param time the tick start time
 * @param result the hit result (HIT_* constants)
 * @param x the x coordinate
 * @param y the y coordinate
 * @param hitObject the hit object
 * @param repeat the current repeat number
 */
public void sliderTickResult(int time,int result,float x,float y,HitObject hitObject,int repeat){
  int hitValue=0;
switch (result) {
case HIT_SLIDER30:
    hitValue=30;
  changeHealth(1f);
SoundController.playHitSound(hitObject.getEdgeHitSoundType(repeat),hitObject.getSampleSet(repeat),hitObject.getAdditionSampleSet(repeat));
break;
case HIT_SLIDER10:
hitValue=10;
SoundController.playHitSound(HitSound.SLIDERTICK);
break;
case HIT_MISS:
resetComboStreak();
break;
default :
return;
}
if (hitValue > 0) {
score+=hitValue;
incrementComboStreak();
if (!Options.isPerfectHitBurstEnabled()) ;
 else hitResultList.add(new HitObjectResult(time,result,x,y,null,HitObjectType.SLIDERTICK,null,false));
}
fullObjectCount++;
}

Fixed version (ground truth):
/** 
 * Handles a slider tick result.
 * @param time the tick start time
 * @param result the hit result (HIT_* constants)
 * @param x the x coordinate
 * @param y the y coordinate
 * @param hitObject the hit object
 * @param repeat the current repeat number
 */
public void sliderTickResult(int time,int result,float x,float y,HitObject hitObject,int repeat){
  int hitValue=0;
switch (result) {
case HIT_SLIDER30:
    hitValue=30;
  changeHealth(1f);
SoundController.playHitSound(hitObject.getEdgeHitSoundType(repeat),hitObject.getSampleSet(repeat),hitObject.getAdditionSampleSet(repeat));
break;
case HIT_SLIDER10:
hitValue=10;
SoundController.playHitSound(HitSound.SLIDERTICK);
break;
case HIT_MISS:
resetComboStreak();
break;
default :
return;
}
if (hitValue > 0) {
score+=hitValue;
incrementComboStreak();
if (!Options.isPerfectHitBurstEnabled()) ;
 else hitResultList.add(new HitObjectResult(time,result,x,y,null,HitObjectType.SLIDERTICK,null,false,false));
}
fullObjectCount++;
}
Program: 112487
Project: 112487
Buggy source:
/** 
 * Constructor.
 * @param time the result's starting track position
 * @param result the hit result (HIT_* constants)
 * @param x the center x coordinate
 * @param y the center y coordinate
 * @param color the color of the hit object
 * @param curve the slider curve (or null if not applicable)
 * @param expand whether or not the hit result animation should expand (if applicable)
 */
public HitObjectResult(int time,int result,float x,float y,Color color,HitObjectType hitResultType,Curve curve,boolean expand){
  this.time=time;
  this.result=result;
  this.x=x;
  this.y=y;
  this.color=color;
  this.hitResultType=hitResultType;
  this.curve=curve;
  this.expand=expand;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param time the result's starting track position
 * @param result the hit result (HIT_* constants)
 * @param x the center x coordinate
 * @param y the center y coordinate
 * @param color the color of the hit object
 * @param curve the slider curve (or null if not applicable)
 * @param expand whether or not the hit result animation should expand (if applicable)
 * @param hideResult whether or not to hide the hit result (but still show the other animations)
 */
public HitObjectResult(int time,int result,float x,float y,Color color,HitObjectType hitResultType,Curve curve,boolean expand,boolean hideResult){
  this.time=time;
  this.result=result;
  this.x=x;
  this.y=y;
  this.color=color;
  this.hitResultType=hitResultType;
  this.curve=curve;
  this.expand=expand;
  this.hideResult=hideResult;
}
Program: 112492
Project: 112492
Buggy source:
@Override public void uncaughtException(Thread t,Throwable e){
  Log.error("String_Node_Str",e);
}

Fixed version (ground truth):
@Override public void uncaughtException(Thread t,Throwable e){
  if (!(e instanceof ThreadDeath))   Log.error("String_Node_Str",e);
}
Program: 112494
Project: 112494
Buggy source:
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue(pvValue instanceof CurrencyAmount,"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output+="String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performance_calibration_pricing();
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue(pvValue instanceof CurrencyAmount,"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output+="String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performanceCalibrationPricing();
    }
  }
  System.out.println("String_Node_Str");
}
Program: 112495
Project: 112495
Buggy source:
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue(pvValue instanceof CurrencyAmount,"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output+="String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performance_calibration_pricing();
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue(pvValue instanceof CurrencyAmount,"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output+="String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performanceCalibrationPricing();
    }
  }
  System.out.println("String_Node_Str");
}
Program: 112496
Project: 112496
Buggy source:
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue(pvValue instanceof CurrencyAmount,"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output+="String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performance_calibration_pricing();
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue(pvValue instanceof CurrencyAmount,"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output+="String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performanceCalibrationPricing();
    }
  }
  System.out.println("String_Node_Str");
}
Program: 112497
Project: 112497
Buggy source:
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue((pvValue instanceof CurrencyAmount),"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output=output + "String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performance_calibration_pricing();
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue((pvValue instanceof CurrencyAmount),"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output=output + "String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performanceCalibrationPricing();
    }
  }
  System.out.println("String_Node_Str");
}
Program: 112499
Project: 112499
Buggy source:
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue((pvValue instanceof CurrencyAmount),"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output=output + "String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performance_calibration_pricing();
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue((pvValue instanceof CurrencyAmount),"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output=output + "String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performanceCalibrationPricing();
    }
  }
  System.out.println("String_Node_Str");
}
Program: 112500
Project: 112500
Buggy source:
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue(pvValue instanceof CurrencyAmount,"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output+="String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performance_calibration_pricing();
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Runs the calibration and checks that all the trades used in the curve calibration have a PV of 0.
 * @param args  -p to run the performance estimate
 */
public static void main(String[] args){
  System.out.println("String_Node_Str");
  Pair<List<Trade>,Results> results=calculate();
  System.out.println("String_Node_Str");
  for (int i=0; i < results.getFirst().size(); i++) {
    Trade trade=results.getFirst().get(i);
    Result<?> pv=results.getSecond().getCells().get(i);
    String output="String_Node_Str" + trade.getClass().getSimpleName() + "String_Node_Str"+ pv.isSuccess();
    Object pvValue=pv.getValue();
    ArgChecker.isTrue(pvValue instanceof CurrencyAmount,"String_Node_Str");
    CurrencyAmount ca=(CurrencyAmount)pvValue;
    output+="String_Node_Str" + ca;
    System.out.println(output);
    ArgChecker.isTrue(Math.abs(ca.getAmount()) < TOLERANCE_PV,"String_Node_Str");
  }
  if (args.length > 0) {
    if (args[0].equals("String_Node_Str")) {
      performanceCalibrationPricing();
    }
  }
  System.out.println("String_Node_Str");
}
Program: 112501
Project: 112501
Buggy source:
/** 
 * Runs the example, serializing and deserializing the portfolio and printing to the screen.
 * @param args  ignored
 */
public static void main(String[] args){
  String xmlString=serializePretty(tradeList);
  System.out.println("String_Node_Str" + tradeList.toString());
  System.out.println("String_Node_Str" + xmlString);
  TradeList deserializedPortfolioFromString=deserialize(xmlString);
  System.out.println("String_Node_Str" + deserializedPortfolioFromString.toString());
  TradeList deserializedPortfolioFromFile=deserialize(loadExamplePortfolio());
  System.out.println("String_Node_Str" + deserializedPortfolioFromFile.toString());
}

Fixed version (ground truth):
/** 
 * Runs the example, serializing and deserializing the portfolio and printing to the screen.
 * @param args  ignored
 */
public static void main(String[] args){
  String xmlString=serializePretty(TRADE_LIST);
  System.out.println("String_Node_Str" + TRADE_LIST.toString());
  System.out.println("String_Node_Str" + xmlString);
  TradeList deserializedPortfolioFromString=deserialize(xmlString);
  System.out.println("String_Node_Str" + deserializedPortfolioFromString.toString());
  TradeList deserializedPortfolioFromFile=deserialize(loadExamplePortfolio());
  System.out.println("String_Node_Str" + deserializedPortfolioFromFile.toString());
}
Program: 112502
Project: 112502
Buggy source:
public void test_load_from_classpath(){
  String xmlStringFromClasspath=CdsTradeExample.loadExamplePortfolio();
  String xmlStringFromClasspathCompact=CdsTradeExample.serializeCompact(CdsTradeExample.deserialize(xmlStringFromClasspath));
  String xmlStringFromCode=CdsTradeExample.serializeCompact(CdsTradeExample.tradeList);
  assertEquals(xmlStringFromClasspathCompact,xmlStringFromCode);
}

Fixed version (ground truth):
public void test_load_from_classpath(){
  String xmlStringFromClasspath=CdsTradeExample.loadExamplePortfolio();
  String xmlStringFromClasspathCompact=CdsTradeExample.serializeCompact(CdsTradeExample.deserialize(xmlStringFromClasspath));
  String xmlStringFromCode=CdsTradeExample.serializeCompact(CdsTradeExample.TRADE_LIST);
  assertEquals(xmlStringFromClasspathCompact,xmlStringFromCode);
}
Program: 112503
Project: 112503
Buggy source:
/** 
 * Creates a stream that wraps a stream with the index. <p> Each input object is decorated with an   {@link ObjIntPair}. The   {@code int} is the index of the element in the stream.
 * @param < T >  the type of the stream
 * @param stream  the stream to index
 * @return a stream of pairs, containing the element and index
 */
public static <T>Stream<ObjIntPair<T>> zipWithIndex(Stream<T> stream){
  Spliterator<T> split1=stream.spliterator();
  Iterator<T> it1=Spliterators.iterator(split1);
  Iterator<ObjIntPair<T>> it=new Iterator<ObjIntPair<T>>(){
    int index=0;
    @Override public boolean hasNext(){
      return it1.hasNext();
    }
    @Override public ObjIntPair<T> next(){
      return ObjIntPair.of(it1.next(),index++);
    }
  }
;
  Spliterator<ObjIntPair<T>> split=Spliterators.spliterator(it,split1.getExactSizeIfKnown(),split1.characteristics());
  return StreamSupport.stream(split,false);
}

Fixed version (ground truth):
/** 
 * Creates a stream that wraps a stream with the index. <p> Each input object is decorated with an   {@link ObjIntPair}. The   {@code int} is the index of the element in the stream.
 * @param < T >  the type of the stream
 * @param stream  the stream to index
 * @return a stream of pairs, containing the element and index
 */
public static <T>Stream<ObjIntPair<T>> zipWithIndex(Stream<T> stream){
  Spliterator<T> split1=stream.spliterator();
  Iterator<T> it1=Spliterators.iterator(split1);
  Iterator<ObjIntPair<T>> it=new Iterator<ObjIntPair<T>>(){
    private int index;
    @Override public boolean hasNext(){
      return it1.hasNext();
    }
    @Override public ObjIntPair<T> next(){
      return ObjIntPair.of(it1.next(),index++);
    }
  }
;
  Spliterator<ObjIntPair<T>> split=Spliterators.spliterator(it,split1.getExactSizeIfKnown(),split1.characteristics());
  return StreamSupport.stream(split,false);
}
Program: 112504
Project: 112504
Buggy source:
/** 
 * Builds a set of market data from the data in this builder. <p> It is possible to continue to add more data to a builder after calling   {@code build()}. Any  {@code BaseMarketData} instances built previously will be unaffected.
 * @return a set of market data from the data in this builder
 */
public MarketEnvironment build(){
  return new MarketEnvironment(valuationDate,scenarioCount,values,timeSeries,valueFailures,timeSeriesFailures);
}

Fixed version (ground truth):
/** 
 * Builds a set of market data from the data in this builder. <p> It is possible to continue to add more data to a builder after calling   {@code build()}. Any  {@code BaseMarketData} instances built previously will be unaffected.
 * @return a set of market data from the data in this builder
 */
public MarketEnvironment build(){
  if (valuationDate.getScenarioCount() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return new MarketEnvironment(valuationDate,scenarioCount,values,timeSeries,valueFailures,timeSeriesFailures);
}
Program: 112505
Project: 112505
Buggy source:
/** 
 * Creates a new function for building curve groups that delegates to   {@code curveBuilder} to perform calibration.
 * @param rootFinderConfig  the configuration for the root finder used when calibrating curves
 * @param measures  the measures used for calibration
 */
public CurveGroupMarketDataFunction(RootFinderConfig rootFinderConfig,CalibrationMeasures measures){
  this.curveCalibrator=CurveCalibrator.of(rootFinderConfig.getAbsoluteTolerance(),rootFinderConfig.getRelativeTolerance(),rootFinderConfig.getMaximumSteps(),measures);
}

Fixed version (ground truth):
/** 
 * Creates a new function for building curve groups that delegates to   {@code curveCalibrator} to perform calibration.
 * @param curveCalibrator  performs the calibration
 */
public CurveGroupMarketDataFunction(CurveCalibrator curveCalibrator){
  this.curveCalibrator=curveCalibrator;
}
Program: 112506
Project: 112506
Buggy source:
/** 
 * Extracts the underlying quotes from the   {@link CurveInputs} instances and returns them in a map.
 * @param inputs  input data for the curve
 * @return the underlying quotes from the input data
 */
private static MarketData inputsByKey(List<CurveInputs> inputs){
  Map<? extends MarketDataKey<?>,?> valueMap=inputs.stream().flatMap(pr -> pr.getMarketData().entrySet().stream()).collect(toMap(Map.Entry::getKey,Map.Entry::getValue));
  return MarketData.of(valueMap);
}

Fixed version (ground truth):
/** 
 * Extracts the underlying quotes from the   {@link CurveInputs} instances and returns them in a map.
 * @param inputs  input data for the curve
 * @return the underlying quotes from the input data
 */
private static MarketData inputsByKey(List<CurveInputs> inputs){
  BinaryOperator<Object> mergeFunction=(v1,v2) -> checkValuesEqual(v1,v2);
  Map<? extends MarketDataKey<?>,?> valueMap=inputs.stream().flatMap(pr -> pr.getMarketData().entrySet().stream()).collect(toMap(Map.Entry::getKey,Map.Entry::getValue,mergeFunction));
  return MarketData.of(valueMap);
}
Program: 112509
Project: 112509
Buggy source:
private void appendToZip(File sourceRootDir,String destRootPath,File currentFile,ZipOutputStream zipOutput) throws IOException {
  if (currentFile.isDirectory()) {
    zipOutput.putNextEntry(getEntry(sourceRootDir,destRootPath,currentFile));
    zipOutput.closeEntry();
    for (    File content : currentFile.listFiles()) {
      appendToZip(sourceRootDir,destRootPath,content,zipOutput);
    }
  }
 else {
    zipOutput.putNextEntry(getEntry(sourceRootDir,destRootPath,currentFile));
    try (FileInputStream fileIn=new FileInputStream(currentFile)){
      byte[] b=new byte[1024];
      int len;
      while ((len=fileIn.read(b)) != -1) {
        zipOutput.write(b,0,len);
      }
    }
     zipOutput.closeEntry();
  }
}

Fixed version (ground truth):
private void appendToZip(File sourceRootDir,String destRootPath,File currentFile,ZipOutputStream zipOutput) throws IOException {
  if (currentFile.isDirectory()) {
    String entryName=getEntryName(sourceRootDir,destRootPath,currentFile) + File.separator;
    zipOutput.putNextEntry(new ZipEntry(entryName));
    zipOutput.closeEntry();
    for (    File content : currentFile.listFiles()) {
      appendToZip(sourceRootDir,destRootPath,content,zipOutput);
    }
  }
 else {
    String entryName=getEntryName(sourceRootDir,destRootPath,currentFile);
    zipOutput.putNextEntry(new ZipEntry(entryName));
    try (FileInputStream fileIn=new FileInputStream(currentFile)){
      byte[] b=new byte[1024];
      int len;
      while ((len=fileIn.read(b)) != -1) {
        zipOutput.write(b,0,len);
      }
    }
     zipOutput.closeEntry();
  }
}
Program: 112510
Project: 112510
Buggy source:
/** 
 * Assert that the   {@code Result} is a failure with thespecified  {@link FailureReason}.
 * @return this if a failure with the specified reason, elsethrow an  {@code AssertionError}
 */
public ResultAssert isFailure(FailureReason expected){
  isNotNull();
  FailureReason actualReason=actual.getFailure().getReason();
  if (actualReason != expected) {
    failWithMessage("String_Node_Str",expected,actualReason);
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Assert that the   {@code Result} is a failure with thespecified  {@link FailureReason}.
 * @return this if a failure with the specified reason, elsethrow an  {@code AssertionError}
 */
public ResultAssert isFailure(FailureReason expected){
  isFailure();
  FailureReason actualReason=actual.getFailure().getReason();
  if (actualReason != expected) {
    failWithMessage("String_Node_Str",expected,actualReason);
  }
  return this;
}
Program: 112511
Project: 112511
Buggy source:
/** 
 * If z doesn't contain the key, it's initialized at 0.0 and therefore less than laplace which is always >= 0.0
 */
public double getRegularizedWeight(String feature){
  if (z.containsKey(feature)) {
    double z_i=z.getCoordinate(feature);
    if (Math.abs(z_i) <= laplace) {
      return 0.0d;
    }
 else {
      double n_i=n.getCoordinate(feature);
      double w_i=-(((beta + Math.sqrt(n_i)) / alpha) + gaussian) * (z_i - Math.signum(z_i) * laplace);
      return w_i;
    }
  }
 else {
    return 0.0;
  }
}

Fixed version (ground truth):
/** 
 * If z doesn't contain the key, it's initialized at 0.0 and therefore less than laplace which is always >= 0.0
 */
public double getRegularizedWeight(String feature){
  if (z.containsKey(feature)) {
    double z_i=z.getCoordinate(feature);
    if (Math.abs(z_i) <= laplace) {
      return 0.0d;
    }
 else {
      double n_i=n.getCoordinate(feature);
      double w_i=-1.0 / (((beta + Math.sqrt(n_i)) / alpha) + gaussian) * (z_i - Math.signum(z_i) * laplace);
      return w_i;
    }
  }
 else {
    return 0.0;
  }
}
Program: 112512
Project: 112512
Buggy source:
public double getFeatureLearningRate(String feature){
  return initialLearningRate / Math.sqrt(gradients.getCoordinate(feature));
}

Fixed version (ground truth):
public double getFeatureLearningRate(String feature){
  return initialLearningRate / Math.sqrt(summedGradients.getCoordinate(feature));
}
Program: 112513
Project: 112513
Buggy source:
public double adagradL1(String feature,double param,long iter){
  double eta=(initialLearningRate * iter) / Math.sqrt(gradients.getCoordinate(feature));
  double u=unnormalizedGradients.getCoordinate(feature);
  double normalizedGradient=u / iter;
  if (Math.abs(normalizedGradient) <= laplace) {
    param=0.0;
  }
 else {
    param=-(Math.signum(u) * eta * (normalizedGradient - laplace));
  }
  return param;
}

Fixed version (ground truth):
public double adagradL1(String feature,double param,long iter){
  double eta=(initialLearningRate * iter) / Math.sqrt(summedGradients.getCoordinate(feature));
  double u=unnormalizedGradients.getCoordinate(feature);
  double normalizedGradient=u / iter;
  if (Math.abs(normalizedGradient) <= laplace) {
    param=0.0;
  }
 else {
    param=-(Math.signum(u) * eta * (normalizedGradient - laplace));
  }
  return param;
}
Program: 112514
Project: 112514
Buggy source:
@Override public StringKeyedVector getUpdate(LabeledInstance instance){
  StringKeyedVector gradients=model.getGradients(instance);
  Iterator it=gradients.iterator();
  while (it.hasNext()) {
    Map.Entry<String,Double> pairs=(Map.Entry)it.next();
    String feature=pairs.getKey();
    double gradient=pairs.getValue();
    double featureLearningRate=updateAndGetFeatureLearningRate(feature,gradient);
    gradients.setCoordinate(feature,gradient * featureLearningRate);
  }
  return gradients;
}

Fixed version (ground truth):
@Override public StringKeyedVector getUpdate(LabeledInstance instance){
  StringKeyedVector gradients=model.getGradients(instance);
  Iterator it=gradients.iterator();
  while (it.hasNext()) {
    Map.Entry<String,Double> pairs=(Map.Entry)it.next();
    String feature=pairs.getKey();
    double gradient=pairs.getValue();
    double featureLearningRate=updateAndGetFeatureLearningRate(feature,gradient);
    summedGradients.setCoordinate(feature,gradient * featureLearningRate);
  }
  return gradients;
}
Program: 112515
Project: 112515
Buggy source:
/** 
 * Update adaptive feature specific learning rates
 */
public double updateAndGetFeatureLearningRate(String feature,double gradient){
  double gradUpdate=0.0;
  if (gradients.containsKey(feature)) {
    gradUpdate=gradient * gradient;
  }
 else {
    gradUpdate=1d + (gradient * gradient);
  }
  gradients.addToCoordinate(feature,gradUpdate);
  unnormalizedGradients.addToCoordinate(feature,gradient);
  return getFeatureLearningRate(feature);
}

Fixed version (ground truth):
/** 
 * Update adaptive feature specific learning rates
 */
public double updateAndGetFeatureLearningRate(String feature,double gradient){
  double gradUpdate=0.0;
  if (summedGradients.containsKey(feature)) {
    gradUpdate=gradient * gradient;
  }
 else {
    gradUpdate=1d + (gradient * gradient);
  }
  summedGradients.addToCoordinate(feature,gradUpdate);
  unnormalizedGradients.addToCoordinate(feature,gradient);
  return getFeatureLearningRate(feature);
}
Program: 112516
Project: 112516
Buggy source:
@Override public void teardown(){
  gradients=new StringKeyedVector();
  unnormalizedGradients=new StringKeyedVector();
}

Fixed version (ground truth):
@Override public void teardown(){
  summedGradients=new StringKeyedVector();
  unnormalizedGradients=new StringKeyedVector();
}
Program: 112517
Project: 112517
Buggy source:
public double getFeatureLearningRate(String feature){
  return initialLearningRate / Math.sqrt(gradients.getCoordinate(feature));
}

Fixed version (ground truth):
public double getFeatureLearningRate(String feature){
  return initialLearningRate / Math.sqrt(summedGradients.getCoordinate(feature));
}