nus-yam/ex-repair huggingface dataset:
Program: 178269
Project: 178269
Buggy source:
public DecodedFieldOp(FieldOpcode fo,Context context,int index){
  super(fo,context,index);
  String descriptor=context.behavior.getMethodInfo().getConstPool().getFieldrefType(getMethodRefIndex());
  StackElementLength sel=ONE;
  if (Descriptor.dataSize(descriptor) == 2)   sel=DOUBLE;
  this.stackElementLength=sel;
  this.descriptor=descriptor;
  this.load=fo.getCode() == Opcode.GETFIELD || fo.getCode() == Opcode.GETSTATIC;
}

Fixed version (ground truth):
public DecodedFieldOp(FieldOpcode fo,Context context,int index){
  super(fo,context,index);
  String descriptor=context.behavior.getMethodInfo().getConstPool().getFieldrefType(getMethodRefIndex());
  StackElementLength sel=ONE;
  if (Descriptor.dataSize(descriptor) == 2)   sel=DOUBLE;
  this.stackElementLength=sel;
  this.descriptor=descriptor;
  this.load=fo.getCode() == Opcode.GETFIELD || fo.getCode() == Opcode.GETSTATIC;
  this.isStatic=fo.getCode() == Opcode.GETSTATIC || fo.getCode() == Opcode.PUTSTATIC;
}
Program: 178270
Project: 178270
Buggy source:
public StackElementLength[] getPops(){
  if (!load)   return new StackElementLength[]{stackElementLength};
  return new StackElementLength[0];
}

Fixed version (ground truth):
public StackElementLength[] getPops(){
  if (isStatic && !load)   return new StackElementLength[]{stackElementLength};
 else   if (isStatic && load)   return new StackElementLength[0];
 else   if (!isStatic && !load)   return new StackElementLength[]{stackElementLength,ONE};
 else   return new StackElementLength[]{ONE};
}
Program: 178271
Project: 178271
Buggy source:
public StackElementLength[] getPushes(){
  return pushes;
}

Fixed version (ground truth):
public StackElementLength[] getPushes(){
  return new StackElementLength[]{this.returnType};
}
Program: 178273
Project: 178273
Buggy source:
private static MethodParam[] resolveParameters(final Iterable<StackElement> stack,final int elements){
  MethodParam[] result=new MethodParam[elements];
  Iterator<StackElement> it=stack.iterator();
  int i=0;
  while (it.hasNext() && i < elements) {
    StackElement se=it.next();
    if (se instanceof TOP)     se=it.next();
    LocalVariable lv=getLocalVariableIfAvailable(se);
    if (lv != null) {
      result[elements - i - 1]=new MethodParam(lv.name,lv.type);
    }
 else {
      result[elements - i - 1]=new MethodParam(null,null);
    }
    i++;
  }
  return result;
}

Fixed version (ground truth):
private static MethodParam[] resolveParameters(final Iterable<StackElement> stack,final int elements,boolean reverse){
  MethodParam[] result=new MethodParam[elements];
  Iterator<StackElement> it=stack.iterator();
  int i=0;
  while (it.hasNext() && i < elements) {
    StackElement se=it.next();
    if (se instanceof TOP)     se=it.next();
    LocalVariable lv=getLocalVariableIfAvailable(se);
    if (lv != null) {
      result[reverse ? i : elements - i - 1]=new MethodParam(lv.name,lv.type);
    }
 else {
      result[reverse ? i : elements - i - 1]=new MethodParam(null,null);
    }
    i++;
  }
  return result;
}
Program: 178274
Project: 178274
Buggy source:
@Override public void simulate(Stack stack){
  for (int i=0; i < getPops().length; i++) {
    if (getPops()[i] == DOUBLE)     stack.pop2();
 else     stack.pop();
  }
  for (int i=0; i < getPushes().length; i++) {
    if (getPushes()[i] == DOUBLE)     stack.push2(new Whatever());
 else     stack.push(new Whatever());
  }
}

Fixed version (ground truth):
@Override public void simulate(Stack stack){
  for (int i=0; i < pops.length; i++) {
    if (pops[i] == DOUBLE)     stack.pop2();
 else     stack.pop();
  }
  if (op.as(MethodInvocationOpcode.class).isInstanceMethod())   stack.pop();
  if (returnType != null) {
    if (returnType == DOUBLE)     stack.push2(new Whatever());
 else     stack.push(new Whatever());
  }
}
Program: 178275
Project: 178275
Buggy source:
public static void processBasicAlteration(Stack stack,StackElementLength[] pops,StackElementLength[] pushes){
  for (int i=0; i < pops.length; i++) {
    if (pops[i] == DOUBLE)     stack.pop2();
 else     stack.pop();
  }
  for (int i=0; i < pushes.length; i++) {
    if (pushes[i] == DOUBLE)     stack.push2(new Whatever());
 else     stack.push(new Whatever());
  }
}

Fixed version (ground truth):
public static void processBasicAlteration(Stack stack,StackElementLength[] pops,StackElementLength[] pushes){
  System.out.println("String_Node_Str" + Arrays.toString(pops) + "String_Node_Str"+ Arrays.toString(pushes)+ "String_Node_Str"+ stack);
  for (int i=0; i < pops.length; i++) {
    if (pops[i] == DOUBLE)     stack.pop2();
 else     stack.pop();
  }
  for (int i=0; i < pushes.length; i++) {
    if (pushes[i] == DOUBLE)     stack.push2(new Whatever());
 else     stack.push(new Whatever());
  }
}
Program: 178276
Project: 178276
Buggy source:
public StackElement pop2(){
  StackElement se=stack.pop();
  if (!(se instanceof TOP))   System.out.println("String_Node_Str");
  se=stack.pop();
  if (se instanceof TOP)   System.out.println("String_Node_Str");
  return se;
}

Fixed version (ground truth):
public StackElement pop2(){
  StackElement se=stack.pop();
  if (!(se instanceof TOP))   throw new RuntimeException("String_Node_Str" + se.getClass() + "String_Node_Str");
  se=stack.pop();
  if (se instanceof TOP)   throw new RuntimeException("String_Node_Str");
  return se;
}
Program: 178278
Project: 178278
Buggy source:
@Override public void simulate(Stack stack){
  ValueFromLocalVariable toPush=new ValueFromLocalVariable(localVariable);
  for (int i=0; i < getPops().length; i++) {
    if (getPops()[i] == DOUBLE)     stack.pop2();
 else     stack.pop();
  }
  for (int i=0; i < getPushes().length; i++) {
    if (getPushes()[i] == DOUBLE)     stack.push2(toPush);
 else     stack.push(toPush);
  }
}

