nus-yam/ex-repair huggingface dataset:
Program: 177615
Project: 177615
Buggy source:
@Override public Command h(String name){
  return null;
}

Fixed version (ground truth):
public Command h(String name){
  return null;
}
Program: 177616
Project: 177616
Buggy source:
@Override public Command closeSubCommand(){
  return null;
}

Fixed version (ground truth):
public Command closeSubCommand(){
  return null;
}
Program: 177617
Project: 177617
Buggy source:
@Override public String getUsageMessage(){
  return null;
}

Fixed version (ground truth):
public String getUsageMessage(){
  return null;
}
Program: 177618
Project: 177618
Buggy source:
@Override public Command addSubCommand(Enum<?> commandEnum){
  return null;
}

Fixed version (ground truth):
public Command addSubCommand(Enum<?> commandEnum){
  return null;
}
Program: 177619
Project: 177619
Buggy source:
@Override public Command setCommandName(String name){
  return null;
}

Fixed version (ground truth):
public Command setCommandName(String name){
  return null;
}
Program: 177620
Project: 177620
Buggy source:
@Override public Command setExecutor(CommandExecutor executor){
  return null;
}

Fixed version (ground truth):
public Command setExecutor(CommandExecutor executor){
  return null;
}
Program: 177621
Project: 177621
Buggy source:
@Override public boolean execute(String[] args,int baseIndex){
  return false;
}

Fixed version (ground truth):
public boolean execute(String[] args,int baseIndex){
  return false;
}
Program: 177622
Project: 177622
Buggy source:
@Override public Command n(String name){
  return null;
}

Fixed version (ground truth):
public Command n(String name){
  return null;
}
Program: 177623
Project: 177623
Buggy source:
@Override public Command s(Enum<?> command){
  return null;
}

Fixed version (ground truth):
public Command s(Enum<?> command){
  return null;
}
Program: 177624
Project: 177624
Buggy source:
@Override public Command setHelpString(String name){
  return null;
}

Fixed version (ground truth):
public Command setHelpString(String name){
  return null;
}
Program: 177625
Project: 177625
Buggy source:
@Override public boolean processCommand(CommandSource source,Command command,Enum<?> commandEnum,String[] args,int baseIndex){
  return false;
}

Fixed version (ground truth):
public boolean processCommand(CommandSource source,Command command,Enum<?> commandEnum,String[] args,int baseIndex){
  return false;
}
Program: 177626
Project: 177626
Buggy source:
public Map<String,Tag> save(T entity){
  Map<String,Tag> result=new HashMap<String,Tag>();
  result.put("String_Node_Str",new StringTag("String_Node_Str",id));
  Location loc=entity.getLocation();
  result.putAll(NbtSerialization.locationToListTags(loc));
  UUID worldUUID=loc.getWorld().getUID();
  result.put("String_Node_Str",new LongTag("String_Node_Str",worldUUID.getLeastSignificantBits()));
  result.put("String_Node_Str",new LongTag("String_Node_Str",worldUUID.getMostSignificantBits()));
  result.put("String_Node_Str",new StringTag("String_Node_Str",loc.getWorld().getName()));
  result.put("String_Node_Str",new IntTag("String_Node_Str",loc.getWorld().getEnvironment().getId()));
  result.putAll(NbtSerialization.locationToListTags(loc));
  result.put("String_Node_Str",NbtSerialization.vectorToListTag(entity.getVelocity()));
  result.put("String_Node_Str",new ByteTag("String_Node_Str",(byte)(entity.isOnGround() ? 1 : 0)));
  return result;
}

Fixed version (ground truth):
public Map<String,Tag> save(T entity){
  Map<String,Tag> result=new HashMap<String,Tag>();
  result.put("String_Node_Str",new StringTag("String_Node_Str",id));
  Location loc=entity.getLocation();
  UUID worldUUID=loc.getWorld().getUID();
  result.put("String_Node_Str",new LongTag("String_Node_Str",worldUUID.getLeastSignificantBits()));
  result.put("String_Node_Str",new LongTag("String_Node_Str",worldUUID.getMostSignificantBits()));
  result.put("String_Node_Str",new StringTag("String_Node_Str",loc.getWorld().getName()));
  result.put("String_Node_Str",new IntTag("String_Node_Str",loc.getWorld().getEnvironment().getId()));
  result.putAll(NbtSerialization.locationToListTags(loc));
  result.put("String_Node_Str",NbtSerialization.vectorToListTag(entity.getVelocity()));
  result.put("String_Node_Str",new ByteTag("String_Node_Str",(byte)(entity.isOnGround() ? 1 : 0)));
  return result;
}
Program: 177627
Project: 177627
Buggy source:
@Override public Map<String,Tag> save(T entity){
  Map<String,Tag> ret=new HashMap<String,Tag>();
  ret.put("String_Node_Str",NbtSerialization.inventoryToTag(entity.getInventory().getContents()));
  Location bed=entity.getBedSpawnLocation();
  if (bed != null) {
    ret.put("String_Node_Str",new IntTag("String_Node_Str",bed.getBlockX()));
    ret.put("String_Node_Str",new IntTag("String_Node_Str",bed.getBlockY()));
    ret.put("String_Node_Str",new IntTag("String_Node_Str",bed.getBlockZ()));
  }
  return ret;
}

Fixed version (ground truth):
@Override public Map<String,Tag> save(T entity){
  Map<String,Tag> ret=super.save(entity);
  ret.put("String_Node_Str",NbtSerialization.inventoryToTag(entity.getInventory().getContents()));
  Location bed=entity.getBedSpawnLocation();
  if (bed != null) {
    ret.put("String_Node_Str",new IntTag("String_Node_Str",bed.getBlockX()));
    ret.put("String_Node_Str",new IntTag("String_Node_Str",bed.getBlockY()));
    ret.put("String_Node_Str",new IntTag("String_Node_Str",bed.getBlockZ()));
  }
  return ret;
}
Program: 177628
Project: 177628
Buggy source:
/** 
 * Unloads the given world.
 * @param world The world to unload
 * @param save Whether to save the chunks before unloading.
 * @return Whether the action was Successful
 */
