nus-yam/ex-repair huggingface dataset:
Program: 37995
Project: 37995
Buggy source:
public static Optional<UnsafeCodec> factory(CodecSupplier registry,FieldWrapper field){
  Class<?> arrayType=field.type();
  if (arrayType.isArray()) {
    Class<?> componentType=arrayType.getComponentType();
    FieldWrapper componentWrapper=FieldWrapper.clazz(componentType);
    UnsafeCodec componentCodec=registry.getCodec(componentWrapper).orElseThrow(() -> new UnsupportedOperationException("String_Node_Str" + componentWrapper.name()));
    long baseOffset=UnsafeAccess.unsafe.arrayBaseOffset(arrayType);
    long indexScale=UnsafeAccess.unsafe.arrayIndexScale(arrayType);
    ArrayCodec codec=new ArrayCodec(componentType,componentCodec,baseOffset,indexScale);
    return Optional.of(new UnsafeByteCodec<>(codec));
  }
  return Optional.empty();
}

Fixed version (ground truth):
public static Optional<UnsafeCodec> factory(CodecSupplier registry,FieldWrapper field){
  Class<?> arrayType=field.type();
  if (arrayType.isArray()) {
    Class<?> componentType=arrayType.getComponentType();
    FieldWrapper componentWrapper=FieldWrapper.clazz(componentType);
    UnsafeCodec componentCodec=registry.getCodecOrThrow(componentWrapper);
    long baseOffset=UnsafeAccess.unsafe.arrayBaseOffset(arrayType);
    long indexScale=UnsafeAccess.unsafe.arrayIndexScale(arrayType);
    ArrayCodec codec=new ArrayCodec(componentType,componentCodec,baseOffset,indexScale);
    return Optional.of(new UnsafeByteCodec<>(codec));
  }
  return Optional.empty();
}
Program: 37996
Project: 37996
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override protected ByteCodec<C> createCodec(CodecSupplier registry,FieldWrapper field){
  FieldWrapper componentType=field.genericType(0).orElseThrow(() -> new UnsupportedOperationException("String_Node_Str" + field.name()));
  ByteCodec componentCodec=registry.getCodec(componentType).orElseThrow(() -> new UnsupportedOperationException("String_Node_Str" + componentType.name())).toByteCodec();
  return new ByteCodec<C>(){
    @Override public void encode(    ByteBuf target,    C message){
      target.writeInt(message.size());
      for (      Object o : message) {
        componentCodec.encode(target,o);
      }
    }
    @Override public C decode(    ByteBuf encoded){
      int size=encoded.readInt();
      Collection collection=factory.apply(size);
      for (int i=0; i < size; i++) {
        collection.add(componentCodec.decode(encoded));
      }
      return (C)collection;
    }
  }
;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override protected ByteCodec<C> createCodec(CodecSupplier registry,FieldWrapper field){
  FieldWrapper componentType=field.genericTypeOrThrow(0);
  ByteCodec componentCodec=registry.getCodecOrThrow(componentType).toByteCodec();
  return new ByteCodec<C>(){
    @Override public void encode(    ByteBuf target,    C message){
      target.writeInt(message.size());
      for (      Object o : message) {
        componentCodec.encode(target,o);
      }
    }
    @Override public C decode(    ByteBuf encoded){
      int size=encoded.readInt();
      Collection collection=factory.apply(size);
      for (int i=0; i < size; i++) {
        collection.add(componentCodec.decode(encoded));
      }
      return (C)collection;
    }
  }
;
}
Program: 37997
Project: 37997
Buggy source:
@Override public void encode(ByteBuf target,T message){
  if (message.getClass() != type) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  for (  OffsetField field : this.fields) {
    field.codec.write(target,message,field.offset);
  }
}

Fixed version (ground truth):
@Override public void encode(ByteBuf target,T message){
  if (message.getClass() != type) {
    throw new UnsupportedOperationException("String_Node_Str" + message.getClass() + "String_Node_Str"+ type);
  }
  for (  OffsetField field : this.fields) {
    field.codec.write(target,message,field.offset);
  }
}
Program: 37998
Project: 37998
Buggy source:
@Override protected ByteCodec<M> createCodec(CodecSupplier registry,FieldWrapper field){
  FieldWrapper keyType=field.genericType(0).orElseThrow(() -> new UnsupportedOperationException("String_Node_Str" + field.name()));
  ByteCodec keyCodec=registry.getCodec(keyType).orElseThrow(() -> new UnsupportedOperationException("String_Node_Str" + keyType.name())).toByteCodec();
  FieldWrapper valueType=field.genericType(0).orElseThrow(() -> new UnsupportedOperationException("String_Node_Str" + field.name()));
  ByteCodec valueCodec=registry.getCodec(valueType).orElseThrow(() -> new UnsupportedOperationException("String_Node_Str" + valueType.name())).toByteCodec();
  return new ByteCodec<M>(){
    @Override public void encode(    ByteBuf target,    M message){
      target.writeInt(message.size());
      for (      Map.Entry o : message.entrySet()) {
        keyCodec.encode(target,o.getKey());
        valueCodec.encode(target,o.getValue());
      }
    }
    @Override public M decode(    ByteBuf encoded){
      int size=encoded.readInt();
      Map map=factory.apply(size);
      for (int i=0; i < size; i++) {
        Object k=keyCodec.decode(encoded);
        Object v=valueCodec.decode(encoded);
        map.put(k,v);
      }
      return (M)map;
    }
  }
;
}

Fixed version (ground truth):
@Override protected ByteCodec<M> createCodec(CodecSupplier registry,FieldWrapper field){
  FieldWrapper keyType=field.genericTypeOrThrow(0);
  ByteCodec keyCodec=registry.getCodecOrThrow(keyType).toByteCodec();
  FieldWrapper valueType=field.genericTypeOrThrow(1);
  ByteCodec valueCodec=registry.getCodecOrThrow(valueType).toByteCodec();
  return new ByteCodec<M>(){
    @Override public void encode(    ByteBuf target,    M message){
      target.writeInt(message.size());
      for (      Map.Entry o : message.entrySet()) {
        keyCodec.encode(target,o.getKey());
        valueCodec.encode(target,o.getValue());
      }
    }
    @Override public M decode(    ByteBuf encoded){
      int size=encoded.readInt();
      Map map=factory.apply(size);
      for (int i=0; i < size; i++) {
        Object k=keyCodec.decode(encoded);
        Object v=valueCodec.decode(encoded);
        map.put(k,v);
      }
      return (M)map;
    }
  }
;
}
Program: 37999
Project: 37999
Buggy source:
@Override protected void write(Object message,ByteBuf target){
  codecs.getCodec(FieldWrapper.clazz(message.getClass()));
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override protected void write(Object message,ByteBuf target){
  ((ByteCodec)codecs.getCodecOrThrow(FieldWrapper.clazz(message.getClass())).toByteCodec()).encode(target,message);
}
Program: 38000
Project: 38000
Buggy source:
@SuppressWarnings("String_Node_Str") @Override protected <P>void listen(Class<P> type,Consumer<P> handler,Channel<ByteBuf> baseChannel){
  FieldWrapper wrapper=FieldWrapper.clazz(type);
  ByteCodec<P> codec=(ByteCodec<P>)codecs.getCodec(wrapper).orElseThrow(() -> new UnsupportedOperationException("String_Node_Str" + wrapper.name())).toByteCodec();
  baseChannel.subscribe(buf -> {
    P message=codec.decode(buf);
    handler.accept(message);
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override protected <P>void listen(Class<P> type,Consumer<P> handler,Channel<ByteBuf> baseChannel){
  FieldWrapper wrapper=FieldWrapper.clazz(type);
  ByteCodec<P> codec=(ByteCodec<P>)codecs.getCodecOrThrow(wrapper).toByteCodec();
  baseChannel.subscribe(buf -> {
    P message=codec.decode(buf);
    handler.accept(message);
  }
);
}
Program: 38001
Project: 38001
Buggy source:
/** 
 * Get a mutable set of entries that lie behind the given connection.
 */
private Set<T> getTheirEntriesMut(Connection connection){
  return getChannelProperty(PROPERTY_THEIR_ENTRIES,connection,HashSet::new);
}

Fixed version (ground truth):
/** 
 * Get a mutable set of entries that lie behind the given connection.
 */
private Set<T> getTheirEntriesMut(Connection connection){
  return getChannelProperty(PROPERTY_THEIR_ENTRIES,connection,GraphCollectionSynchronizer::newConcurrentSet);
}
Program: 38002
Project: 38002
Buggy source:
/** 
 * Get a mutable set of entries that we have sent to the given connection.
 */
private Set<T> getTransmittedEntries(Connection connection){
  return getChannelProperty(PROPERTY_TRANSMITTED_ENTRIES,connection,HashSet::new);
}

Fixed version (ground truth):
/** 
 * Get a mutable set of entries that we have sent to the given connection.
 */
private Set<T> getTransmittedEntries(Connection connection){
  return getChannelProperty(PROPERTY_TRANSMITTED_ENTRIES,connection,GraphCollectionSynchronizer::newConcurrentSet);
}
Program: 38003
Project: 38003
Buggy source:
/** 
 * Compiles and runs the specified   {@code .java} class. If a filename is setin the engine scope bindings via the  {@link ScriptEngine#FILENAME} key,this method compiles that file and runs the resulting main class instead. <p> The currently active  {@link JavaService} is responsible for running theclass. </p>
 * @param reader the reader producing the source code for a Java class
 * @return null
 */
@Override public Object eval(Reader reader) throws ScriptException {
  String script;
  try {
    script=getReaderContentsAsString(reader);
  }
 catch (  IOException e) {
    throw new ScriptException(e);
  }
  return eval(script);
}

Fixed version (ground truth):
/** 
 * Compiles and runs the specified   {@code .java} class. If a filename is setin the engine scope bindings via the  {@link ScriptEngine#FILENAME} key,this method compiles that file and runs the resulting main class instead. <p> The currently active  {@link RunService} is responsible for running theclass. </p>
 * @param reader the reader producing the source code for a Java class
 * @return null
 */
@Override public Object eval(Reader reader) throws ScriptException {
  String script;
  try {
    script=getReaderContentsAsString(reader);
  }
 catch (  IOException e) {
    throw new ScriptException(e);
  }
  return eval(script);
}
Program: 38004
Project: 38004
Buggy source:
/** 
 * Read complete contents of a Reader and return as String.
 * @param reader {@link Reader} whose output should be returned as String.
 * @return contents of reader as String.
 */
private static String getReaderContentsAsString(Reader reader) throws IOException {
  if (reader == null) {
    return null;
  }
  CharBuffer buffer=CharBuffer.allocate(1024);
  StringBuilder builder=new StringBuilder();
  int read;
  while ((read=reader.read(buffer)) != -1) {
    builder.append(buffer,0,read);
  }
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * Read complete contents of a Reader and return as String.
 * @param reader {@link Reader} whose output should be returned as String.
 * @return contents of reader as String.
 */
private static String getReaderContentsAsString(Reader reader) throws IOException {
  if (reader == null) {
    return null;
  }
  char[] buffer=new char[1024];
  StringBuilder builder=new StringBuilder();
  int read;
  while ((read=reader.read(buffer)) != -1) {
    builder.append(buffer,0,read);
  }
  return builder.toString();
}
Program: 38005
Project: 38005
Buggy source:
public static String getPlayerPrefix(Player player){
  PermissionUser user=pex.getUser(player);
  String s=user.getPrefix().replaceAll("String_Node_Str","String_Node_Str");
  return s;
}

Fixed version (ground truth):
public static String getPlayerPrefix(Player player){
  PermissionUser user=pex.getUser(player);
  String s=user.getPrefix().replaceAll("String_Node_Str","String_Node_Str");
  if (s.length() > 16) {
    s=s.substring(0,15);
  }
  return s;
}
Program: 38006
Project: 38006
Buggy source:
@Override public void onEnable(){
  if (Bukkit.getServer().getPluginManager().getPlugin("String_Node_Str").equals(null)) {
    this.getLogger().info(ChatColor.RED + "String_Node_Str");
    Bukkit.getServer().getPluginManager().disablePlugin(this);
  }
 else {
    Bukkit.getServer().getPluginManager().registerEvents(new Listeners(),this);
    this.saveConfig();
    config=new Config(this);
    config.update();
    config.updateColors();
  }
}

Fixed version (ground truth):
@Override public void onEnable(){
  if (Bukkit.getServer().getPluginManager().getPlugin("String_Node_Str") == null) {
    this.getLogger().info(ChatColor.RED + "String_Node_Str");
    Bukkit.getServer().getPluginManager().disablePlugin(this);
  }
 else {
    Bukkit.getServer().getPluginManager().registerEvents(new Listeners(),this);
    this.saveConfig();
    config=new Config(this);
    config.update();
    config.updateColors();
  }
}
Program: 38007
Project: 38007
Buggy source:
@Override public void onDisable(){
  config=null;
  Pex.pex=null;
  Config.groupColors=null;
}

Fixed version (ground truth):
@Override public void onDisable(){
  Teams.shutdown();
  config=null;
  Pex.pex=null;
  Config.groupColors=null;
}
Program: 38008
Project: 38008
Buggy source:
public static String getPlayerPrefix(Player player){
  PermissionUser user=pex.getUser(player);
  return user.getPrefix();
}

Fixed version (ground truth):
public static String getPlayerPrefix(Player player){
  PermissionUser user=pex.getUser(player);
  String s=user.getPrefix().replaceAll("String_Node_Str","String_Node_Str");
  return s;
}
Program: 38009
Project: 38009
Buggy source:
public static void addColor(Player player){
  ScoreboardManager scoreboardManager=Bukkit.getScoreboardManager();
  Team team=scoreboardManager.getMainScoreboard().registerNewTeam(player.getName());
  team.setPrefix(Pex.getPlayerPrefix(player));
  team.addPlayer(player);
  teams.put(player.getName(),team);
}

Fixed version (ground truth):
public static void addColor(Player player){
  ScoreboardManager scoreboardManager=Bukkit.getScoreboardManager();
  Team team=scoreboardManager.getMainScoreboard().getTeam(player.getName());
  if (team == null) {
    Team t=scoreboardManager.getMainScoreboard().registerNewTeam(player.getName());
    t.setPrefix(Pex.getPlayerPrefix(player) + "String_Node_Str");
    t.addPlayer(player);
  }
 else {
    team.setPrefix(Pex.getPlayerPrefix(player) + "String_Node_Str");
  }
}
Program: 38010
Project: 38010
Buggy source:
@Override public void onEnable(){
  if (Bukkit.getServer().getPluginManager().getPlugin("String_Node_Str").equals(null)) {
    this.getLogger().info(ChatColor.RED + "String_Node_Str");
    Bukkit.getServer().getPluginManager().disablePlugin(this);
  }
 else {
    Bukkit.getServer().getPluginManager().registerEvents(new Listeners(),this);
    this.saveDefaultConfig();
    config=new Config(this);
    config.update();
    config.updateColors();
  }
}

Fixed version (ground truth):
@Override public void onEnable(){
  if (Bukkit.getServer().getPluginManager().getPlugin("String_Node_Str").equals(null)) {
    this.getLogger().info(ChatColor.RED + "String_Node_Str");
    Bukkit.getServer().getPluginManager().disablePlugin(this);
  }
 else {
    Bukkit.getServer().getPluginManager().registerEvents(new Listeners(),this);
    this.saveConfig();
    config=new Config(this);
    config.update();
    config.updateColors();
  }
}
Program: 38011
Project: 38011
Buggy source:
private void println(final String text){
  textArea.appendText(text + System.lineSeparator());
}

Fixed version (ground truth):
private void println(final String text){
  GUIHelper.runSafe(() -> textArea.appendText(text + System.lineSeparator()));
}
Program: 38012
Project: 38012
Buggy source:
private void refreshAllStats(final Game game){
  textArea.clear();
  println("String_Node_Str" + game.getActivePlayer().get().getName());
  println();
  game.getPlayers().forEach(this::showPlayerStats);
}

Fixed version (ground truth):
private void refreshAllStats(final Game game){
  clear();
  println("String_Node_Str" + game.getActivePlayer().get().getName());
  println();
  game.getPlayers().forEach(this::showPlayerStats);
}
Program: 38013
Project: 38013
Buggy source:
public MonsterCard fuseWith(final MonsterCard fuserMonsterCard,final FusionCard fusionCard){
  Objects.requireNonNull(fuserMonsterCard);
  Objects.requireNonNull(fusionCard);
  return fusionCard.getFusionStat().createBuilder(this,fuserMonsterCard,fusionCard).name(getName() + "String_Node_Str" + fuserMonsterCard.getName()).build();
}

Fixed version (ground truth):
public MonsterCard fuseWith(final MonsterCard fuserMonsterCard,final FusionCard fusionCard){
  Objects.requireNonNull(fuserMonsterCard);
  Objects.requireNonNull(fusionCard);
  if (fuserMonsterCard.equals(this)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return fusionCard.getFusionStat().createBuilder(this,fuserMonsterCard,fusionCard).name(getName() + "String_Node_Str" + fuserMonsterCard.getName()).build();
}
Program: 38014
Project: 38014
Buggy source:
public MonsterCard fuseWith(final MonsterCard fuserMonsterCard,final FusionCard fusionCard){
  Objects.requireNonNull(fuserMonsterCard);
  Objects.requireNonNull(fusionCard);
  return fusionCard.getFusionStat().createBuilder(this,fuserMonsterCard,fusionCard).name(getName() + "String_Node_Str" + fuserMonsterCard.getName()).build();
}

Fixed version (ground truth):
public MonsterCard fuseWith(final MonsterCard fuserMonsterCard,final FusionCard fusionCard){
  Objects.requireNonNull(fuserMonsterCard);
  Objects.requireNonNull(fusionCard);
  if (fuserMonsterCard.equals(this)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return fusionCard.getFusionStat().createBuilder(this,fuserMonsterCard,fusionCard).name(getName() + "String_Node_Str" + fuserMonsterCard.getName()).build();
}
Program: 38015
Project: 38015
Buggy source:
private void println(final String text){
  textArea.appendText(text + System.lineSeparator());
}

Fixed version (ground truth):
private void println(final String text){
  GUIHelper.runSafe(() -> textArea.appendText(text + System.lineSeparator()));
}
Program: 38016
Project: 38016
Buggy source:
private void refreshAllStats(final Game game){
  textArea.clear();
  println("String_Node_Str" + game.getActivePlayer().get().getName());
  println();
  game.getPlayers().forEach(this::showPlayerStats);
}

Fixed version (ground truth):
private void refreshAllStats(final Game game){
  clear();
  println("String_Node_Str" + game.getActivePlayer().get().getName());
  println();
  game.getPlayers().forEach(this::showPlayerStats);
}
Program: 38017
Project: 38017
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (Connection.isConnected(context)) {
    Intent serviceIntent=new Intent();
    serviceIntent.setClass(context,UpdateFeedCountService.class);
    if (intent.getStringExtra(Consts.UPDATE_SOURCE) != null) {
      serviceIntent.putExtra(Consts.UPDATE_SOURCE,intent.getStringExtra(Consts.UPDATE_SOURCE));
    }
    context.startService(serviceIntent);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  if (Connection.isConnected(context)) {
    Intent serviceIntent=new Intent();
    serviceIntent.setClass(context,UpdateFeedCountService.class);
    if (intent.getStringExtra(Consts.UPDATE_SOURCE) != null) {
      Log.v(App.TAG,"String_Node_Str" + intent.getStringExtra(Consts.UPDATE_SOURCE));
      serviceIntent.putExtra(Consts.UPDATE_SOURCE,intent.getStringExtra(Consts.UPDATE_SOURCE));
    }
    context.startService(serviceIntent);
  }
}
Program: 38018
Project: 38018
Buggy source:
public void cancel(){
  GetAlarmManager(context).cancel(GetPendingIntent(context,UPDATESOURCE.ALARM));
}

Fixed version (ground truth):
public void cancel(){
  GetAlarmManager(context).cancel(GetPendingIntentAlarm(context,UPDATESOURCE.ALARM));
}
Program: 38019
Project: 38019
Buggy source:
public boolean DoesAlarmExist(){
  PendingIntent existingIntent=PendingIntent.getBroadcast(context,REQUEST_CODE,GetAlarmIntent(UPDATESOURCE.ALARM),PendingIntent.FLAG_NO_CREATE);
  if (existingIntent != null) {
    Log.d(App.TAG,"String_Node_Str");
    return true;
  }
  Log.d(App.TAG,"String_Node_Str");
  return false;
}

Fixed version (ground truth):
public boolean DoesAlarmExist(){
  PendingIntent existingIntent=PendingIntent.getBroadcast(context,REQUEST_CODE,GetIntent(UPDATESOURCE.ALARM),PendingIntent.FLAG_NO_CREATE);
  if (existingIntent != null) {
    Log.d(App.TAG,"String_Node_Str");
    return true;
  }
  Log.d(App.TAG,"String_Node_Str");
  return false;
}
Program: 38020
Project: 38020
Buggy source:
public void Schedule(){
  AlarmManager alarmManager=GetAlarmManager(context);
  long recurInterval=LOWEST_RECUR_INTERVAL * 60 * 60* 1000;
  alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,0,recurInterval,GetPendingIntent(context,UPDATESOURCE.ALARM));
}

Fixed version (ground truth):
public void Schedule(){
  AlarmManager alarmManager=GetAlarmManager(context);
  long recurInterval=LOWEST_RECUR_INTERVAL * 60 * 60* 1000;
  alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,0,recurInterval,GetPendingIntentAlarm(context,UPDATESOURCE.ALARM));
}
Program: 38021
Project: 38021
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  String source=intent.getStringExtra(Consts.UPDATE_SOURCE);
  if (!TextUtils.isEmpty(source)) {
    Log.d(App.TAG,"String_Node_Str" + source);
    if (source.equalsIgnoreCase(UPDATESOURCE.WIDGET_REFRESH_BUTTON.key)) {
      Handler mHandler=new Handler(getMainLooper());
      mHandler.post(new Runnable(){
        @Override public void run(){
          Toast.makeText(getApplicationContext(),getString(R.string.sync_started),Toast.LENGTH_SHORT).show();
        }
      }
);
    }
  }
  appPreferences=new AppPreferences(this);
  if (!appPreferences.IsTokenPresent()) {
    Log.d(App.TAG,"String_Node_Str");
    SendUpdateBroadcast();
    return;
  }
 else {
    if (!Connection.isConnected(this))     return;
    RefreshTokenIfRequired();
    if (source != null) {
      if (source.equalsIgnoreCase(UPDATESOURCE.ALARM.key) || source.equalsIgnoreCase(UPDATESOURCE.NETWORK_CHANGE.key)) {
        if (!CheckLastSync()) {
          Log.d(App.TAG,"String_Node_Str");
          return;
        }
      }
    }
    if (!GetUnreadCountsAndSave())     return;
    appPreferences.SaveSuccessfulSync();
    SendUpdateBroadcast();
    if (appPreferences.GetBoolPreferences(Keys.ENABLE_NOTIFICATIONS)) {
      PrepareAndSendNotifications();
    }
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  Log.d(App.TAG,"String_Node_Str");
  String source=intent.getStringExtra(Consts.UPDATE_SOURCE);
  if (!TextUtils.isEmpty(source)) {
    Log.d(App.TAG,"String_Node_Str" + source);
    if (source.equalsIgnoreCase(UPDATESOURCE.WIDGET_REFRESH_BUTTON.key)) {
      Handler mHandler=new Handler(getMainLooper());
      mHandler.post(new Runnable(){
        @Override public void run(){
          Toast.makeText(getApplicationContext(),getString(R.string.sync_started),Toast.LENGTH_SHORT).show();
        }
      }
);
    }
  }
  appPreferences=new AppPreferences(this);
  if (!appPreferences.IsTokenPresent()) {
    Log.d(App.TAG,"String_Node_Str");
    SendUpdateBroadcast();
    return;
  }
 else {
    if (!Connection.isConnected(this))     return;
    RefreshTokenIfRequired();
    if (source != null) {
      if (source.equalsIgnoreCase(UPDATESOURCE.ALARM.key) || source.equalsIgnoreCase(UPDATESOURCE.NETWORK_CHANGE.key)) {
        if (!CheckLastSync()) {
          Log.d(App.TAG,"String_Node_Str");
          return;
        }
      }
    }
    if (!GetUnreadCountsAndSave())     return;
    appPreferences.SaveSuccessfulSync();
    SendUpdateBroadcast();
    if (appPreferences.GetBoolPreferences(Keys.ENABLE_NOTIFICATIONS)) {
      PrepareAndSendNotifications();
    }
  }
}
Program: 38022
Project: 38022
Buggy source:
@Override public void onDestroy(){
  Log.v(App.TAG,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void onDestroy(){
}
Program: 38023
Project: 38023
Buggy source:
@Override public void onDataSetChanged(){
  Log.v(App.TAG,"String_Node_Str");
  PullData();
}

Fixed version (ground truth):
@Override public void onDataSetChanged(){
  PullData();
}
Program: 38025
Project: 38025
Buggy source:
public PendingIntent GetPendingIntent(Context context,UPDATESOURCE source){
  Intent updateIntent=new Intent();
  updateIntent.setAction(Consts.UPDATE_COUNT_ACTION);
  updateIntent.putExtra(Consts.UPDATE_SOURCE,source.key);
  return PendingIntent.getBroadcast(context,REQUEST_CODE,updateIntent,PendingIntent.FLAG_UPDATE_CURRENT);
}

Fixed version (ground truth):
public PendingIntent GetPendingIntent(Context context,UPDATESOURCE source){
  return PendingIntent.getBroadcast(context,REQUEST_CODE,GetAlarmIntent(source),PendingIntent.FLAG_UPDATE_CURRENT);
}
Program: 38026
Project: 38026
Buggy source:
public void Schedule(){
  AlarmManager alarmManager=GetAlarmManager(context);
  int prefInterval=appPreferences.GetSyncInterval();
  long recurInterval=prefInterval * 60 * 60* 1000;
  alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,0,recurInterval,GetPendingIntent(context,UPDATESOURCE.ALARM));
}

Fixed version (ground truth):
public void Schedule(){
  AlarmManager alarmManager=GetAlarmManager(context);
  long recurInterval=LOWEST_RECUR_INTERVAL * 60 * 60* 1000;
  alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,0,recurInterval,GetPendingIntent(context,UPDATESOURCE.ALARM));
}
Program: 38027
Project: 38027
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  Bundle data=getArguments();
  if (data != null) {
    forceRefresh=data.getBoolean("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
  Bundle data=getArguments();
  if (data != null) {
    forceRefresh=data.getBoolean("String_Node_Str");
  }
  Alarms alarms=new Alarms(getActivity());
  if (!alarms.DoesAlarmExist()) {
    if (alarms.ShouldSchedule())     alarms.Schedule();
  }
}
Program: 38028
Project: 38028
Buggy source:
public static Intent getIntentValue(String value,Intent defaultIntent){
  try {
    if (TextUtils.isEmpty(value)) {
      return defaultIntent;
    }
    Log.v(App.TAG,value);
    Log.v(App.TAG,Intent.parseUri(value,Intent.URI_INTENT_SCHEME).toString());
    return Intent.parseUri(value,Intent.URI_INTENT_SCHEME);
  }
 catch (  URISyntaxException e) {
    Log.e(App.TAG,"String_Node_Str");
    return defaultIntent;
  }
}

Fixed version (ground truth):
public static Intent getIntentValue(String value,Intent defaultIntent){
  try {
    if (TextUtils.isEmpty(value)) {
      return defaultIntent;
    }
    return Intent.parseUri(value,Intent.URI_INTENT_SCHEME);
  }
 catch (  URISyntaxException e) {
    Log.e(App.TAG,"String_Node_Str");
    return defaultIntent;
  }
}
Program: 38029
Project: 38029
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  super.onStartCommand(intent,flags,startId);
  Intent launchIntent;
  launchIntent=new AppPreferences(this).GetWidgetIntent();
  if (launchIntent != null) {
    Log.v(App.TAG,launchIntent.getAction());
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {
      startActivity(launchIntent);
    }
 catch (    Exception e) {
      Log.e(App.TAG,e.getMessage());
      Crittercism.logHandledException(e);
    }
  }
  stopSelf();
  return START_NOT_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  super.onStartCommand(intent,flags,startId);
  Intent launchIntent;
  launchIntent=new AppPreferences(this).GetNotificationIntent();
  if (launchIntent != null) {
    Log.v(App.TAG,launchIntent.getAction());
    launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    try {
      startActivity(launchIntent);
    }
 catch (    Exception e) {
      Log.e(App.TAG,e.getMessage());
      Crittercism.logHandledException(e);
    }
  }
  stopSelf();
  return START_NOT_STICKY;
}
Program: 38030
Project: 38030
Buggy source:
private void PullData(){
  data=new StringFormatter(context).GetResultData(context);
  if (data != null)   widgetData=data.getWidgetData();
 else   widgetData=new ArrayList<WidgetData>();
  if (widgetConfig.getSortOrder() == 0)   Collections.sort(widgetData,new CountSorter());
 else   if (widgetConfig.getSortOrder() == 1)   Collections.sort(widgetData,new NameSorter());
  widgetConfig.RefreshData(new AppPreferences(context));
}

Fixed version (ground truth):
private void PullData(){
  ResultData data=new StringFormatter(context).GetResultData(context);
  if (data != null)   widgetData=data.getWidgetData();
 else   widgetData=new ArrayList<WidgetData>();
  widgetConfig.RefreshData(new AppPreferences(context));
  if (widgetConfig.getSortOrder() == 0)   Collections.sort(widgetData,Collections.reverseOrder(new CountSorter()));
 else   if (widgetConfig.getSortOrder() == 1)   Collections.sort(widgetData,new NameSorter());
}
Program: 38031
Project: 38031
Buggy source:
public static Feedly getInstance(String token){
  if (feedly == null) {
    RestAdapter restAdapter=new RestAdapter.Builder().setEndpoint(Consts.FEEDLY_API_URL).build();
    feedlyApi=restAdapter.create(FeedlyApi.class);
    feedly=new Feedly();
    Feedly.token=token;
    return feedly;
  }
 else   return feedly;
}

Fixed version (ground truth):
public static Feedly getInstance(String token){
  if (feedly == null || Feedly.token == null || !Feedly.token.equalsIgnoreCase(token)) {
    RestAdapter restAdapter=new RestAdapter.Builder().setEndpoint(Consts.FEEDLY_API_URL).build();
    feedlyApi=restAdapter.create(FeedlyApi.class);
    feedly=new Feedly();
    Feedly.token=token;
    return feedly;
  }
 else   return feedly;
}
Program: 38032
Project: 38032
Buggy source:
@Override public void Login(){
  getSupportFragmentManager().beginTransaction().replace(android.R.id.content,new MainFragment()).commit();
}

Fixed version (ground truth):
@Override public void Login(){
  MainFragment mainFragment=new MainFragment();
  Bundle data=new Bundle();
  data.putBoolean("String_Node_Str",true);
  mainFragment.setArguments(data);
  getSupportFragmentManager().beginTransaction().replace(android.R.id.content,mainFragment).commit();
}
Program: 38033
Project: 38033
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setHasOptionsMenu(true);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Log.v(App.TAG,"String_Node_Str");
  setHasOptionsMenu(true);
  Bundle data=getArguments();
  if (data != null) {
    forceRefresh=data.getBoolean("String_Node_Str");
  }
}
Program: 38034
Project: 38034
Buggy source:
private void GetFeedlyData(){
  GetFeedlyData(false);
}

Fixed version (ground truth):
private void GetFeedlyData(boolean forceRefresh){
  String token=appPreferences.GetToken();
  Feedly feedly=Feedly.getInstance(token);
  new GetFeedlyDataTask(feedly,forceRefresh).execute(0);
}
Program: 38035
Project: 38035
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View v=inflater.inflate(R.layout.activity_main,container,false);
  progressBar=(ProgressBar)v.findViewById(R.id.pbHeaderProgress);
  listView=(ExpandableListView)v.findViewById(R.id.listview);
  statusText=(TextView)v.findViewById(R.id.statusMessage);
  listView.setOnGroupClickListener(new OnGroupClickListener(){
    @Override public boolean onGroupClick(    ExpandableListView parent,    View clickedView,    int groupPosition,    long rowId){
      ImageView groupIndicator=(ImageView)clickedView.findViewById(R.id.group_indicator);
      if (parent.isGroupExpanded(groupPosition)) {
        parent.collapseGroup(groupPosition);
        groupIndicator.setImageResource(R.drawable.expander_open_holo_dark);
      }
 else {
        parent.expandGroup(groupPosition);
        groupIndicator.setImageResource(R.drawable.expander_close_holo_dark);
      }
      return true;
    }
  }
);
  appPreferences=new AppPreferences(getActivity());
  if (!appPreferences.IsTokenPresent()) {
    StartLoginProcedure();
  }
 else {
    WebApiHelper.register(getActivity());
    apiHelper=WebApiHelper.getInstance();
    if (apiHelper.shouldRefreshAccesToken()) {
      apiHelper.refreshAccessTokenIfNeeded();
    }
    GetFeedlyData();
  }
  return v;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  Log.v(App.TAG,"String_Node_Str");
  View v=inflater.inflate(R.layout.activity_main,container,false);
  progressBar=(ProgressBar)v.findViewById(R.id.pbHeaderProgress);
  listView=(ExpandableListView)v.findViewById(R.id.listview);
  statusText=(TextView)v.findViewById(R.id.statusMessage);
  listView.setOnGroupClickListener(new OnGroupClickListener(){
    @Override public boolean onGroupClick(    ExpandableListView parent,    View clickedView,    int groupPosition,    long rowId){
      ImageView groupIndicator=(ImageView)clickedView.findViewById(R.id.group_indicator);
      if (parent.isGroupExpanded(groupPosition)) {
        parent.collapseGroup(groupPosition);
        groupIndicator.setImageResource(R.drawable.expander_open_holo_dark);
      }
 else {
        parent.expandGroup(groupPosition);
        groupIndicator.setImageResource(R.drawable.expander_close_holo_dark);
      }
      return true;
    }
  }
);
  appPreferences=new AppPreferences(getActivity());
  if (!appPreferences.IsTokenPresent()) {
    StartLoginProcedure();
  }
 else {
    WebApiHelper.register(getActivity());
    apiHelper=WebApiHelper.getInstance();
    if (apiHelper.shouldRefreshAccesToken()) {
      apiHelper.refreshAccessTokenIfNeeded();
    }
    GetFeedlyData(forceRefresh);
  }
  return v;
}
Program: 38037
Project: 38037
Buggy source:
/** 
 * Returns the number of working (non-failed) PEs on given resource.
 */
private int printRunningPEsOnResource(int resId){
  ResourceInfo ri=null;
  for (int i=0; i < resourceInfoList.size(); i++) {
    ri=(ResourceInfo)resourceInfoList.get(i);
    if (ri.resource.getResourceID() == resId) {
      break;
    }
  }
  return ri.getNumRunningPE();
}

Fixed version (ground truth):
/** 
 * Returns the number of working (non-failed) PEs on given resource.
 */
private int printRunningPEsOnResource(int resId){
  ResourceInfo ri=null;
  for (int i=0; i < resourceInfoList.size(); i++) {
    ri=(ResourceInfo)resourceInfoList.get(i);
    if (ri.resource.getResourceID() == resId) {
      break;
    }
  }
  ri.stable_free=false;
  return ri.getNumRunningPE();
}
Program: 38038
Project: 38038
Buggy source:
@Override boolean onJobEnqueued(ComplexGridlet event){
  dynamic_mgr.notifyJobSubmit(Integer.toString(event.getGridletID()),GridSim.clock());
  next_job=null;
  latest_submit=GridSim.clock();
  latest_runtime=event.getJobLimit();
  latest_CPUs=event.getNumPE();
  latest_gid=event.getGridletID();
  return true;
}

Fixed version (ground truth):
@Override boolean onJobEnqueued(ComplexGridlet event){
  dynamic_mgr.notifyJobSubmit(Integer.toString(event.getGridletID()),GridSim.clock());
  next_job=null;
  if (previous_job != null) {
    double actual_wait=GridSim.clock() - latest_submit;
    if (acceptable_wait >= actual_wait) {
      acceptable_wait-=actual_wait;
    }
 else {
      if (job_count > 0) {
        ExperimentSetup.result_collector.recordLongUserComplain(latest_gid,user_id,this.getEntityName(),GridSim.clock(),(actual_wait / acceptable_wait),job_count);
      }
      acceptable_wait=0;
    }
    if (job_count < 1) {
      acceptable_wait=0;
    }
  }
  job_count++;
  latest_submit=GridSim.clock();
  latest_runtime=event.getJobLimit();
  latest_CPUs=event.getNumPE();
  latest_gid=event.getGridletID();
  acceptable_wait+=((Math.log(latest_CPUs) + 1) * calculateAcceptableWaitingFromWalltime(latest_runtime));
  previous_job=event;
  return true;
}
Program: 38039
Project: 38039
Buggy source:
@Override boolean onJobCompleted(ComplexGridlet event){
  dynamic_mgr.notifyJobCompletion(event,GridSim.clock());
  double feedback=Math.max(0,GridSim.clock() - latest_submit);
  double acceptable_wait=Math.max((think_time * latest_CPUs),latest_runtime * 2);
  if (feedback > acceptable_wait) {
    ExperimentSetup.result_collector.recordUserComplain(latest_gid,user_id,this.getEntityName(),GridSim.clock(),(feedback / acceptable_wait));
  }
  return true;
}

Fixed version (ground truth):
@Override boolean onJobCompleted(ComplexGridlet event){
  dynamic_mgr.notifyJobCompletion(event,GridSim.clock());
  return true;
}
Program: 38040
Project: 38040
Buggy source:
/** 
 * Creates a new instance of JobLoader
 */
public AgentDynamicWithSatisfactionModel(String name,String loader_name,double baudRate,String data_set,int maxPE,int minPErating,int maxPErating,int user_id) throws Exception {
  super(name,loader_name,baudRate);
  dynamic_mgr=new DynamicBatchMgr(name,data_set,maxPE,minPErating,maxPErating);
  this.user_id=user_id;
}

Fixed version (ground truth):
/** 
 * Creates a new instance of AgentDynamicWithSatisfactionModel
 */
public AgentDynamicWithSatisfactionModel(String name,String loader_name,double baudRate,String data_set,int maxPE,int minPErating,int maxPErating,int user_id) throws Exception {
  super(name,loader_name,baudRate);
  dynamic_mgr=new DynamicBatchMgr(name,data_set,maxPE,minPErating,maxPErating);
  this.user_id=user_id;
}
Program: 38041
Project: 38041
Buggy source:
@Override boolean onJobStarted(ComplexGridlet event){
  dynamic_mgr.notifyJobStart(event,GridSim.clock());
  return false;
}

Fixed version (ground truth):
@Override boolean onJobStarted(ComplexGridlet event){
  dynamic_mgr.notifyJobStart(event,GridSim.clock());
  job_count--;
  double actual_wait=GridSim.clock() - latest_submit;
  if (acceptable_wait >= actual_wait) {
  }
 else {
    ExperimentSetup.result_collector.recordLongUserComplain(latest_gid,user_id,this.getEntityName(),GridSim.clock(),(actual_wait / acceptable_wait),job_count);
  }
  return false;
}
Program: 38045
Project: 38045
Buggy source:
public PerformanceResult answer(Reasoner r){
  System.err.println("String_Node_Str");
  PerformanceResult res=this.performanceResultFactory();
  ProductsQuestion pq=this.productsQuestionFactory();
  allFeats=this.getAllFeatures();
  products=(Collection<Product>)pq.getAllProducts();
  deadFeatures=new ArrayList<GenericFeature>();
  Iterator<GenericFeature> it=allFeats.iterator();
  while (it.hasNext()) {
    GenericFeature feat=it.next();
    Iterator<Product> pit=products.iterator();
    boolean isDead=true;
    while (pit.hasNext() && isDead) {
      Product p=pit.next();
      if (p.getFeatures().contains(feat)) {
        isDead=false;
      }
    }
    if (isDead) {
      deadFeatures.add(feat);
    }
  }
  return res;
}

Fixed version (ground truth):
public PerformanceResult answer(Reasoner r){
  System.err.println("String_Node_Str");
  PerformanceResult res=this.performanceResultFactory();
  ProductsQuestion pq=this.productsQuestionFactory();
  allFeats=this.getAllFeatures();
  r.ask(pq);
  products=(Collection<Product>)pq.getAllProducts();
  deadFeatures=new ArrayList<GenericFeature>();
  Iterator<GenericFeature> it=allFeats.iterator();
  while (it.hasNext()) {
    GenericFeature feat=it.next();
    Iterator<Product> pit=products.iterator();
    boolean isDead=true;
    while (pit.hasNext() && isDead) {
      Product p=pit.next();
      if (p.getFeatures().contains(feat)) {
        isDead=false;
      }
    }
    if (isDead) {
      deadFeatures.add(feat);
    }
  }
  return res;
}
Program: 38046
Project: 38046
Buggy source:
/** 
 * Constructor that takes min and max extents. No checking is done that min <= max for all dim i.
 */
public Extents(final long[] min,final long[] max){
  super(min,max);
  numElements=calcNumElements();
}

Fixed version (ground truth):
/** 
 * Constructor that takes min and max extents. No checking is done that  {@code min <= max} for all dim i.
 */
public Extents(final long[] min,final long[] max){
  super(min,max);
  numElements=calcNumElements();
}
Program: 38047
Project: 38047
Buggy source:
/** 
 * Private utility method used to compute the square root of a BigDecimal.
 * @author Luciano Culacciatti
 * @url http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal
 * @param c
 * @param xn
 * @param precision
 */
private static PreciseFixedFloatType sqrtNewtonRaphson(PreciseFixedFloatType c,PreciseFixedFloatType xn,PreciseFixedFloatType precision){
  PreciseFixedFloatType negC=new PreciseFixedFloatType(c);
  negC.negate();
  PreciseFixedFloatType fx=new PreciseFixedFloatType(xn);
  fx.pow(2);
  fx.add(negC);
  PreciseFixedFloatType fpx=new PreciseFixedFloatType();
  fpx.mul(xn,TWO);
  PreciseFixedFloatType xn1=new PreciseFixedFloatType();
  xn1.div(fx,fpx);
  PreciseFixedFloatType negXn1=new PreciseFixedFloatType(xn1);
  negXn1.negate();
  xn1.add(xn,negXn1);
  PreciseFixedFloatType currentSquare=new PreciseFixedFloatType(xn1);
  currentSquare.pow(2);
  PreciseFixedFloatType currentPrecision=new PreciseFixedFloatType();
  currentPrecision.sub(currentSquare,c);
  currentPrecision.abs();
  if (xn.compareTo(xn1) == 0) {
    return xn;
  }
 else   if (currentPrecision.compareTo(precision) > 0) {
    return sqrtNewtonRaphson(c,xn1,precision);
  }
  return xn1;
}

Fixed version (ground truth):
/** 
 * Private utility method used to compute the square root of a BigDecimal.
 * @author Luciano Culacciatti
 * @see <a href="https://www.codeproject.com/tips/257031/implementing-sqrtroot-in-bigdecimal">Implementing SqrtRoot in BigDecimal</a>
 * @param c
 * @param xn
 * @param precision
 */
private static PreciseFixedFloatType sqrtNewtonRaphson(PreciseFixedFloatType c,PreciseFixedFloatType xn,PreciseFixedFloatType precision){
  PreciseFixedFloatType negC=new PreciseFixedFloatType(c);
  negC.negate();
  PreciseFixedFloatType fx=new PreciseFixedFloatType(xn);
  fx.pow(2);
  fx.add(negC);
  PreciseFixedFloatType fpx=new PreciseFixedFloatType();
  fpx.mul(xn,TWO);
  PreciseFixedFloatType xn1=new PreciseFixedFloatType();
  xn1.div(fx,fpx);
  PreciseFixedFloatType negXn1=new PreciseFixedFloatType(xn1);
  negXn1.negate();
  xn1.add(xn,negXn1);
  PreciseFixedFloatType currentSquare=new PreciseFixedFloatType(xn1);
  currentSquare.pow(2);
  PreciseFixedFloatType currentPrecision=new PreciseFixedFloatType();
  currentPrecision.sub(currentSquare,c);
  currentPrecision.abs();
  if (xn.compareTo(xn1) == 0) {
    return xn;
  }
 else   if (currentPrecision.compareTo(precision) > 0) {
    return sqrtNewtonRaphson(c,xn1,precision);
  }
  return xn1;
}
Program: 38048
Project: 38048
Buggy source:
/** 
 * Uses Newton Raphson to compute the square root of a BigDecimal.
 * @author Luciano Culacciatti
 * @url http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal
 * @param c
 */
public static PreciseFixedFloatType sqrt(PreciseFixedFloatType c){
  PreciseFixedFloatType precision=new PreciseFixedFloatType();
  precision.div(ONE,SQRT_PRE);
  return sqrtNewtonRaphson(c,ONE,precision);
}

Fixed version (ground truth):
/** 
 * Uses Newton Raphson to compute the square root of a BigDecimal.
 * @author Luciano Culacciatti
 * @see <a href="https://www.codeproject.com/tips/257031/implementing-sqrtroot-in-bigdecimal">Implementing SqrtRoot in BigDecimal</a>
 * @param c
 */
public static PreciseFixedFloatType sqrt(PreciseFixedFloatType c){
  PreciseFixedFloatType precision=new PreciseFixedFloatType();
  precision.div(ONE,SQRT_PRE);
  return sqrtNewtonRaphson(c,ONE,precision);
}
Program: 38049
Project: 38049
Buggy source:
/** 
 * Finds   {@link URL}s of resources known to ImageJ. <p> Each of the given   {@link URL}s is recursively scanned using SciJava Common's   {@link FileUtils#listContents(URL)}, and anything matching the given   {@code regex} pattern is added to the output map.</li>
 * @param regex The regex to use when matching resources, or null to matcheverything.
 * @param urls Paths to search for resources.
 * @return A map of URLs referencing the matched resources.
 */
public static Map<String,URL> findResources(final String regex,final Iterable<URL> urls){
  final HashMap<String,URL> result=new HashMap<>();
  final Pattern pattern=regex == null ? null : Pattern.compile(regex);
  for (  final URL url : urls) {
    getResources(pattern,result,url);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Finds   {@link URL}s of resources known to ImageJ. <p> Each of the given   {@link URL}s is recursively scanned using SciJava Common's   {@link FileUtils#listContents(URL)}, and anything matching the given   {@code regex} pattern is added to the output map.</p>
 * @param regex The regex to use when matching resources, or null to matcheverything.
 * @param urls Paths to search for resources.
 * @return A map of URLs referencing the matched resources.
 */
public static Map<String,URL> findResources(final String regex,final Iterable<URL> urls){
  final HashMap<String,URL> result=new HashMap<>();
  final Pattern pattern=regex == null ? null : Pattern.compile(regex);
  for (  final URL url : urls) {
    getResources(pattern,result,url);
  }
  return result;
}
Program: 38050
Project: 38050
Buggy source:
/** 
 * Computes a likely-to-be-unique string for this axis. 
 */
private String hashString(final CalibratedAxis axis){
  return axis.type() + "String_Node_Str" + axis.unit()+ "String_Node_Str"+ axis.particularEquation();
}

Fixed version (ground truth):
/** 
 * Computes a likely-to-be-unique string for this axis. 
 */
private String hashString(final CalibratedAxis axis){
  return axis.type().hashCode() + "String_Node_Str" + axis.unit()+ "String_Node_Str"+ axis.particularEquation();
}
Program: 38051
Project: 38051
Buggy source:
/** 
 * @return an array of {@code AxisType}s corresponding to all currently defined axes.
 */
public static AxisType[] knownTypes(){
  return axes.values().toArray(null);
}

Fixed version (ground truth):
/** 
 * @return an array of {@code AxisType}s corresponding to all currently defined axes.
 */
public static AxisType[] knownTypes(){
  return axes.values().toArray(new AxisType[0]);
}
Program: 38052
Project: 38052
Buggy source:
@Override public double averageScale(final int d){
  return averageScale(d);
}

Fixed version (ground truth):
@Override public double averageScale(final int d){
  return axis(d).averageScale(0,1);
}
Program: 38053
Project: 38053
Buggy source:
private void assignDefaultAxes(){
  for (int d=0; d < numDimensions(); d++) {
    setAxis(new IdentityAxis(),d);
  }
}

Fixed version (ground truth):
private void assignDefaultAxes(final int numDimensions){
  for (int d=0; d < numDimensions; d++) {
    setAxis(new IdentityAxis(),d);
  }
}
Program: 38054
Project: 38054
Buggy source:
@Override public String calibratedEquation(){
  return "String_Node_Str" + a + "String_Node_Str"+ b+ "String_Node_Str"+ a+ "String_Node_Str"+ c+ "String_Node_Str"+ c+ "String_Node_Str"+ d+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String calibratedEquation(){
  return "String_Node_Str" + a + "String_Node_Str"+ b+ "String_Node_Str"+ a+ "String_Node_Str"+ c+ "String_Node_Str"+ d+ "String_Node_Str";
}
Program: 38055
Project: 38055
Buggy source:
@Override public double calibratedValue(double rawValue){
  return a + Math.pow((b - a),c) * Math.exp(-(rawValue - c) * (rawValue - c) / (2 * d * d));
}

Fixed version (ground truth):
@Override public double calibratedValue(double rawValue){
  return a + (b - a) * Math.exp(-(rawValue - c) * (rawValue - c) / (2 * d * d));
}
Program: 38056
Project: 38056
Buggy source:
private double calValue(double raw,GaussianAxis axis){
  return axis.a() + Math.pow((axis.b() - axis.a()),axis.c()) * Math.exp(-(raw - axis.c()) * (raw - axis.c()) / (2 * axis.d() * axis.d()));
}

Fixed version (ground truth):
private double calValue(double raw,GaussianAxis axis){
  return axis.a() + (axis.b() - axis.a()) * Math.exp(-(raw - axis.c()) * (raw - axis.c()) / (2 * axis.d() * axis.d()));
}
Program: 38057
Project: 38057
Buggy source:
@Override public double rawValue(double calibratedValue){
  return a + (b - a) / (1 + Math.pow((calibratedValue / c),d));
}

Fixed version (ground truth):
@Override public double rawValue(double calibratedValue){
  double yToTheD=Math.pow(calibratedValue,d);
  double aToTheD=Math.pow(a,d);
  return ((c * yToTheD) + (aToTheD * b)) / (aToTheD + yToTheD);
}