Fixed version (ground truth):
@Override public void simulate(Stack stack){
  ValueFromLocalVariable toPush=new ValueFromLocalVariable(localVariable);
  for (int i=0; i < getPops().length; i++) {
    StackElement poppedSe;
    if (getPops()[i] == DOUBLE)     poppedSe=stack.pop2();
 else     poppedSe=stack.pop();
    if (poppedSe instanceof ValueFromLocalVariable && (localVariable == null || localVariable.name == null)) {
      System.out.println("String_Node_Str" + ((ValueFromLocalVariable)poppedSe).localVariable + "String_Node_Str");
      toPush=new ValueFromLocalVariable(((ValueFromLocalVariable)poppedSe).localVariable);
    }
  }
  for (int i=0; i < getPushes().length; i++) {
    if (getPushes()[i] == DOUBLE)     stack.push2(toPush);
 else     stack.push(toPush);
  }
  System.out.println("String_Node_Str" + stack);
}
Program: 178279
Project: 178279
Buggy source:
public StackElementLength[] getPushes(){
  return new StackElementLength[]{this.returnType};
}

Fixed version (ground truth):
public StackElementLength[] getPushes(){
  return new StackElementLength[]{this.returnTypeLength};
}
Program: 178281
Project: 178281
Buggy source:
public MethodParams(MethodParam[] params,MethodParam[] varargs){
  this.params=params;
  this.varargs=varargs;
}

Fixed version (ground truth):
public MethodParams(MethodParam subject,MethodParam[] params,MethodParam[] varargs){
  this.subject=subject;
  this.params=params;
  this.varargs=varargs;
}
Program: 178282
Project: 178282
Buggy source:
@Override public void simulate(Stack stack){
  for (int i=0; i < pops.length; i++) {
    if (pops[i] == DOUBLE)     stack.pop2();
 else     stack.pop();
  }
  if (op.as(MethodInvocationOpcode.class).isInstanceMethod())   stack.pop();
  if (returnType != null) {
    if (returnType == DOUBLE)     stack.push2(new Whatever());
 else     stack.push(new Whatever());
  }
}

Fixed version (ground truth):
@Override public void simulate(Stack stack){
  boolean isAutoboxing=isAutoboxing();
  StackElement se=null;
  for (int i=0; i < pops.length; i++) {
    if (pops[i] == DOUBLE)     se=stack.pop2();
 else     se=stack.pop();
  }
  if (op.as(MethodInvocationOpcode.class).isInstanceMethod())   stack.pop();
  if (returnTypeLength != null) {
    if (returnTypeLength == DOUBLE)     stack.push2(isAutoboxing ? se.copy() : new Whatever());
 else     stack.push(isAutoboxing ? se.copy() : new Whatever());
  }
}
Program: 178283
Project: 178283
Buggy source:
public static void processBasicAlteration(Stack stack,StackElementLength[] pops,StackElementLength[] pushes){
  System.out.println("String_Node_Str" + Arrays.toString(pops) + "String_Node_Str"+ Arrays.toString(pushes)+ "String_Node_Str"+ stack);
  for (int i=0; i < pops.length; i++) {
    if (pops[i] == DOUBLE)     stack.pop2();
 else     stack.pop();
  }
  for (int i=0; i < pushes.length; i++) {
    if (pushes[i] == DOUBLE)     stack.push2(new Whatever());
 else     stack.push(new Whatever());
  }
}

Fixed version (ground truth):
public static void processBasicAlteration(Stack stack,StackElementLength[] pops,StackElementLength[] pushes){
  for (int i=0; i < pops.length; i++) {
    if (pops[i] == DOUBLE)     stack.pop2();
 else     stack.pop();
  }
  for (int i=0; i < pushes.length; i++) {
    if (pushes[i] == DOUBLE)     stack.push2(new Whatever());
 else     stack.push(new Whatever());
  }
}
Program: 178284
Project: 178284
Buggy source:
private boolean ableToCreatePlayers(){
  StartDialog dialog=new StartDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
  dialog.open();
  if (dialog.getReturnCode() == Dialog.OK) {
    leftProgrammer.resetStats();
    rightProgrammer.resetStats();
    leftProgrammer.setName(dialog.getPlayerOneName());
    rightProgrammer.setName(dialog.getPlayerTwoName());
    leftProgrammer.setAvatar(dialog.getPlayerOneAvatar());
    rightProgrammer.setAvatar(dialog.getPlayerTwoAvatar());
    return true;
  }
  return false;
}

Fixed version (ground truth):
private boolean ableToCreatePlayers(){
  StartDialog dialog=new StartDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
  dialog.open();
  if (dialog.getReturnCode() == Dialog.OK) {
    leftProgrammer.resetStats();
    rightProgrammer.resetStats();
    leftProgrammer.setName(dialog.getPlayerOneName());
    rightProgrammer.setName(dialog.getPlayerTwoName());
    leftProgrammer.setAvatar(dialog.getPlayerOneAvatar());
    rightProgrammer.setAvatar(dialog.getPlayerTwoAvatar());
    scoreboard.resetStats();
    updateScore(scoreboard.getScore());
    return true;
  }
  return false;
}
Program: 178285
Project: 178285
Buggy source:
public FractalModel compress(BufferedImage image){
  Compressor compressor=new Compressor(configuration.domainScale(),configuration.tiler(),new ImageComparator(configuration.metric(),configuration.fuzz()),new HashSet<ImageTransform>(5){
{
      add(new FlipTransform());
      add(new FlopTransform());
      add(new AffineRotateQuadrantsTransform(1));
      add(new AffineRotateQuadrantsTransform(2));
      add(new AffineRotateQuadrantsTransform(3));
    }
  }
,new HashSet<BufferedImageOp>(1){
{
      add(new GrayscaleFilter());
    }
  }
,this);
  return compressor.compress(image);
}