public boolean unloadWorld(World world,boolean save){
  if (!(world instanceof GlowWorld)) {
    return false;
  }
  if (save) {
    ((GlowWorld)world).save(false);
  }
  if (worlds.contains((GlowWorld)world)) {
    worlds.remove((GlowWorld)world);
    ((GlowWorld)world).unload();
    EventFactory.onWorldUnload((GlowWorld)world);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Unloads the given world.
 * @param world The world to unload
 * @param save Whether to save the chunks before unloading.
 * @return Whether the action was Successful
 */
public boolean unloadWorld(World world,boolean save){
  if (!(world instanceof GlowWorld)) {
    return false;
  }
  if (save) {
    world.setAutoSave(false);
    ((GlowWorld)world).save(false);
  }
  if (worlds.contains((GlowWorld)world)) {
    worlds.remove((GlowWorld)world);
    ((GlowWorld)world).unload();
    EventFactory.onWorldUnload((GlowWorld)world);
    return true;
  }
  return false;
}
Program: 177629
Project: 177629
Buggy source:
public Set<OfflinePlayer> getOperators(){
}

Fixed version (ground truth):
public Set<OfflinePlayer> getOperators(){
  Set<OfflinePlayer> offlinePlayers=new HashSet<OfflinePlayer>();
  for (  String name : opsList.getContents()) {
    offlinePlayers.add(getOfflinePlayer(name));
  }
  return offlinePlayers;
}
Program: 177630
Project: 177630
Buggy source:
/** 
 * Creates or loads a world with the given name using the specified options. <p> If the world is already loaded, it will just return the equivalent of getWorld(creator.name()).
 * @param options Options to use when creating the world
 * @return Newly created or loaded world
 */
public GlowWorld createWorld(WorldCreator creator){
  return createWorld(creator.name(),creator.environment(),creator.seed(),creator.generator());
}

Fixed version (ground truth):
/** 
 * Creates or loads a world with the given name using the specified options. <p> If the world is already loaded, it will just return the equivalent of getWorld(creator.name()).
 * @param creator Options to use when creating the world
 * @return Newly created or loaded world
 */
public GlowWorld createWorld(WorldCreator creator){
  GlowWorld world=getWorld(creator.name());
  if (world != null) {
    return world;
  }
  if (creator.generator() == null) {
    creator.generator(getGenerator(creator.name(),creator.environment()));
  }
  world=new GlowWorld(this,creator.name(),creator.environment(),creator.seed(),new McRegionWorldStorageProvider(new File(creator.name())),creator.generator());
  worlds.add(world);
  return world;
}
Program: 177631
Project: 177631
Buggy source:
public ConsoleManager(GlowServer server,boolean fancy){
  this.server=server;
  this.fancy=fancy;
  sender=new ColoredCommandSender();
  thread=new ConsoleCommandThread();
  handler=new LoggingConsoleHandler();
  handler.setFormatter(new DateOutputFormatter(new SimpleDateFormat()));
  Logger logger=server.getLogger();
  logger.setUseParentHandlers(false);
  logger.addHandler(handler);
  Logger global=Logger.getLogger("String_Node_Str");
  for (  Handler handler : global.getHandlers()) {
    global.removeHandler(handler);
  }
  global.addHandler(handler);
  try {
    reader=new ConsoleReader();
  }
 catch (  IOException ex) {
    server.getLogger().log(Level.SEVERE,"String_Node_Str",ex.getMessage());
    ex.printStackTrace();
  }
  Runtime.getRuntime().addShutdownHook(new ServerShutdownThread());
  thread.setDaemon(true);
  thread.start();
  System.setOut(new PrintStream(new LoggerOutputStream(Level.INFO),true));
  System.setErr(new PrintStream(new LoggerOutputStream(Level.SEVERE),true));
}

Fixed version (ground truth):
public ConsoleManager(GlowServer server,boolean fancy){
  this.server=server;
  this.fancy=fancy;
  sender=new ColoredCommandSender();
  thread=new ConsoleCommandThread();
  consoleHandler=new FancyConsoleHandler();
  String logFile=server.getLogFile();
  if (new File(logFile).getParentFile() != null) {
    new File(logFile).getParentFile().mkdirs();
  }
  fileHandler=new RotatingFileHandler(logFile);
  consoleHandler.setFormatter(new DateOutputFormatter(new SimpleDateFormat("String_Node_Str")));
  fileHandler.setFormatter(new DateOutputFormatter(new SimpleDateFormat("String_Node_Str")));
  Logger logger=Logger.getLogger("String_Node_Str");
  for (  Handler h : logger.getHandlers()) {
    logger.removeHandler(h);
  }
  logger.addHandler(consoleHandler);
  logger.addHandler(fileHandler);
  try {
    reader=new ConsoleReader();
  }
 catch (  IOException ex) {
    server.getLogger().log(Level.SEVERE,"String_Node_Str",ex.getMessage());
    ex.printStackTrace();
  }
  Runtime.getRuntime().addShutdownHook(new ServerShutdownThread());
  thread.setDaemon(true);
  thread.start();
  System.setOut(new PrintStream(new LoggerOutputStream(Level.INFO),true));
  System.setErr(new PrintStream(new LoggerOutputStream(Level.SEVERE),true));
}
Program: 177632
Project: 177632
Buggy source:
public void stop(){
  running=false;
}

Fixed version (ground truth):
public void stop(){
  consoleHandler.flush();
  fileHandler.flush();
  fileHandler.close();
  running=false;
}
Program: 177633
Project: 177633
Buggy source:
@Override public synchronized void flush(){
  try {
    if (fancy) {
      reader.printString(ConsoleReader.RESET_LINE + "String_Node_Str");
      reader.flushConsole();
      super.flush();
      try {
        reader.drawLine();
      }
 catch (      Throwable ex) {
        reader.getCursorBuffer().clearBuffer();
      }
      reader.flushConsole();
    }
 else {
      super.flush();
    }
  }
 catch (  IOException ex) {
    server.getLogger().severe("String_Node_Str");
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
@Override public synchronized void flush(){
  if (!filename.equals(calculateFilename())) {
    filename=calculateFilename();
    server.getLogger().log(Level.INFO,"String_Node_Str",filename);
    try {
      setOutputStream(new FileOutputStream(filename,true));
    }
 catch (    FileNotFoundException ex) {
      server.getLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{filename,ex.getMessage()});
      ex.printStackTrace();
    }
  }
  super.flush();
}
Program: 177634
Project: 177634
Buggy source:
/** 
 * Creates a new server on TCP port 25565 and starts listening for connections.
 * @param args The command-line arguments.
 */
public static void main(String[] args){
  try {
    if (!configDir.exists() || !configDir.isDirectory())     configDir.mkdirs();
    config.load();
    if (config.getKeys().size() == 0) {
      config.setProperty("String_Node_Str",25565);
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str",true);
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.save();
    }
    int port=config.getInt("String_Node_Str",25565);
    GlowServer server=new GlowServer();
    server.bind(new InetSocketAddress(port));
    server.start();
  }
 catch (  Throwable t) {
    logger.log(Level.SEVERE,"String_Node_Str",t);
  }
}

Fixed version (ground truth):
/** 
 * Creates a new server on TCP port 25565 and starts listening for connections.
 * @param args The command-line arguments.
 */
public static void main(String[] args){
  try {
    if (!configDir.exists() || !configDir.isDirectory())     configDir.mkdirs();
    config.load();
    if (config.getKeys().size() == 0) {
      config.setProperty("String_Node_Str",25565);
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str",0);
      config.setProperty("String_Node_Str",16);
      config.setProperty("String_Node_Str",true);
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.setProperty("String_Node_Str","String_Node_Str");
      config.save();
    }
    int port=config.getInt("String_Node_Str",25565);
    GlowServer server=new GlowServer();
    server.bind(new InetSocketAddress(port));
    server.start();
  }
 catch (  Throwable t) {
    logger.log(Level.SEVERE,"String_Node_Str",t);
  }
}
Program: 177635
Project: 177635
Buggy source:
public int getSpawnRadius(){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public int getSpawnRadius(){
  return config.getInt("String_Node_Str",16);
}
Program: 177636
Project: 177636
Buggy source:
public void setSpawnRadius(int value){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
public void setSpawnRadius(int value){
  config.setProperty("String_Node_Str",value);
}
Program: 177637
Project: 177637
Buggy source:
@Override public void handle(Session session,GlowPlayer player,KickMessage message){
  session.disconnect("String_Node_Str");
}

Fixed version (ground truth):
@Override public void handle(Session session,GlowPlayer player,KickMessage message){
  GlowServer.logger.log(Level.INFO,"String_Node_Str",player.getName());
  String text=EventFactory.onPlayerQuit(player).getQuitMessage();
  if (message != null) {
    session.getServer().broadcastMessage(text);
  }
  session.disconnect("String_Node_Str");
}
Program: 177638
Project: 177638
Buggy source:
/** 
 * Disconnects the session with the specified reason. This causes a  {@link KickMessage} to be sent. When it has been delivered, the channelis closed.
 * @param reason The reason for disconnection.
 */
public void disconnect(String reason){
  if (player != null) {
    GlowServer.logger.log(Level.INFO,"String_Node_Str",player.getName());
    PlayerKickEvent event=EventFactory.onPlayerKick(player,reason);
    if (event.isCancelled()) {
      return;
    }
    reason=event.getReason();
    if (event.getLeaveMessage() != null) {
      server.broadcastMessage(event.getLeaveMessage());
    }
    player.remove();
    player=null;
  }
  channel.write(new KickMessage(reason)).addListener(ChannelFutureListener.CLOSE);
}

Fixed version (ground truth):
/** 
 * Disconnects the session with the specified reason. This causes a  {@link KickMessage} to be sent. When it has been delivered, the channelis closed.
 * @param reason The reason for disconnection.
 * @param overrideKick Whether to override the kick event.
 */
public void disconnect(String reason,boolean overrideKick){
  if (player != null && !overrideKick) {
    GlowServer.logger.log(Level.INFO,"String_Node_Str",player.getName());
    PlayerKickEvent event=EventFactory.onPlayerKick(player,reason);
    if (event.isCancelled()) {
      return;
    }
    reason=event.getReason();
    if (event.getLeaveMessage() != null) {
      server.broadcastMessage(event.getLeaveMessage());
    }
  }
  channel.write(new KickMessage(reason)).addListener(ChannelFutureListener.CLOSE);
}
Program: 177639
Project: 177639
Buggy source:
/** 
 * Disposes of this session by destroying the associated player, if there is one.
 */
void dispose(){
  if (player != null) {
    GlowServer.logger.log(Level.INFO,"String_Node_Str",player.getName());
    String message=EventFactory.onPlayerQuit(player).getQuitMessage();
    if (message != null) {
      server.broadcastMessage(message);
    }
    player.remove();
    player=null;
  }
}

Fixed version (ground truth):
/** 
 * Disposes of this session by destroying the associated player, if there is one.
 */
void dispose(){
  if (player != null) {
    player.remove();
    player=null;
  }
}
Program: 177640
Project: 177640
Buggy source:
@Override public ChannelBuffer encode(SpawnMobMessage message) throws IOException {
  ChannelBuffer buffer=ChannelBuffers.buffer(19);
  buffer.writeInt(message.getId());
  buffer.writeByte(message.getType());
  buffer.writeInt(message.getX());
  buffer.writeInt(message.getY());
  buffer.writeInt(message.getZ());
  buffer.writeByte(message.getRotation());
  buffer.writeByte(message.getPitch());
  ChannelBufferUtils.writeParameters(buffer,message.getParameters());
  return buffer;
}

Fixed version (ground truth):
@Override public ChannelBuffer encode(SpawnMobMessage message) throws IOException {
  ChannelBuffer buffer=ChannelBuffers.dynamicBuffer();
  buffer.writeInt(message.getId());
  buffer.writeByte(message.getType());
  buffer.writeInt(message.getX());
  buffer.writeInt(message.getY());
  buffer.writeInt(message.getZ());
  buffer.writeByte(message.getRotation());
  buffer.writeByte(message.getPitch());
  ChannelBufferUtils.writeParameters(buffer,message.getParameters());
  return buffer;
}
Program: 177641
Project: 177641
Buggy source:
public ActivateItemMessage(int id,int item){
  this.id=id;
  this.item=item;
}

Fixed version (ground truth):
public ActivateItemMessage(int slot){
  this.slot=slot;
}
Program: 177642
Project: 177642
Buggy source:
@Override protected Object decode(ChannelHandlerContext ctx,Channel c,ChannelBuffer buf,VoidEnum state) throws Exception {
  int opcode=buf.readUnsignedByte();
  MessageCodec<?> codec=CodecLookupService.find(opcode);
  if (codec == null) {
    throw new IOException("String_Node_Str" + opcode + "String_Node_Str");
  }
  return codec.decode(buf);
}

Fixed version (ground truth):
@Override protected Object decode(ChannelHandlerContext ctx,Channel c,ChannelBuffer buf,VoidEnum state) throws Exception {
  int opcode=buf.readUnsignedByte();
  MessageCodec<?> codec=CodecLookupService.find(opcode);
  if (codec == null) {
    throw new IOException("String_Node_Str" + opcode + "String_Node_Str"+ previousOpcode+ "String_Node_Str");
  }
  previousOpcode=opcode;
  return codec.decode(buf);
}
Program: 177643
Project: 177643
Buggy source:
@Override public ChannelBuffer encode(ActivateItemMessage message) throws IOException {
  ChannelBuffer buffer=ChannelBuffers.buffer(6);
  buffer.writeInt(message.getId());
  buffer.writeShort(message.getItem());
  return buffer;
}

Fixed version (ground truth):
@Override public ChannelBuffer encode(ActivateItemMessage message) throws IOException {
  ChannelBuffer buffer=ChannelBuffers.buffer(6);
  buffer.writeShort(message.getSlot());
  return buffer;
}
Program: 177644
Project: 177644
Buggy source:
@Override public ActivateItemMessage decode(ChannelBuffer buffer) throws IOException {
  int id=buffer.readInt();
  int item=buffer.readShort();
  return new ActivateItemMessage(id,item);
}

Fixed version (ground truth):
@Override public ActivateItemMessage decode(ChannelBuffer buffer) throws IOException {
  int slot=buffer.readUnsignedShort();
  return new ActivateItemMessage(slot);
}
Program: 177645
Project: 177645
Buggy source:
/** 
 * Constructor.
 * @param firstCurrency  the first currency, may be null
 */
public CurrencyMismatchException(CurrencyUnit firstCurrency,CurrencyUnit secondCurrency){
  super("String_Node_Str" + (firstCurrency != null ? firstCurrency.getCode() : "String_Node_Str") + '/'+ (secondCurrency != null ? secondCurrency.getCode() : "String_Node_Str"));
  this.firstCurrency=firstCurrency;
  this.secondCurrency=secondCurrency;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param firstCurrency  the first currency, may be null
 * @param secondCurrency  the second currency, not null
 */
public CurrencyMismatchException(CurrencyUnit firstCurrency,CurrencyUnit secondCurrency){
  super("String_Node_Str" + (firstCurrency != null ? firstCurrency.getCode() : "String_Node_Str") + '/'+ (secondCurrency != null ? secondCurrency.getCode() : "String_Node_Str"));
  this.firstCurrency=firstCurrency;
  this.secondCurrency=secondCurrency;
}
Program: 177646
Project: 177646
Buggy source:
/** 
 * Returns a copy of this monetary value with the amount added. <p> This adds the specified amount to this monetary amount, returning a new object. If the amount to add exceeds the scale of the currency, then the rounding mode will be used to adjust the result. <p> The amount is converted via   {@link BigDecimal#valueOf(double)} which yieldsthe most expected answer for most programming scenarios. Any  {@code double} literal in code will be converted toexactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'. <p> This instance is immutable and unaffected by this method.
 * @param amountToAdd  the monetary value to add, not null
 * @return the new instance with the input amount added, never null
 */
public Money plus(double amountToAdd,RoundingMode roundingMode){
  return with(money.plusRetainScale(amountToAdd,roundingMode));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this monetary value with the amount added. <p> This adds the specified amount to this monetary amount, returning a new object. If the amount to add exceeds the scale of the currency, then the rounding mode will be used to adjust the result. <p> The amount is converted via   {@link BigDecimal#valueOf(double)} which yieldsthe most expected answer for most programming scenarios. Any  {@code double} literal in code will be converted toexactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'. <p> This instance is immutable and unaffected by this method.
 * @param amountToAdd  the monetary value to add, not null
 * @param roundingMode  the rounding mode to use, not null
 * @return the new instance with the input amount added, never null
 */
public Money plus(double amountToAdd,RoundingMode roundingMode){
  return with(money.plusRetainScale(amountToAdd,roundingMode));
}
Program: 177647
Project: 177647
Buggy source:
/** 
 * Returns a copy of this monetary value with the amount subtracted. <p> This subtracts the specified amount from this monetary amount, returning a new object. If the amount to subtract exceeds the scale of the currency, then the rounding mode will be used to adjust the result. <p> The amount is converted via   {@link BigDecimal#valueOf(double)} which yieldsthe most expected answer for most programming scenarios. Any  {@code double} literal in code will be converted toexactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'. <p> This instance is immutable and unaffected by this method.
 * @param amountToSubtract  the monetary value to subtract, not null
 * @return the new instance with the input amount subtracted, never null
 */
public Money minus(double amountToSubtract,RoundingMode roundingMode){
  return with(money.minusRetainScale(amountToSubtract,roundingMode));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this monetary value with the amount subtracted. <p> This subtracts the specified amount from this monetary amount, returning a new object. If the amount to subtract exceeds the scale of the currency, then the rounding mode will be used to adjust the result. <p> The amount is converted via   {@link BigDecimal#valueOf(double)} which yieldsthe most expected answer for most programming scenarios. Any  {@code double} literal in code will be converted toexactly the same BigDecimal with the same scale. For example, the literal '1.45d' will be converted to '1.45'. <p> This instance is immutable and unaffected by this method.
 * @param amountToSubtract  the monetary value to subtract, not null
 * @param roundingMode  the rounding mode to use, not null
 * @return the new instance with the input amount subtracted, never null
 */
public Money minus(double amountToSubtract,RoundingMode roundingMode){
  return with(money.minusRetainScale(amountToSubtract,roundingMode));
}
Program: 177648
Project: 177648
Buggy source:
/** 
 * Returns a copy of this monetary value divided by the specified value. <p> This takes this amount and divides it by the specified value, rounding the result is rounded as specified. <p> This instance is immutable and unaffected by this method.
 * @param valueToDivideBy  the scalar value to divide by, not null
 * @return the new divided instance, never null
 * @throws ArithmeticException if dividing by zero
 * @throws ArithmeticException if the rounding fails
 */
public Money dividedBy(long valueToDivideBy,RoundingMode roundingMode){
  return with(money.dividedBy(valueToDivideBy,roundingMode));
}

Fixed version (ground truth):
/** 
 * Returns a copy of this monetary value divided by the specified value. <p> This takes this amount and divides it by the specified value, rounding the result is rounded as specified. <p> This instance is immutable and unaffected by this method.
 * @param valueToDivideBy  the scalar value to divide by, not null
 * @param roundingMode  the rounding mode to use, not null
 * @return the new divided instance, never null
 * @throws ArithmeticException if dividing by zero
 * @throws ArithmeticException if the rounding fails
 */
public Money dividedBy(long valueToDivideBy,RoundingMode roundingMode){
  return with(money.dividedBy(valueToDivideBy,roundingMode));
}
Program: 177649
Project: 177649
Buggy source:
/** 
 * Checks if this monetary value equals another. <p> The comparison takes into account the scale. The compared values must be in the same currency.
 * @return true if this instance equals the other instance
 */
@Override public boolean equals(Object other){
  if (this == other) {
    return true;
  }
  if (other instanceof Money) {
    Money otherMoney=(Money)other;
    return money.equals(otherMoney.money);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if this monetary value equals another. <p> The comparison takes into account the scale. The compared values must be in the same currency.
 * @param other  the other object to compare to, not null
 * @return true if this instance equals the other instance
 */
@Override public boolean equals(Object other){
  if (this == other) {
    return true;
  }
  if (other instanceof Money) {
    Money otherMoney=(Money)other;
    return money.equals(otherMoney.money);
  }
  return false;
}
Program: 177650
Project: 177650
Buggy source:
/** 
 * Checks if the monetary value is negative and non-zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @return true if the money is non-null and negative
 */
public static boolean isNegative(BigMoneyProvider moneyProvider){
  return (moneyProvider != null && moneyProvider.toBigMoney().isNegative());
}

Fixed version (ground truth):
/** 
 * Checks if the monetary value is negative and non-zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @param moneyProvider  the money to check, null returns false
 * @return true if the money is non-null and negative
 */
public static boolean isNegative(BigMoneyProvider moneyProvider){
  return (moneyProvider != null && moneyProvider.toBigMoney().isNegative());
}
Program: 177651
Project: 177651
Buggy source:
/** 
 * Validates that the object specified is not null
 * @param object  the object to check, not null
 * @throws NullPointerException if the input value is null
 */
static void checkNotNull(Object object,String message){
  if (object == null) {
    throw new NullPointerException(message);
  }
}

Fixed version (ground truth):
/** 
 * Validates that the object specified is not null.
 * @param object  the object to check, not null
 * @throws NullPointerException if the input value is null
 */
static void checkNotNull(Object object,String message){
  if (object == null) {
    throw new NullPointerException(message);
  }
}
Program: 177652
Project: 177652
Buggy source:
/** 
 * Checks if the monetary value is positive or zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @return true if the money is null, zero or positive
 */
public static boolean isPositiveOrZero(BigMoneyProvider moneyProvider){
  return (moneyProvider == null || moneyProvider.toBigMoney().isPositiveOrZero());
}

Fixed version (ground truth):
/** 
 * Checks if the monetary value is positive or zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @param moneyProvider  the money to check, null returns true
 * @return true if the money is null, zero or positive
 */
public static boolean isPositiveOrZero(BigMoneyProvider moneyProvider){
  return (moneyProvider == null || moneyProvider.toBigMoney().isPositiveOrZero());
}
Program: 177653
Project: 177653
Buggy source:
/** 
 * Checks if the monetary value is zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @return true if the money is null or zero
 */
public static boolean isZero(BigMoneyProvider moneyProvider){
  return (moneyProvider == null || moneyProvider.toBigMoney().isZero());
}

Fixed version (ground truth):
/** 
 * Checks if the monetary value is zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @param moneyProvider  the money to check, null returns zero
 * @return true if the money is null or zero
 */
public static boolean isZero(BigMoneyProvider moneyProvider){
  return (moneyProvider == null || moneyProvider.toBigMoney().isZero());
}
Program: 177654
Project: 177654
Buggy source:
/** 
 * Checks if the monetary value is positive and non-zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @return true if the money is non-null and positive
 */
public static boolean isPositive(BigMoneyProvider moneyProvider){
  return (moneyProvider != null && moneyProvider.toBigMoney().isPositive());
}

Fixed version (ground truth):
/** 
 * Checks if the monetary value is positive and non-zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @param moneyProvider  the money to check, null returns false
 * @return true if the money is non-null and positive
 */
public static boolean isPositive(BigMoneyProvider moneyProvider){
  return (moneyProvider != null && moneyProvider.toBigMoney().isPositive());
}
Program: 177655
Project: 177655
Buggy source:
/** 
 * Checks if the monetary value is negative or zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @return true if the money is null, zero or negative
 */
public static boolean isNegativeOrZero(BigMoneyProvider moneyProvider){
  return (moneyProvider == null || moneyProvider.toBigMoney().isNegativeOrZero());
}

Fixed version (ground truth):
/** 
 * Checks if the monetary value is negative or zero, treating null as zero. <p> This method accepts any implementation of   {@code BigMoneyProvider}.
 * @param moneyProvider  the money to check, null returns true
 * @return true if the money is null, zero or negative
 */
public static boolean isNegativeOrZero(BigMoneyProvider moneyProvider){
  return (moneyProvider == null || moneyProvider.toBigMoney().isNegativeOrZero());
}
Program: 177656
Project: 177656
Buggy source:
@Override public void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
  mInitialOffset=(childrenWidth - w) / 2;
  super.scrollTo(mInitialOffset,0);
  mScrollX=mInitialOffset;
  setTime(currentTime,0);
}

Fixed version (ground truth):
@Override public void onSizeChanged(int w,int h,int oldw,int oldh){
  super.onSizeChanged(w,h,oldw,oldh);
  mInitialOffset=(childrenWidth - w) / 2;
  super.scrollTo(mInitialOffset,0);
  mScrollX=mInitialOffset;
  mLastScroll=mInitialOffset;
  setTime(currentTime,0);
}
Program: 177657
Project: 177657
Buggy source:
public SQLiteAndroid(Context context,String dbFilename){
  super(context,dbFilename,null,SQLITE_VERSION);
  SQLiteDatabase db=getWritableDatabase();
  this.db=db;
  this.databaseName=dbFilename;
  typeMapper=new DataTypeMapperImpl();
  executer=new QueryExecutionContainerImpl(this.db);
  grammar=new SQLiteGrammar();
  schemaInspector=new SQLiteSchemaInspector(getExecuter());
  Log.trace("String_Node_Str",this.db.getPath());
}

Fixed version (ground truth):
/** 
 * constructor kept for legacy purposes: all DBs created before this patch will have version '33' and therefore need to specify a version equal or greater (in case of a schema upgrade). where is the db version stored? see: http://stackoverflow.com/questions/3707797/where-does-android-store-sqlite-database-version
 * @deprecated use SQLiteAndroid(Context context, String dbFilename, int version) instead
 */
public SQLiteAndroid(Context context,String dbFilename){
  super(context,dbFilename,null,SQLITE_VERSION);
  init(dbFilename);
}
Program: 177658
Project: 177658
Buggy source:
private int startBulkInsertUsingRegex(){
  return -1;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private int startBulkInsertUsingRegex(){
  StringBuilder fileBuffer;
  Model<E> model;
  Pattern pattern;
  Matcher matcher;
  String[] rowFields;
  boolean atLeastOneMatch=false;
  int matchEnd=0, affectedRecordCount=0;
  if (!createInputStream())   return -1;
  fileBuffer=new StringBuilder(DEFAULT_BUFFER_SIZE);
  while (readBlock(fileBuffer,DEFAULT_BUFFER_SIZE) != -1) {
    pattern=Pattern.compile(this.regExp,Pattern.MULTILINE | Pattern.UNIX_LINES);
    matcher=pattern.matcher(fileBuffer.toString());
    while (matcher.find()) {
      atLeastOneMatch=true;
      matchEnd=matcher.end();
      if ((matcher.groupCount()) != getActualFieldsSize()) {
        Log.error("String_Node_Str",matcher.group(0));
        continue;
      }
      rowFields=new String[getActualFieldsSize()];
      for (int i=0; i < matcher.groupCount(); i++) {
        rowFields[i]=matcher.group(i + 1);
      }
      model=(E)createObjectUsingFields(rowFields);
      if (model != null) {
        model.insert();
        affectedRecordCount++;
      }
 else {
        Log.error("String_Node_Str",matcher.group(0));
      }
    }
    if (atLeastOneMatch) {
      fileBuffer.delete(0,matchEnd);
      atLeastOneMatch=false;
    }
  }
  return affectedRecordCount;
}
Program: 177659
Project: 177659
Buggy source:
private String readStringByLength(int len){
  StringBuilder sb=new StringBuilder(len + 1);
  char val=0;
  while (len-- > 0) {
    val=readChar();
    if (val == -1)     break;
    sb.append(val);
  }
  return sb.toString();
}

Fixed version (ground truth):
private String readStringByLength(int len){
  StringBuilder sb=new StringBuilder(len + 1);
  char val=0;
  while (len-- > 0) {
    val=readChar();
    if (val == (char)-1)     break;
    sb.append(val);
  }
  return sb.toString();
}
Program: 177660
Project: 177660
Buggy source:
public int startBulkInsert(){
  int affectedRecords;
  if (!this.isReady)   return -1;
  if (regExp != null)   affectedRecords=startBulkInsertUsingRegex();
  try {
    affectedRecords=startBulkInsertUsingSeperators();
  }
 catch (  Exception e) {
    Log.error(e.getMessage());
    affectedRecords=-1;
  }
  releaseSourceStream();
  return affectedRecords;
}

Fixed version (ground truth):
public int startBulkInsert(){
  int affectedRecords;
  if (!this.isReady)   return -1;
  if (regExp != null) {
    affectedRecords=startBulkInsertUsingRegex();
  }
 else {
    try {
      affectedRecords=startBulkInsertUsingSeperators();
    }
 catch (    Exception e) {
      Log.error(e.getMessage());
      affectedRecords=-1;
    }
  }
  releaseSourceStream();
  return affectedRecords;
}
Program: 177662
Project: 177662
Buggy source:
private static List<Class<?>> populateClasses(File objectDir,String packageName){
  List<Class<?>> classes=new ArrayList<Class<?>>();
  File[] classFiles=objectDir.listFiles();
  for (  File classFile : classFiles) {
    if (!classFile.isDirectory())     classes.add(getClassFor(classFile,packageName));
 else     classes.addAll(populateClasses(classFile,packageName));
  }
  return classes;
}

Fixed version (ground truth):
private static List<Class<?>> populateClasses(File objectDir,String packageName){
  List<Class<?>> classes=new ArrayList<Class<?>>();
  File[] classFiles=objectDir.listFiles();
  for (  File classFile : classFiles) {
    if (!classFile.isDirectory())     classes.add(getClassFor(classFile,packageName));
 else     if (recursiveScan)     classes.addAll(populateClasses(classFile,packageName));
  }
  return classes;
}
Program: 177664
Project: 177664
Buggy source:
@SuppressWarnings("String_Node_Str") private static Class<?> getClassFor(File classFile,String packageName){
  String fileName=classFile.getName();
  Class classObj=null;
  if (fileName.endsWith("String_Node_Str")) {
    try {
      classObj=Class.forName(packageName + "String_Node_Str" + fileName.substring(0,fileName.length() - 6));
    }
 catch (    ClassNotFoundException e) {
      return null;
    }
  }
  return classObj;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private static Class<?> getClassFor(File classFile,String packageName){
  String fileName=classFile.getName();
  String className;
  Class classObj=null;
  if (fileName.endsWith("String_Node_Str")) {
    try {
      className=packageName != null ? packageName + "String_Node_Str" : "String_Node_Str";
      className+=fileName.substring(0,fileName.length() - 6);
      classObj=Class.forName(className);
    }
 catch (    ClassNotFoundException e) {
      return null;
    }
  }
  return classObj;
}
Program: 177665
Project: 177665
Buggy source:
public static String getWorkingRootPackageName(){
  int i;
  StackTraceElement[] callStack=Thread.currentThread().getStackTrace();
  String rootClass=callStack[callStack.length - 1].getClassName();
  i=rootClass.indexOf('.');
  if (i == -1)   return rootClass;
  return rootClass.substring(0,i);
}

Fixed version (ground truth):
public static String getWorkingRootPackageName(){
  int i;
  StackTraceElement[] callStack=Thread.currentThread().getStackTrace();
  String rootClass=callStack[callStack.length - 1].getClassName();
  i=rootClass.indexOf('.');
  if (i == -1) {
    recursiveScan=false;
    return null;
  }
  return rootClass.substring(0,i);
}
Program: 177666
Project: 177666
Buggy source:
@Override public ResultList executeForResultList(Query q){
  Log.trace(q.getExecutableSql());
  demandConnector.requestConnection();
  try {
    Statement stmt=conn.createStatement();
    stmt.executeQuery(q.getExecutableSql());
    ResultSet rs=stmt.getResultSet();
    ResultSetMetaData rsMeta=rs.getMetaData();
    int columnCount=rsMeta.getColumnCount();
    List<Object[]> result=new ArrayList<Object[]>();
    while (rs.next()) {
      Object[] row=new Object[columnCount];
      for (int colIndex=0; colIndex < columnCount; colIndex++) {
        row[colIndex]=rs.getObject(colIndex + 1);
      }
      result.add(row);
    }
    if (result.size() > 0) {
      Object[][] resultArr=new Object[result.size()][];
      int i=0;
      for (      Object[] row : result)       resultArr[i++]=row;
      String[] columnNames=new String[columnCount];
      for (int j=0; j < columnNames.length; j++) {
        columnNames[j]=rsMeta.getColumnName(j + 1);
      }
      Log.trace("String_Node_Str",result.size());
      return new ResultList(columnNames,resultArr);
    }
  }
 catch (  SQLException ex) {
    throwError(ex);
  }
  return null;
}

Fixed version (ground truth):
@Override public ResultList executeForResultList(Query q){
  Log.trace("String_Node_Str",q);
  demandConnector.requestConnection();
  try {
    Statement stmt=conn.createStatement();
    stmt.executeQuery(q.getExecutableSql());
    ResultSet rs=stmt.getResultSet();
    ResultSetMetaData rsMeta=rs.getMetaData();
    int columnCount=rsMeta.getColumnCount();
    List<Object[]> result=new ArrayList<Object[]>();
    while (rs.next()) {
      Object[] row=new Object[columnCount];
      for (int colIndex=0; colIndex < columnCount; colIndex++) {
        row[colIndex]=rs.getObject(colIndex + 1);
      }
      result.add(row);
    }
    if (result.size() > 0) {
      Object[][] resultArr=new Object[result.size()][];
      int i=0;
      for (      Object[] row : result)       resultArr[i++]=row;
      String[] columnNames=new String[columnCount];
      for (int j=0; j < columnNames.length; j++) {
        columnNames[j]=rsMeta.getColumnName(j + 1);
      }
      Log.trace("String_Node_Str",result.size());
      return new ResultList(columnNames,resultArr);
    }
  }
 catch (  SQLException ex) {
    throwError(ex);
  }
  return null;
}
Program: 177667
Project: 177667
Buggy source:
@Override public Object executeForSingleValue(Query q){
  Log.trace(q.getExecutableSql());
  demandConnector.requestConnection();
  Statement stmt;
  try {
    stmt=conn.createStatement();
    stmt.executeQuery(q.getExecutableSql());
    ResultSet rs=stmt.getResultSet();
    while (rs.next())     return rs.getString(1);
  }
 catch (  SQLException e) {
    throwError(e);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object executeForSingleValue(Query q){
  Log.trace("String_Node_Str",q);
  demandConnector.requestConnection();
  Statement stmt;
  try {
    stmt=conn.createStatement();
    stmt.executeQuery(q.getExecutableSql());
    ResultSet rs=stmt.getResultSet();
    while (rs.next())     return rs.getString(1);
  }
 catch (  SQLException e) {
    throwError(e);
  }
  return null;
}
Program: 177668
Project: 177668
Buggy source:
/** 
 * Only executes the query without obtaining any results. throws  {@link QueryExecutionException} if error occurs.
 */
@Override public void executeOnly(Query q){
  Log.trace(q.getExecutableSql());
  demandConnector.requestConnection();
  try {
    Statement stmt=conn.createStatement();
    stmt.execute(q.getExecutableSql());
  }
 catch (  SQLException e) {
    throwError(e);
  }
}

Fixed version (ground truth):
/** 
 * Only executes the query without obtaining any results. throws  {@link QueryExecutionException} if error occurs.
 */
@Override public void executeOnly(Query q){
  Log.trace("String_Node_Str",q);
  demandConnector.requestConnection();
  try {
    Statement stmt=conn.createStatement();
    stmt.execute(q.getExecutableSql());
  }
 catch (  SQLException e) {
    throwError(e);
  }
}
Program: 177669
Project: 177669
Buggy source:
@Override public void close(){
  if (conn == null)   return;
  try {
    conn.close();
    conn=null;
    Log.info("String_Node_Str");
  }
 catch (  SQLException e) {
    throwError(e);
  }
}

Fixed version (ground truth):
@Override public void close(){
  if (conn == null)   return;
  try {
    conn.close();
    conn=null;
    Log.debug("String_Node_Str");
  }
 catch (  SQLException e) {
    throwError(e);
  }
}
Program: 177670
Project: 177670
Buggy source:
@Override public boolean open(long cookie) throws IllegalConnectionOpenCallException {
  demandConnector.checkCallCookie(cookie);
  Properties props=new Properties();
  props.put("String_Node_Str",this.settings.getUsername());
  props.put("String_Node_Str",this.settings.getPassword());
  try {
    Log.info("String_Node_Str",this.settings.getHost(),this.settings.getPort());
    DriverManager.registerDriver(new Driver());
    conn=DriverManager.getConnection("String_Node_Str" + this.settings.getHost() + "String_Node_Str"+ this.settings.getPort()+ "String_Node_Str"+ this.settings.getDatabase(),props);
    conn.setAutoCommit(this.settings.isAutoCommit());
  }
 catch (  SQLException e) {
    throwError(new DatasourceConnectionException(e.getMessage()));
  }
  if (conn == null) {
    throwError(new DatasourceConnectionException("String_Node_Str"));
    return false;
  }
 else   Log.info("String_Node_Str");
  return true;
}

Fixed version (ground truth):
@Override public boolean open(long cookie) throws IllegalConnectionOpenCallException {
  demandConnector.checkCallCookie(cookie);
  Properties props=new Properties();
  props.put("String_Node_Str",this.settings.getUsername());
  props.put("String_Node_Str",this.settings.getPassword());
  try {
    Log.debug("String_Node_Str",this.settings.getHost(),this.settings.getPort());
    DriverManager.registerDriver(new Driver());
    conn=DriverManager.getConnection("String_Node_Str" + this.settings.getHost() + "String_Node_Str"+ this.settings.getPort()+ "String_Node_Str"+ this.settings.getDatabase(),props);
    conn.setAutoCommit(this.settings.isAutoCommit());
  }
 catch (  SQLException e) {
    throwError(new DatasourceConnectionException(e.getMessage()));
  }
  if (conn == null) {
    throwError(new DatasourceConnectionException("String_Node_Str"));
    return false;
  }
 else   Log.debug("String_Node_Str");
  return true;
}
Program: 177671
Project: 177671
Buggy source:
@Override public ResultList executeForResultList(Query q){
  Log.trace("String_Node_Str" + q);
  demandConnector.requestConnection();
  try {
    SQLiteStatement s=db.prepare(q.getExecutableSql());
    int columnCount=s.columnCount();
    String[] colNames=new String[columnCount];
    List<Object[]> result=new ArrayList<Object[]>();
    int rowIndex=0;
    while (s.step()) {
      Object[] row=new Object[columnCount];
      for (int j=0; j < columnCount; j++) {
        row[j]=s.columnValue(j);
      }
      result.add(row);
      ++rowIndex;
    }
    if (result.size() > 0) {
      Object[][] resultArr=new Object[result.size()][columnCount];
      int i=0;
      for (      Object[] row : result)       resultArr[i++]=row;
      for (int j=0; j < columnCount; j++) {
        colNames[j]=s.getColumnName(j);
      }
      return new ResultList(colNames,resultArr);
    }
  }
 catch (  SQLiteException ex) {
    throwError(ex);
  }
  return null;
}

Fixed version (ground truth):
@Override public ResultList executeForResultList(Query q){
  Log.trace("String_Node_Str",q);
  demandConnector.requestConnection();
  try {
    SQLiteStatement s=db.prepare(q.getExecutableSql());
    int columnCount=s.columnCount();
    String[] colNames=new String[columnCount];
    List<Object[]> result=new ArrayList<Object[]>();
    int rowIndex=0;
    while (s.step()) {
      Object[] row=new Object[columnCount];
      for (int j=0; j < columnCount; j++) {
        row[j]=s.columnValue(j);
      }
      result.add(row);
      ++rowIndex;
    }
    if (result.size() > 0) {
      Object[][] resultArr=new Object[result.size()][columnCount];
      int i=0;
      for (      Object[] row : result)       resultArr[i++]=row;
      for (int j=0; j < columnCount; j++) {
        colNames[j]=s.getColumnName(j);
      }
      return new ResultList(colNames,resultArr);
    }
  }
 catch (  SQLiteException ex) {
    throwError(ex);
  }
  return null;
}