Fixed version (ground truth):
public FractalModel compress(BufferedImage image){
  Compressor compressor=new Compressor(configuration.domainScale(),configuration.tiler(),new ImageComparator(configuration.metric(),configuration.fuzz()),new HashSet<ImageTransform>(5){
{
      add(new NoneTransform());
      add(new FlipTransform());
      add(new FlopTransform());
      add(new AffineRotateQuadrantsTransform(1));
      add(new AffineRotateQuadrantsTransform(2));
      add(new AffineRotateQuadrantsTransform(3));
    }
  }
,new HashSet<BufferedImageOp>(1){
{
      add(new GrayscaleFilter());
    }
  }
,this);
  return compressor.compress(image);
}
Program: 178286
Project: 178286
Buggy source:
/** 
 * NOTE: the current compressor cannot handle scale transforms
 * @param scaleTransform the scale difference between the ranges and the domains
 * @param tiler the tiler used to tile the image
 * @param comparator the comparator used to compare the tiles of the image
 * @param transforms a set of transform to apply to the tiles of the image
 * @param filters a set of filters to apply to the image for normalization
 * @throws NullPointerException if any field is null
 */
public Compressor(final ScaleTransform scaleTransform,final Tiler<BufferedImage> tiler,final Distanceator<BufferedImage> comparator,final Set<ImageTransform> transforms,final Set<BufferedImageOp> filters) throws NullPointerException {
}

Fixed version (ground truth):
/** 
 * NOTE: the current compressor cannot handle scale transforms
 * @param scaleTransform the scale difference between the ranges and the domains
 * @param tiler the tiler used to tile the image
 * @param comparator the comparator used to compare the tiles of the image
 * @param transforms a set of transform to apply to the tiles of the image
 * @param filters a set of filters to apply to the image for normalization
 * @param observer an observer receiving progress results from {@code compress} - allowed to be null
 * @throws NullPointerException if any field is null
 * @see #compress(java.awt.image.BufferedImage)
 * @see Observable
 * @see Observer#update(java.util.Observable,java.lang.Object)
 */
public Compressor(final ScaleTransform scaleTransform,final Tiler<BufferedImage> tiler,final Distanceator<BufferedImage> comparator,final Set<ImageTransform> transforms,final Set<BufferedImageOp> filters,Observer observer) throws NullPointerException {
}
Program: 178287
Project: 178287
Buggy source:
/** 
 * Get an open socket. This method could potentially block for a long time (for example if DNS sucks).
 * @return - returns true if the socket ends up open and useable.
 */
private boolean getOpenSocket(){
  if (socket == null) {
    if (DEBUG)     msg("String_Node_Str");
    openSocket();
    if (DEBUG)     msg("String_Node_Str");
  }
  if (socket.isConnected() != true) {
    openSocket();
  }
  if (socket.isConnected() != true) {
    if (DEBUG)     msg("String_Node_Str");
    return false;
  }
  if (DEBUG)   msg("String_Node_Str");
  return true;
}

Fixed version (ground truth):
/** 
 * Get an open socket. This method could potentially block for a long time (for example if DNS sucks).
 * @return - returns true if the socket ends up open and useable.
 */
private boolean getOpenSocket(){
  if (socket == null) {
    if (DEBUG)     msg("String_Node_Str");
    openSocket();
    if (DEBUG)     msg("String_Node_Str");
  }
  if (socket == null) {
    msg("String_Node_Str");
    return false;
  }
  if (socket.isConnected() != true) {
    openSocket();
  }
  if (socket.isConnected() != true) {
    if (DEBUG)     msg("String_Node_Str");
    return false;
  }
  if (DEBUG)   msg("String_Node_Str");
  return true;
}
Program: 178288
Project: 178288
Buggy source:
public void run(){
  switchTo11BitTransmitMode();
  sendWakeupAllNodes();
  switchTo29BitTransmitMode();
  send29BitWakeup();
}

Fixed version (ground truth):
public void run(){
  sendCommand_SYNC(_cmdname);
}
Program: 178289
Project: 178289
Buggy source:
/** 
 * Starts the worked thread.  The worker thread is here for us to send work to which we don't want to block the UI thread.  Stuff sent to the worker thrad is all performed one after another, sequentially, in the background.  
 * @return - returns true if the thread was created and started, false if it was alrady started previously or something else happened. 
 */
private boolean startWorkerThread(){
  if (mtWorkerThread != null) {
    if (DEBUG == true)     msg("String_Node_Str");
    return false;
  }
  mtWorkerThread=new Thread(){
    public void run(){
      Looper.prepare();
      mhWorkerHandler=new Handler();
      while (mThreadsOn == true) {
        Looper.loop();
        try {
          Thread.sleep(300);
        }
 catch (        InterruptedException e) {
          break;
        }
      }
      if (DEBUG == true)       msg("String_Node_Str");
      mtWorkerThread=null;
    }
  }
;
  mtWorkerThread.start();
  return true;
}

Fixed version (ground truth):
/** 
 * Starts the worked thread.  The worker thread is here for us to send work to which we don't want to block the UI thread.  Stuff sent to the worker thrad is all performed one after another, sequentially, in the background.  
 * @return - returns true if the thread was created and started, false if it was alrady started previously or something else happened. 
 */
private boolean startWorkerThread(){
  if (mtWorkerThread != null) {
    if (DEBUG == true)     msg("String_Node_Str");
    return false;
  }
  mtWorkerThread=new Thread(){
    public void run(){
      Looper.prepare();
      mhWorkerHandler=new Handler();
      while (mThreadsOn == true) {
        Looper.loop();
        try {
          Thread.sleep(300);
        }
 catch (        InterruptedException e) {
          break;
        }
      }
      if (DEBUG == true)       msg("String_Node_Str");
      mtWorkerThread=null;
      mhWorkerHandler=null;
    }
  }
;
  mtWorkerThread.start();
  return true;
}
Program: 178290
Project: 178290
Buggy source:
/** 
 * 1. Switch to 11-bit transmit mode 2. send "100 00" (header=100, data=00) 3. Switch back to 29-bit transmit mode. 
 */
public void wakeUpAllNetworks(){
  if (mhWorkerHandler != null) {
    mhWorkerHandler.post(new Runnable(){
      public void run(){
        switchTo11BitTransmitMode();
        sendWakeupAllNodes();
        switchTo29BitTransmitMode();
        send29BitWakeup();
      }
    }
);
  }
}

Fixed version (ground truth):
/** 
 * 1. Switch to 11-bit transmit mode 2. send "100 00" (header=100, data=00) 3. Switch back to 29-bit transmit mode. 
 */
public void wakeUpAllNetworks(){
  if (mhWorkerHandler == null) {
    msg("String_Node_Str");
    return;
  }
  if (DEBUG)   msg("String_Node_Str");
  switchTo11BitTransmitMode();
  sendWakeupAllNodes();
  switchTo29BitTransmitMode();
  send29BitWakeup();
  if (DEBUG)   msg("String_Node_Str");
}
Program: 178292
Project: 178292
Buggy source:
private void threadsOff(){
  mThreadsOn=false;
  if (mtWorkerThread != null)   mtWorkerThread.interrupt();
  if (mStateManagementThread != null)   mStateManagementThread.interrupt();
}

Fixed version (ground truth):
private void threadsOff(){
  mThreadsOn=false;
  if (mtWorkerThread != null) {
    mtWorkerThread.interrupt();
  }
  if (mStateManagementThread != null)   mStateManagementThread.interrupt();
}
Program: 178293
Project: 178293
Buggy source:
private void msg(String m){
  if (mecbMsg != null)   mecbMsg.onNewMessageArrived(m);
 else   Log.d("String_Node_Str",m);
}

Fixed version (ground truth):
private void msg(String m){
  m="String_Node_Str" + Thread.currentThread().getId() + "String_Node_Str"+ m;
  if (mecbMsg != null) {
    mecbMsg.onNewMessageArrived(m);
  }
 else {
    Log.d("String_Node_Str",m);
  }
}
Program: 178294
Project: 178294
Buggy source:
public boolean appendLog(String dataLine){
  if (mLogFile == null) {
    msg("String_Node_Str");
    return false;
  }
  try {
    mLogFile.append(dataLine);
  }
 catch (  Exception e) {
    msg("String_Node_Str" + e.getMessage());
    setLogging(false);
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean appendLog(String dataLine){
  if (mLogFile == null) {
    if (DEBUG)     msg("String_Node_Str");
    return false;
  }
  try {
    mLogFile.append(dataLine);
  }
 catch (  Exception e) {
    msg("String_Node_Str" + e.getMessage());
    setLogging(false);
    return false;
  }
  return true;
}
Program: 178295
Project: 178295
Buggy source:
/** 
 * controls whether we'll be logging packets to file or not. 
 * @param trueOrFalse - set to true if you want to log packets to the sdcard. 
 * @return
 */
public boolean setLogging(boolean trueOrFalse){
  if (trueOrFalse == true) {
    try {
      setLogging(false);
      String backupDirectory=Environment.getExternalStorageDirectory() + "String_Node_Str";
      mkdir(backupDirectory);
      String fullPath=backupDirectory + "String_Node_Str" + mLogFileName;
      mLogFile=new FileWriter(fullPath,true);
      mgStats.setStat("String_Node_Str",fullPath);
    }
 catch (    Exception e1) {
      msg("String_Node_Str" + e1.getMessage());
      return false;
    }
    appendLog("String_Node_Str" + EasyTime.currentDateAndTimeStamp() + "String_Node_Str");
    msg("String_Node_Str");
  }
 else {
    try {
      mLogFile.flush();
      mLogFile.close();
      mLogFile=null;
    }
 catch (    Exception e) {
      msg("String_Node_Str" + e.getMessage());
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * controls whether we'll be logging packets to file or not. 
 * @param trueOrFalse - set to true if you want to log packets to the sdcard. 
 * @return
 */
public boolean setLogging(boolean trueOrFalse){
  if (trueOrFalse == true) {
    try {
      setLogging(false);
      String backupDirectory=Environment.getExternalStorageDirectory() + "String_Node_Str";
      mkdir(backupDirectory);
      String fullPath=backupDirectory + "String_Node_Str" + mLogFileName;
      msg("String_Node_Str" + fullPath);
      mLogFile=new FileWriter(fullPath,true);
      mgStats.setStat("String_Node_Str",fullPath);
    }
 catch (    Exception e1) {
      msg("String_Node_Str" + e1.getMessage());
      return false;
    }
    appendLog("String_Node_Str" + EasyTime.currentDateAndTimeStamp() + "String_Node_Str");
    msg("String_Node_Str");
  }
 else {
    try {
      mLogFile.flush();
      mLogFile.close();
      mLogFile=null;
    }
 catch (    Exception e) {
      msg("String_Node_Str" + e.getMessage());
    }
  }
  return true;
}
Program: 178296
Project: 178296
Buggy source:
@Override public void onDPArrived(String DPN,String sDecodedData,int iDecodedData){
  if (mSVIPServer != null)   mSVIPServer.sendDPArrived(DPN,sDecodedData);
  sendDPArrivedMessage(DPN,sDecodedData);
}

Fixed version (ground truth):
@Override public void onDPArrived(String DPN,String sDecodedData,int iDecodedData){
  sendDPArrivedMessage(DPN,sDecodedData);
}
Program: 178297
Project: 178297
Buggy source:
/** 
 * Pings the server and returns the latency, in ms, accurate to about 200ms. 
 * @return - returns number of milliseconds between request and response. TODO: use queryserver() to do the ping.
 */
public int pingServer(){
  final int sleepSliceTime=200;
  int loopCount=0;
  final int maxLoopCount=25;
  int latency=0;
  sendMessage("String_Node_Str");
  while (mResponseMessageQueue.isEmpty() && loopCount <= maxLoopCount) {
    loopCount++;
    if (!EasyTime.safeSleep(200))     break;
  }
  latency=loopCount * sleepSliceTime;
  String response=mResponseMessageQueue.peek().toUpperCase();
  if (response.contains("String_Node_Str") && response.contains("String_Node_Str")) {
    response=mResponseMessageQueue.remove();
    if (DEBUG)     msg("String_Node_Str" + response + "String_Node_Str"+ latency+ "String_Node_Str");
  }
  return (latency);
}

Fixed version (ground truth):
/** 
 * Pings the server and returns the latency, in ms, accurate to about 200ms. 
 * @return - returns number of milliseconds between request and response. TODO: use queryserver() to do the ping.
 */
public int pingServer(){
  final int sleepSliceTime=200;
  int loopCount=0;
  final int maxLoopCount=25;
  int latency=0;
  sendMessage("String_Node_Str");
  while (mResponseMessageQueue.isEmpty() && loopCount <= maxLoopCount) {
    loopCount++;
    if (!EasyTime.safeSleep(200))     break;
  }
  if (loopCount > maxLoopCount) {
    if (DEBUG)     msg("String_Node_Str");
    return 9999;
  }
  latency=loopCount * sleepSliceTime;
  String response=mResponseMessageQueue.peek().toUpperCase();
  if (response.contains("String_Node_Str") && response.contains("String_Node_Str")) {
    response=mResponseMessageQueue.remove();
    if (DEBUG)     msg("String_Node_Str" + response + "String_Node_Str"+ latency+ "String_Node_Str");
  }
  return (latency);
}
Program: 178298
Project: 178298
Buggy source:
public GeneralStats getStats(){
  return mGenStats;
}

Fixed version (ground truth):
public GeneralStats getStats(){
  updateAllStats();
  return mGenStats;
}
Program: 178299
Project: 178299
Buggy source:
/** 
 * for each session type, if support is "true" (not unknown or no), then make sure the session is  instantiated. When we look up hardware support from the DB it allows us to skip the instantiation  during detection phase, so this method will let us instantiate those sessions for the parent class. 
 */
private void instantiateAllAvailableSessions(){
  if (sess_obd2 == null && isOBD2Supported().equals("String_Node_Str")) {
    sess_obd2=new OBD2Session(ebt,pd,"String_Node_Str",ddb);
  }
  if (sess_cmd == null && isMoniSupported().equals("String_Node_Str") && isHardwareSWCAN().equals("String_Node_Str")) {
    sess_cmd=new CommandSession(ebt,ddb);
    sess_cmd.suspend();
  }
  if (sess_monitor == null && isMoniSupported().equals("String_Node_Str")) {
    if (isHardwareSWCAN().equals("String_Node_Str"))     sess_monitor=new MonitorSession(ebt,MonitorSession.INTERFACE_SWCAN,pd);
 else     sess_monitor=new MonitorSession(ebt,MonitorSession.INTERFACE_STANDARD,pd);
  }
  if (sess_obd2 != null)   sess_obd2._suspend();
  if (sess_monitor != null)   sess_monitor._suspend();
  if (sess_cmd != null)   sess_cmd.suspend();
}

Fixed version (ground truth):
/** 
 * for each session type, if support is "true" (not unknown or no), then make sure the session is  instantiated. When we look up hardware support from the DB it allows us to skip the instantiation  during detection phase, so this method will let us instantiate those sessions for the parent class. 
 */
private void instantiateAllAvailableSessions(){
  if (sess_obd2 == null && isOBD2Supported().equals("String_Node_Str")) {
    sess_obd2=new OBD2Session(ebt,pd,"String_Node_Str",ddb);
  }
  if (sess_cmd == null && isMoniSupported().equals("String_Node_Str") && isHardwareSWCAN().equals("String_Node_Str")) {
    sess_cmd=new CommandSession(ebt,ddb);
    sess_cmd.suspend();
  }
  if (sess_monitor == null && isMoniSupported().equals("String_Node_Str")) {
    if (isHardwareSWCAN().equals("String_Node_Str"))     sess_monitor=new MonitorSession(ebt,MonitorSession.INTERFACE_SWCAN,pd);
 else     sess_monitor=new MonitorSession(ebt,MonitorSession.INTERFACE_STANDARD,pd);
  }
  if (sess_cmd != null)   sess_cmd.suspend();
  if (sess_obd2 != null)   sess_obd2._suspend();
  if (sess_monitor != null)   sess_monitor._suspend();
}
Program: 178300
Project: 178300
Buggy source:
public void shutdown(){
  if (DEBUG)   msg("String_Node_Str");
  mThreadsOn=false;
  mgStats=null;
  ebt=null;
  ddb=null;
  pd=null;
  sess_cmd=null;
  sess_obd2=null;
  sess_monitor=null;
  mhmCapabilities=null;
}

Fixed version (ground truth):
public void shutdown(){
  if (DEBUG)   msg("String_Node_Str");
  mThreadsOn=false;
}
Program: 178301
Project: 178301
Buggy source:
private void startThreads(){
  if (mScanThread != null)   return;
  mScanThread=new Thread(){
    public void run(){
      int loops=0;
      while (mThreadsOn == true) {
        loops++;
        mgStats.setStat("String_Node_Str","String_Node_Str" + loops);
        if (mOBD.getCurrentState() < 40) {
          EasyTime.safeSleep(500);
          continue;
        }
 else {
          requestAllDPNs();
        }
        EasyTime.safeSleep(500);
      }
    }
  }
;
  mScanThread.start();
}

Fixed version (ground truth):
private void startThreads(){
  if (mScanThread != null)   return;
  mScanThread=new Thread(){
    public void run(){
      int loops=0;
      while (mThreadsOn == true) {
        loops++;
        mgStats.setStat("String_Node_Str","String_Node_Str" + loops);
        if (mOBD.getCurrentState() < 40) {
          EasyTime.safeSleep(500);
          continue;
        }
 else {
          requestAllDPNs();
        }
      }
    }
  }
;
  mScanThread.start();
}
Program: 178302
Project: 178302
Buggy source:
public void run(){
  int loops=0;
  while (mThreadsOn == true) {
    loops++;
    mgStats.setStat("String_Node_Str","String_Node_Str" + loops);
    if (mOBD.getCurrentState() < 40) {
      EasyTime.safeSleep(500);
      continue;
    }
 else {
      requestAllDPNs();
    }
    EasyTime.safeSleep(500);
  }
}

Fixed version (ground truth):
public void run(){
  int loops=0;
  while (mThreadsOn == true) {
    loops++;
    mgStats.setStat("String_Node_Str","String_Node_Str" + loops);
    if (mOBD.getCurrentState() < 40) {
      EasyTime.safeSleep(500);
      continue;
    }
 else {
      requestAllDPNs();
    }
  }
}
Program: 178303
Project: 178303
Buggy source:
@Override public void onELMDeviceChosen(final String MAC){
  new Thread(){
    public void run(){
      mgStats.incrementStat("String_Node_Str");
      long startTime=EasyTime.getUnixTime();
      setupHSession(MAC);
      long stopTime=EasyTime.getUnixTime();
      mgStats.setStat("String_Node_Str",stopTime - startTime);
    }
  }
.start();
}

Fixed version (ground truth):
@Override public void onELMDeviceChosen(final String MAC){
  mgStats.incrementStat("String_Node_Str");
  long startTime=EasyTime.getUnixTime();
  setupHSession(MAC);
  long stopTime=EasyTime.getUnixTime();
  mgStats.setStat("String_Node_Str",stopTime - startTime);
}
Program: 178304
Project: 178304
Buggy source:
public synchronized static HazelcastCacheImpl getInstance(){
  return instance;
}

Fixed version (ground truth):
public synchronized static HazelcastCacheImpl getInstance(){
  if (instance == null) {
    instance=new HazelcastCacheImpl();
  }
  return instance;
}
Program: 178305
Project: 178305
Buggy source:
/** 
 * Average time.
 * @param key the key
 * @return the long
 */
public long averageTime(KEY key){
  long executions=this.executions(key);
  long times=this.executionTimes(key);
  return times / executions;
}

Fixed version (ground truth):
/** 
 * Average time.
 * @param key the key
 * @return the long
 */
public long averageTime(KEY key){
  long executions=this.executions(key);
  long times=this.executionTimes(key);
  if (executions <= 0) {
    return 0;
  }
  return times / executions;
}
Program: 178306
Project: 178306
Buggy source:
/** 
 * Instantiates a new log4 play event.
 * @param event the event
 */
public Log4PlayEvent(LoggingEvent event){
  DateFormat dateFormat=SimpleDateFormat.getDateTimeInstance();
  this.category=event.categoryName;
  this.thread=event.getThreadName();
  this.date=dateFormat.format(new Date(event.getTimeStamp()));
  this.message=event.getRenderedMessage();
  if (event.getLevel().toInt() == Level.TRACE_INT) {
    this.level="String_Node_Str";
  }
  if (event.getLevel().toInt() == Level.DEBUG_INT) {
    this.level="String_Node_Str";
  }
  if (event.getLevel().toInt() == Level.INFO_INT) {
    this.level="String_Node_Str";
  }
  if (event.getLevel().toInt() == Level.WARN_INT) {
    this.level="String_Node_Str";
  }
  if (event.getLevel().toInt() == Level.ERROR_INT) {
    this.level="String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Instantiates a new log4 play event.
 * @param event the event
 */
public Log4PlayEvent(LoggingEvent event){
  DateFormat dateFormat=SimpleDateFormat.getDateTimeInstance();
  this.category=event.categoryName;
  this.thread=event.getThreadName();
  this.date=dateFormat.format(new Date(event.getTimeStamp()));
  this.message=event.getRenderedMessage();
  this.message=this.message.replaceAll("String_Node_Str","String_Node_Str").replaceAll("String_Node_Str","String_Node_Str");
  if (event.getLevel().toInt() == Level.TRACE_INT) {
    this.level="String_Node_Str";
  }
  if (event.getLevel().toInt() == Level.DEBUG_INT) {
    this.level="String_Node_Str";
  }
  if (event.getLevel().toInt() == Level.INFO_INT) {
    this.level="String_Node_Str";
  }
  if (event.getLevel().toInt() == Level.WARN_INT) {
    this.level="String_Node_Str";
  }
  if (event.getLevel().toInt() == Level.ERROR_INT) {
    this.level="String_Node_Str";
  }
}
Program: 178307
Project: 178307
Buggy source:
private void notifyUser(Context context,NotificationManager notificationManager){
  ArrayList<Chargeable> data=LogStoreService.getInstance().get(context,Settings.getBillingStartDate(context),Settings.getBillingEndDate(context));
  String operator=Settings.getOperator(context);
  String planName=Settings.getMyPlan(context);
  PlanService planService=PlanService.getInstance();
  PlanSummary summary=planService.process(data,operator,planName);
  PlanChargeable last=null;
  for (  PlanChargeable planChargeable : summary.getPlanCalls()) {
    if (planChargeable.getChargeable() != null && planChargeable.getChargeable().getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      last=planChargeable;
    }
  }
  String lastCallPrice=Formatter.formatDecimal(last.getPrice()) + "String_Node_Str" + last.getCurrency();
  String totalPrice=Formatter.formatDecimal(summary.getTotalPrice()) + "String_Node_Str" + last.getCurrency();
  String text=lastCallPrice + "String_Node_Str" + totalPrice;
  Notification notification=new Notification(R.drawable.app_icon,text,System.currentTimeMillis());
  notification.flags=Notification.FLAG_AUTO_CANCEL;
  PendingIntent pendingIntent=PendingIntent.getActivity(context,0,new Intent(),0);
  notification.setLatestEventInfo(context,context.getString(R.string.app_name),text,pendingIntent);
  notificationManager.notify(NOTIFICATION_ID,notification);
}

Fixed version (ground truth):
private void notifyUser(Context context,NotificationManager notificationManager){
  ArrayList<Chargeable> data=LogStoreService.getInstance().get(context,Settings.getBillingStartDate(context),Settings.getBillingEndDate(context));
  String operator=Settings.getOperator(context);
  String planName=Settings.getMyPlan(context);
  PlanService planService=PlanService.getInstance();
  PlanSummary summary=planService.process(data,operator,planName);
  PlanChargeable last=null;
  if (summary != null) {
    for (    PlanChargeable planChargeable : summary.getPlanCalls()) {
      if (planChargeable.getChargeable() != null && planChargeable.getChargeable().getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
        last=planChargeable;
      }
    }
    String lastCallPrice=Formatter.formatDecimal(last.getPrice()) + "String_Node_Str" + last.getCurrency();
    String totalPrice=Formatter.formatDecimal(summary.getTotalPrice()) + "String_Node_Str" + last.getCurrency();
    String text=lastCallPrice + "String_Node_Str" + totalPrice;
    Notification notification=new Notification(R.drawable.app_icon,text,System.currentTimeMillis());
    notification.flags=Notification.FLAG_AUTO_CANCEL;
    PendingIntent pendingIntent=PendingIntent.getActivity(context,0,new Intent(),0);
    notification.setLatestEventInfo(context,context.getString(R.string.app_name),text,pendingIntent);
    notificationManager.notify(NOTIFICATION_ID,notification);
  }
}
Program: 178308
Project: 178308
Buggy source:
public boolean equals(Object another){
  Contact anotherContact=null;
  if (another instanceof ContactValue) {
    anotherContact=((ContactValue)another).getContact();
  }
  return this.getMsisdn().equals(anotherContact.getMsisdn());
}

Fixed version (ground truth):
public boolean equals(Object another){
  Contact anotherContact=null;
  if (another instanceof ContactValue) {
    anotherContact=((ContactValue)another).getContact();
  }
  if (this.getMsisdn() == null || anotherContact == null || anotherContact.getMsisdn() == null) {
    return false;
  }
  return this.getMsisdn().equals(anotherContact.getMsisdn());
}
Program: 178309
Project: 178309
Buggy source:
public static int getMsisdnTypeResourceImage(MsisdnType msisdnType){
switch (msisdnType) {
case ES_JAZZTEL:
    return R.drawable.logo_jazztel;
case ES_MOVISTAR:
  return R.drawable.logo_movistar;
case ES_ORANGE:
return R.drawable.logo_orange;
case ES_PEPEPHONE:
return R.drawable.logo_pepephone;
case ES_SIMYO:
return R.drawable.logo_simyo;
case ES_VODAFONE:
return R.drawable.logo_vodafone;
case ES_YOIGO:
return R.drawable.logo_yoigo;
case ES_LAND_LINE:
return R.drawable.logo_landline;
case ES_LAND_LINE_SPECIAL:
return R.drawable.logo_landlinespecial;
}
return R.drawable.logo_unknown;
}

Fixed version (ground truth):
public static int getMsisdnTypeResourceImage(MsisdnType msisdnType){
switch (msisdnType) {
case ES_JAZZTEL:
    return R.drawable.logo_jazztel;
case ES_MASMOVIL:
  return R.drawable.logo_masmovil;
case ES_MOVISTAR:
return R.drawable.logo_movistar;
case ES_ORANGE:
return R.drawable.logo_orange;
case ES_PEPEPHONE:
return R.drawable.logo_pepephone;
case ES_SIMYO:
return R.drawable.logo_simyo;
case ES_VODAFONE:
return R.drawable.logo_vodafone;
case ES_YOIGO:
return R.drawable.logo_yoigo;
case ES_LAND_LINE:
return R.drawable.logo_landline;
case ES_LAND_LINE_SPECIAL:
return R.drawable.logo_landlinespecial;
}
return R.drawable.logo_unknown;
}
Program: 178311
Project: 178311
Buggy source:
public PlanSummary process(ArrayList<Chargeable> data){
  PlanSummary ret=new PlanSummary(this);
  double globalPrice=0;
  for (  Chargeable chargeable : data) {
    if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      Call call=(Call)chargeable;
      if (call.getType() != Call.CALL_TYPE_SENT) {
        continue;
      }
      double callPrice=0;
      if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) {
        callPrice=0;
      }
 else {
        callPrice=initialPrice + (call.getDuration() * pricePerSecond);
      }
      globalPrice+=callPrice;
      ret.addPlanCall(new PlanChargeable(call,callPrice,this.getCurrency()));
    }
 else     if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_SMS) {
      Sms sms=(Sms)chargeable;
      if (sms.getType() == Sms.SMS_TYPE_RECEIVED) {
        continue;
      }
      globalPrice+=smsPrice;
      ret.addPlanCall(new PlanChargeable(chargeable,smsPrice,this.getCurrency()));
    }
  }
  if (globalPrice < minimumMonthFee) {
    ret.addPlanCall(new PlanChargeable(new ChargeableMessage(ChargeableMessage.MESSAGE_MONTH_FEE),minimumMonthFee - globalPrice,this.getCurrency()));
  }
  return ret;
}

Fixed version (ground truth):
public PlanSummary process(ArrayList<Chargeable> data){
  PlanSummary ret=new PlanSummary(this);
  double globalPrice=0;
  for (  Chargeable chargeable : data) {
    if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      Call call=(Call)chargeable;
      if (call.getType() != Call.CALL_TYPE_SENT) {
        continue;
      }
      double callPrice=0;
      if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) {
        callPrice=0;
      }
 else {
        callPrice=initialPrice + (call.getDuration() * pricePerSecond);
      }
      globalPrice+=callPrice;
      ret.addPlanCall(new PlanChargeable(call,callPrice,this.getCurrency()));
    }
 else     if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_SMS) {
      Sms sms=(Sms)chargeable;
      if (sms.getType() == Sms.SMS_TYPE_RECEIVED) {
        continue;
      }
      globalPrice+=smsPrice;
      ret.addPlanCall(new PlanChargeable(chargeable,smsPrice,this.getCurrency()));
    }
  }
  if (globalPrice < minimumMonthFee) {
    ret.addPlanCall(new PlanChargeable(new ChargeableMessage(ChargeableMessage.MESSAGE_MINIMUM_MONTH_FEE),minimumMonthFee - globalPrice,this.getCurrency()));
  }
  return ret;
}
Program: 178312
Project: 178312
Buggy source:
public PlanSummary process(ArrayList<Chargeable> data){
  PlanSummary ret=new PlanSummary(this);
  double globalPrice=0;
  for (  Chargeable chargeable : data) {
    if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      Call call=(Call)chargeable;
      if (call.getType() != Call.CALL_TYPE_SENT) {
        continue;
      }
      double callPrice=0;
      if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) {
        callPrice=0;
      }
 else {
        callPrice=initialPrice + (call.getDuration() * pricePerSecond);
      }
      globalPrice+=callPrice;
      ret.addPlanCall(new PlanChargeable(call,callPrice,this.getCurrency()));
    }
 else     if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_SMS) {
      Sms sms=(Sms)chargeable;
      if (sms.getType() == Sms.SMS_TYPE_RECEIVED) {
        continue;
      }
      globalPrice+=smsPrice;
      ret.addPlanCall(new PlanChargeable(chargeable,smsPrice,this.getCurrency()));
    }
  }
  if (globalPrice < minimumMonthFee) {
    ret.addPlanCall(new PlanChargeable(new ChargeableMessage(ChargeableMessage.MESSAGE_MONTH_FEE),minimumMonthFee - globalPrice,this.getCurrency()));
  }
  return ret;
}

Fixed version (ground truth):
public PlanSummary process(ArrayList<Chargeable> data){
  PlanSummary ret=new PlanSummary(this);
  double globalPrice=0;
  for (  Chargeable chargeable : data) {
    if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      Call call=(Call)chargeable;
      if (call.getType() != Call.CALL_TYPE_SENT) {
        continue;
      }
      double callPrice=0;
      if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) {
        callPrice=0;
      }
 else {
        callPrice=initialPrice + (call.getDuration() * pricePerSecond);
      }
      globalPrice+=callPrice;
      ret.addPlanCall(new PlanChargeable(call,callPrice,this.getCurrency()));
    }
 else     if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_SMS) {
      Sms sms=(Sms)chargeable;
      if (sms.getType() == Sms.SMS_TYPE_RECEIVED) {
        continue;
      }
      globalPrice+=smsPrice;
      ret.addPlanCall(new PlanChargeable(chargeable,smsPrice,this.getCurrency()));
    }
  }
  if (globalPrice < minimumMonthFee) {
    ret.addPlanCall(new PlanChargeable(new ChargeableMessage(ChargeableMessage.MESSAGE_MINIMUM_MONTH_FEE),minimumMonthFee - globalPrice,this.getCurrency()));
  }
  return ret;
}
Program: 178313
Project: 178313
Buggy source:
public PlanSummary process(ArrayList<Chargeable> data){
  PlanSummary ret=new PlanSummary(this);
  double globalPrice=0;
  for (  Chargeable chargeable : data) {
    if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      Call call=(Call)chargeable;
      if (call.getType() != Call.CALL_TYPE_SENT) {
        continue;
      }
      double callPrice=0;
      if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) {
        callPrice=0;
      }
 else {
        callPrice=initialPrice + (call.getDuration() * pricePerSecond);
      }
      globalPrice+=callPrice;
      ret.addPlanCall(new PlanChargeable(call,callPrice,this.getCurrency()));
    }
 else     if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_SMS) {
      Sms sms=(Sms)chargeable;
      if (sms.getType() == Sms.SMS_TYPE_RECEIVED) {
        continue;
      }
      globalPrice+=smsPrice;
      ret.addPlanCall(new PlanChargeable(chargeable,smsPrice,this.getCurrency()));
    }
  }
  if (globalPrice < minimumMonthFee) {
    ret.addPlanCall(new PlanChargeable(new ChargeableMessage(ChargeableMessage.MESSAGE_MONTH_FEE),minimumMonthFee - globalPrice,this.getCurrency()));
  }
  return ret;
}

Fixed version (ground truth):
public PlanSummary process(ArrayList<Chargeable> data){
  PlanSummary ret=new PlanSummary(this);
  double globalPrice=0;
  for (  Chargeable chargeable : data) {
    if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      Call call=(Call)chargeable;
      if (call.getType() != Call.CALL_TYPE_SENT) {
        continue;
      }
      double callPrice=0;
      if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) {
        callPrice=0;
      }
 else {
        callPrice=initialPrice + (call.getDuration() * pricePerSecond);
      }
      globalPrice+=callPrice;
      ret.addPlanCall(new PlanChargeable(call,callPrice,this.getCurrency()));
    }
 else     if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_SMS) {
      Sms sms=(Sms)chargeable;
      if (sms.getType() == Sms.SMS_TYPE_RECEIVED) {
        continue;
      }
      globalPrice+=smsPrice;
      ret.addPlanCall(new PlanChargeable(chargeable,smsPrice,this.getCurrency()));
    }
  }
  if (globalPrice < minimumMonthFee) {
    ret.addPlanCall(new PlanChargeable(new ChargeableMessage(ChargeableMessage.MESSAGE_MINIMUM_MONTH_FEE),minimumMonthFee - globalPrice,this.getCurrency()));
  }
  return ret;
}
Program: 178314
Project: 178314
Buggy source:
public PlanSummary process(ArrayList<Chargeable> data){
  PlanSummary ret=new PlanSummary(this);
  double globalPrice=0;
  for (  Chargeable chargeable : data) {
    if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      Call call=(Call)chargeable;
      if (call.getType() != Call.CALL_TYPE_SENT) {
        continue;
      }
      double callPrice=0;
      if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) {
        callPrice=0;
      }
 else {
        callPrice=initialPrice + (call.getDuration() * pricePerSecond);
      }
      globalPrice+=callPrice;
      ret.addPlanCall(new PlanChargeable(call,callPrice,this.getCurrency()));
    }
 else     if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_SMS) {
      Sms sms=(Sms)chargeable;
      if (sms.getType() == Sms.SMS_TYPE_RECEIVED) {
        continue;
      }
      globalPrice+=smsPrice;
      ret.addPlanCall(new PlanChargeable(chargeable,smsPrice,this.getCurrency()));
    }
  }
  if (globalPrice < minimumMonthFee) {
    ret.addPlanCall(new PlanChargeable(new ChargeableMessage(ChargeableMessage.MESSAGE_MONTH_FEE),minimumMonthFee - globalPrice,this.getCurrency()));
  }
  return ret;
}

Fixed version (ground truth):
public PlanSummary process(ArrayList<Chargeable> data){
  PlanSummary ret=new PlanSummary(this);
  double globalPrice=0;
  for (  Chargeable chargeable : data) {
    if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_CALL) {
      Call call=(Call)chargeable;
      if (call.getType() != Call.CALL_TYPE_SENT) {
        continue;
      }
      double callPrice=0;
      if (call.getContact().getMsisdnType() == MsisdnType.ES_SPECIAL_ZER0) {
        callPrice=0;
      }
 else {
        callPrice=initialPrice + (call.getDuration() * pricePerSecond);
      }
      globalPrice+=callPrice;
      ret.addPlanCall(new PlanChargeable(call,callPrice,this.getCurrency()));
    }
 else     if (chargeable.getChargeableType() == Chargeable.CHARGEABLE_TYPE_SMS) {
      Sms sms=(Sms)chargeable;
      if (sms.getType() == Sms.SMS_TYPE_RECEIVED) {
        continue;
      }
      globalPrice+=smsPrice;
      ret.addPlanCall(new PlanChargeable(chargeable,smsPrice,this.getCurrency()));
    }
  }
  if (globalPrice < minimumMonthFee) {
    ret.addPlanCall(new PlanChargeable(new ChargeableMessage(ChargeableMessage.MESSAGE_MINIMUM_MONTH_FEE),minimumMonthFee - globalPrice,this.getCurrency()));
  }
  return ret;
}