nus-yam/ex-repair huggingface dataset:
Program: 184927
Project: 184927
Buggy source:
public static void main(String[] args) throws ServletException, LifecycleException {
  mLogger=Logger.getLogger(Main.class);
  Main.install("String_Node_Str");
  Main.install("String_Node_Str");
  Main.install("String_Node_Str");
  mLogger.info("String_Node_Str");
  mStatus=Status.INITIALIZING;
  if (!initialize()) {
    mLogger.error("String_Node_Str");
    mStatus=Status.IDLE;
    System.exit(0);
  }
  mLogger.info("String_Node_Str");
  mStatus=Status.STARTING;
  if (!start()) {
    mLogger.error("String_Node_Str");
    mStatus=Status.STOPPING;
    stop();
    mStatus=Status.IDLE;
    System.exit(0);
  }
  mLogger.info("String_Node_Str");
  mStatus=Status.RUNNING;
  while (true) {
    try {
      Thread.sleep(50);
    }
 catch (    InterruptedException e) {
      mLogger.warn("String_Node_Str",e);
      break;
    }
  }
  mLogger.info("String_Node_Str");
  mStatus=Status.STOPPING;
  stop();
  mLogger.info("String_Node_Str");
  mStatus=Status.IDLE;
  System.exit(0);
}

Fixed version (ground truth):
public static void main(final String[] iParameters) throws ServletException, LifecycleException {
  LOGGER=Logger.getLogger(Main.class);
  Main.install("String_Node_Str");
  Main.install("String_Node_Str");
  Main.install("String_Node_Str");
  LOGGER.info("String_Node_Str");
  STATUS=Status.INITIALIZING;
  if (!initialize()) {
    LOGGER.error("String_Node_Str");
    STATUS=Status.IDLE;
    System.exit(0);
  }
  LOGGER.info("String_Node_Str");
  STATUS=Status.STARTING;
  if (!start()) {
    LOGGER.error("String_Node_Str");
    STATUS=Status.STOPPING;
    stop();
    STATUS=Status.IDLE;
    System.exit(0);
  }
  LOGGER.info("String_Node_Str");
  STATUS=Status.RUNNING;
  while (true) {
    try {
      Thread.sleep(50);
    }
 catch (    InterruptedException tException) {
      LOGGER.warn("String_Node_Str",tException);
      break;
    }
  }
  LOGGER.info("String_Node_Str");
  STATUS=Status.STOPPING;
  stop();
  LOGGER.info("String_Node_Str");
  STATUS=Status.IDLE;
  System.exit(0);
}
Program: 184928
Project: 184928
Buggy source:
private static boolean initialize(){
  mSubservices=new EnumMap<ServiceType,Service>(ServiceType.class);
  for (  ServiceType tServiceType : ServiceType.values()) {
    mLogger.debug("String_Node_Str" + mServiceNames.get(tServiceType));
    try {
      Service tService=null;
switch (tServiceType) {
case REPOSITORY:
        tService=new RepositoryMonitor();
      break;
case WEBSITE:
    tService=new EmbeddedTomcat();
  ((EmbeddedTomcat)tService).addWebapp("String_Node_Str");
break;
case NETWORK:
tService=new NetworkMonitor();
break;
case CONTROLLER:
tService=new Controller();
break;
default :
throw new ServiceSetupException("String_Node_Str" + mServiceNames.get(tServiceType));
}
mSubservices.put(tServiceType,tService);
}
 catch (ServiceSetupException e) {
mLogger.error("String_Node_Str" + mServiceNames.get(tServiceType),e);
return false;
}
}
return true;
}

Fixed version (ground truth):
private static boolean initialize(){
  SUBSERVICES=new EnumMap<ServiceType,Service>(ServiceType.class);
  for (  ServiceType tServiceType : ServiceType.values()) {
    LOGGER.debug("String_Node_Str" + cServiceNames.get(tServiceType));
    try {
      Service tService=null;
switch (tServiceType) {
case REPOSITORY:
        tService=new RepositoryMonitor();
      break;
case WEBSITE:
    tService=new EmbeddedTomcat();
  ((EmbeddedTomcat)tService).addWebapp("String_Node_Str");
break;
case NETWORK:
tService=new NetworkMonitor();
break;
case CONTROLLER:
tService=new Controller();
break;
default :
throw new ServiceSetupException("String_Node_Str" + cServiceNames.get(tServiceType));
}
SUBSERVICES.put(tServiceType,tService);
}
 catch (ServiceSetupException tException) {
LOGGER.error("String_Node_Str" + cServiceNames.get(tServiceType),tException);
return false;
}
}
return true;
}
Program: 184929
Project: 184929
Buggy source:
protected final String getProperty(String iKey,String iDefaultValue){
  return mProperties.getProperty(iKey,iDefaultValue);
}

Fixed version (ground truth):
protected final String getProperty(final String iKey,final String iDefaultValue){
  return mProperties.getProperty(iKey,iDefaultValue);
}
Program: 184930
Project: 184930
Buggy source:
private Properties getProperties(String iBasename) throws Exception {
  String tFilename=iBasename + "String_Node_Str";
  InputStream tStream=this.getClass().getClassLoader().getResourceAsStream(tFilename);
  if (tStream == null) {
    getLogger().warn("String_Node_Str" + tFilename + "String_Node_Str");
    return new java.util.Properties();
  }
  Properties oProperties=new java.util.Properties();
  try {
    oProperties.load(tStream);
    return oProperties;
  }
 catch (  IOException e) {
    throw e;
  }
}

Fixed version (ground truth):
private Properties getProperties(final String iBasename) throws Exception {
  String tFilename=iBasename + "String_Node_Str";
  InputStream tStream=this.getClass().getClassLoader().getResourceAsStream(tFilename);
  if (tStream == null) {
    getLogger().warn("String_Node_Str" + tFilename + "String_Node_Str");
    return new java.util.Properties();
  }
  Properties tProperties=new java.util.Properties();
  try {
    tProperties.load(tStream);
    return tProperties;
  }
 catch (  IOException tException) {
    throw tException;
  }
}
Program: 184931
Project: 184931
Buggy source:
public Service() throws ServiceSetupException {
  mLogger=Logger.getLogger(this.getClass());
  try {
    mProperties=getProperties(this.getClass().getSimpleName());
  }
 catch (  Exception e) {
    throw new ServiceSetupException(e);
  }
}

Fixed version (ground truth):
public Service() throws ServiceSetupException {
  mLogger=Logger.getLogger(this.getClass());
  try {
    mProperties=getProperties(this.getClass().getSimpleName());
  }
 catch (  Exception tException) {
    throw new ServiceSetupException(tException);
  }
}
Program: 184932
Project: 184932
Buggy source:
protected Logger getLogger(){
  return mLogger;
}

Fixed version (ground truth):
final protected Logger getLogger(){
  return mLogger;
}
Program: 184933
Project: 184933
Buggy source:
@Override public void doDeviceAdded(Device iDevice){
  getLogger().info("String_Node_Str" + iDevice.getUuid());
  Repository tRepository=Repository.getInstance();
  if (iDevice instanceof Kiosk30) {
    Kiosk30 iKiosk=(Kiosk30)iDevice;
    KioskConfiguration tKioskConfiguration=tRepository.lookupKioskConfiguration(iDevice.getUuid());
    getLogger().debug("String_Node_Str" + tKioskConfiguration.getId() + "String_Node_Str"+ iDevice.getUuid());
    if (tKioskConfiguration != null) {
      try {
        iKiosk.setConfiguration(tKioskConfiguration);
      }
 catch (      DeviceException iException) {
        getLogger().warn("String_Node_Str",iException);
      }
    }
 else     getLogger().warn("String_Node_Str" + iDevice.getUuid() + "String_Node_Str");
  }
 else   getLogger().warn("String_Node_Str");
}

Fixed version (ground truth):
@Override public void doDeviceAdded(Device iDevice){
  getLogger().info("String_Node_Str" + iDevice.getUuid());
  Repository tRepository=Repository.getInstance();
  if (iDevice instanceof Kiosk30) {
    Kiosk30 iKiosk=(Kiosk30)iDevice;
    KioskConfiguration tKioskConfiguration=tRepository.lookupKioskConfiguration(iDevice.getUuid());
    if (tKioskConfiguration != null) {
      getLogger().debug("String_Node_Str" + tKioskConfiguration.getId() + "String_Node_Str"+ iDevice.getUuid());
      try {
        iKiosk.setConfiguration(tKioskConfiguration);
      }
 catch (      DeviceException iException) {
        getLogger().warn("String_Node_Str",iException);
      }
    }
 else     getLogger().warn("String_Node_Str" + iDevice.getUuid() + "String_Node_Str");
  }
 else   getLogger().warn("String_Node_Str");
}
Program: 184934
Project: 184934
Buggy source:
public synchronized Server getServer(String iName){
  return mServers.get(iName);
}

Fixed version (ground truth):
public Server getServer(String iName){
synchronized (this) {
    if (mServers.containsKey(iName))     return new Server(mServers.get(iName));
 else     return null;
  }
}
Program: 184935
Project: 184935
Buggy source:
public synchronized Kiosk getKiosk(String iName){
  return new Kiosk(mKiosks.get(iName));
}

Fixed version (ground truth):
public Kiosk getKiosk(String iName){
synchronized (this) {
    if (mKiosks.containsKey(iName))     return new Kiosk(mKiosks.get(iName));
 else     return null;
  }
}
Program: 184936
Project: 184936
Buggy source:
public synchronized Collection<Kiosk> getKiosks(){
  List tKiosks=new ArrayList<Kiosk>();
  for (  Kiosk tKiosk : mKiosks.values())   tKiosks.add(new Kiosk(tKiosk));
  return tKiosks;
}

Fixed version (ground truth):
public Collection<Kiosk> getKiosks(){
synchronized (this) {
    List tKiosks=new ArrayList<Kiosk>();
    for (    Kiosk tKiosk : mKiosks.values())     tKiosks.add(new Kiosk(tKiosk));
    return tKiosks;
  }
}
Program: 184937
Project: 184937
Buggy source:
public synchronized Collection<Server> getServers(){
  List tServers=new ArrayList<Server>();
  for (  Server tServer : mServers.values())   tServers.add(new Server(tServer));
  return tServers;
}

Fixed version (ground truth):
public Collection<Server> getServers(){
synchronized (this) {
    List tServers=new ArrayList<Server>();
    for (    Server tServer : mServers.values())     tServers.add(new Server(tServer));
    return tServers;
  }
}
Program: 184938
Project: 184938
Buggy source:
public synchronized void updateServer(Server iServerNew) throws TopologyException {
  if (!mServers.containsKey(iServerNew.getName()))   throw new TopologyException("String_Node_Str" + iServerNew.getName());
  Server tServerOld=mServers.remove(iServerNew.getName());
  mServers.put(iServerNew.getName(),iServerNew);
  serverUpdated(tServerOld,iServerNew);
}

Fixed version (ground truth):
public void updateServer(Server iServerNew) throws TopologyException {
  Server tServerOld;
synchronized (this) {
    if (!mServers.containsKey(iServerNew.getName()))     throw new TopologyException("String_Node_Str" + iServerNew.getName());
    tServerOld=mServers.remove(iServerNew.getName());
    mServers.put(iServerNew.getName(),iServerNew);
  }
  serverUpdated(tServerOld,iServerNew);
}
Program: 184939
Project: 184939
Buggy source:
public synchronized void addKiosk(Kiosk iKiosk) throws TopologyException {
  if (mKiosks.containsKey(iKiosk.getName()))   throw new TopologyException("String_Node_Str" + iKiosk.getName());
  mKiosks.put(iKiosk.getName(),iKiosk);
  kioskAdded(iKiosk);
}

Fixed version (ground truth):
public void addKiosk(Kiosk iKiosk) throws TopologyException {
synchronized (this) {
    if (mKiosks.containsKey(iKiosk.getName()))     throw new TopologyException("String_Node_Str" + iKiosk.getName());
    mKiosks.put(iKiosk.getName(),iKiosk);
  }
  kioskAdded(iKiosk);
}
Program: 184940
Project: 184940
Buggy source:
public synchronized void updateKiosk(Kiosk iKioskNew) throws TopologyException {
  if (!mKiosks.containsKey(iKioskNew.getName()))   throw new TopologyException("String_Node_Str" + iKioskNew.getName());
  Kiosk tKioskOld=mKiosks.remove(iKioskNew.getName());
  mKiosks.put(iKioskNew.getName(),iKioskNew);
  kioskUpdated(tKioskOld,iKioskNew);
}

Fixed version (ground truth):
public void updateKiosk(Kiosk iKioskNew) throws TopologyException {
  Kiosk tKioskOld;
synchronized (this) {
    if (!mKiosks.containsKey(iKioskNew.getName()))     throw new TopologyException("String_Node_Str" + iKioskNew.getName());
    tKioskOld=mKiosks.remove(iKioskNew.getName());
    mKiosks.put(iKioskNew.getName(),iKioskNew);
  }
  kioskUpdated(tKioskOld,iKioskNew);
}
Program: 184941
Project: 184941
Buggy source:
public synchronized Collection<Machine> getMachines(){
  Collection<Machine> oMachines=new ArrayList<Machine>();
  oMachines.addAll(getServers());
  oMachines.addAll(getKiosks());
  return oMachines;
}

Fixed version (ground truth):
public Collection<Machine> getMachines(){
synchronized (this) {
    Collection<Machine> oMachines=new ArrayList<Machine>();
    oMachines.addAll(getServers());
    oMachines.addAll(getKiosks());
    return oMachines;
  }
}
Program: 184942
Project: 184942
Buggy source:
public synchronized void addServer(Server iServer) throws TopologyException {
  if (mServers.containsKey(iServer.getName()))   throw new TopologyException("String_Node_Str" + iServer.getName());
  mServers.put(iServer.getName(),iServer);
  serverAdded(iServer);
}

Fixed version (ground truth):
public void addServer(Server iServer) throws TopologyException {
synchronized (this) {
    if (mServers.containsKey(iServer.getName()))     throw new TopologyException("String_Node_Str" + iServer.getName());
    mServers.put(iServer.getName(),iServer);
  }
  serverAdded(iServer);
}
Program: 184943
Project: 184943
Buggy source:
public synchronized void addListener(TopologyListener iListener){
  mListeners.add(iListener);
}

Fixed version (ground truth):
public void addListener(TopologyListener iListener){
synchronized (this) {
    mListeners.add(iListener);
  }
}
Program: 184944
Project: 184944
Buggy source:
public void serviceAddedAction(ServiceEvent iServiceEvent){
  getLogger().info("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str"+ iServiceEvent.getType());
  Kiosk tKiosk=new Kiosk(iServiceEvent.getName());
  try {
    Topology.getInstance().addKiosk(tKiosk);
  }
 catch (  TopologyException e) {
    getLogger().warn("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void serviceAddedAction(ServiceEvent iServiceEvent){
  getLogger().debug("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str"+ iServiceEvent.getType());
  Kiosk tKiosk=new Kiosk(iServiceEvent.getName());
  try {
    Topology.getInstance().addKiosk(tKiosk);
  }
 catch (  Exception e) {
    getLogger().error("String_Node_Str" + iServiceEvent.getName(),e);
  }
}
Program: 184945
Project: 184945
Buggy source:
public void serviceResolvedAction(ServiceEvent iServiceEvent){
  getLogger().info("String_Node_Str" + iServiceEvent.getInfo());
  Kiosk tKiosk=Topology.getInstance().getKiosk(iServiceEvent.getName());
  if (tKiosk != null) {
    tKiosk.setState(State.ONLINE);
    ServiceInfo iServiceInfo=iServiceEvent.getInfo();
    for (    InetAddress tInetAddress : iServiceInfo.getInetAddresses()) {
      tKiosk.addInetAddress(tInetAddress);
    }
  }
 else   getLogger().warn("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str");
}

Fixed version (ground truth):
public void serviceResolvedAction(ServiceEvent iServiceEvent){
  getLogger().debug("String_Node_Str" + iServiceEvent.getInfo());
  try {
    Kiosk tKiosk=Topology.getInstance().getKiosk(iServiceEvent.getName());
    if (tKiosk != null) {
      tKiosk.setState(State.ONLINE);
      ServiceInfo iServiceInfo=iServiceEvent.getInfo();
      for (      InetAddress tInetAddress : iServiceInfo.getInetAddresses()) {
        tKiosk.addInetAddress(tInetAddress);
      }
      Topology.getInstance().updateKiosk(tKiosk);
    }
 else     getLogger().error("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str");
  }
 catch (  Exception e) {
    getLogger().error("String_Node_Str" + iServiceEvent.getName(),e);
  }
}
Program: 184946
Project: 184946
Buggy source:
public void serviceRemovedAction(ServiceEvent iServiceEvent){
  getLogger().info("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str"+ iServiceEvent.getType());
  Kiosk tKiosk=Topology.getInstance().getKiosk(iServiceEvent.getName());
  if (tKiosk != null) {
    tKiosk.setState(State.OFFLINE);
    tKiosk.clearInetAddresses();
  }
 else   getLogger().warn("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str");
}

Fixed version (ground truth):
public void serviceRemovedAction(ServiceEvent iServiceEvent){
  getLogger().debug("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str"+ iServiceEvent.getType());
  try {
    Kiosk tKiosk=Topology.getInstance().getKiosk(iServiceEvent.getName());
    if (tKiosk != null) {
      tKiosk.setState(State.OFFLINE);
      tKiosk.clearInetAddresses();
      Topology.getInstance().updateKiosk(tKiosk);
    }
 else     getLogger().error("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str");
  }
 catch (  Exception e) {
    getLogger().error("String_Node_Str" + iServiceEvent.getName(),e);
  }
}
Program: 184947
Project: 184947
Buggy source:
public void serviceAddedAction(ServiceEvent iServiceEvent){
  getLogger().info("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str"+ iServiceEvent.getType());
  Server tServer=new Server(iServiceEvent.getName());
  try {
    Topology.getInstance().addServer(tServer);
  }
 catch (  TopologyException e) {
    getLogger().warn("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void serviceAddedAction(ServiceEvent iServiceEvent){
  getLogger().debug("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str"+ iServiceEvent.getType());
  Server tServer=new Server(iServiceEvent.getName());
  try {
    Topology.getInstance().addServer(tServer);
  }
 catch (  TopologyException e) {
    getLogger().warn("String_Node_Str" + iServiceEvent.getName(),e);
  }
}
Program: 184948
Project: 184948
Buggy source:
public void serviceResolvedAction(ServiceEvent iServiceEvent){
  getLogger().info("String_Node_Str" + iServiceEvent.getInfo());
  Server tServer=Topology.getInstance().getServer(iServiceEvent.getName());
  if (tServer != null) {
    tServer.setState(State.ONLINE);
    ServiceInfo iServiceInfo=iServiceEvent.getInfo();
    for (    InetAddress tInetAddress : iServiceInfo.getInetAddresses()) {
      tServer.addInetAddress(tInetAddress);
    }
  }
 else   getLogger().warn("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str");
}

Fixed version (ground truth):
public void serviceResolvedAction(ServiceEvent iServiceEvent){
  getLogger().debug("String_Node_Str" + iServiceEvent.getInfo());
  try {
    Server tServer=Topology.getInstance().getServer(iServiceEvent.getName());
    if (tServer != null) {
      tServer.setState(State.ONLINE);
      ServiceInfo iServiceInfo=iServiceEvent.getInfo();
      for (      InetAddress tInetAddress : iServiceInfo.getInetAddresses()) {
        tServer.addInetAddress(tInetAddress);
      }
      Topology.getInstance().updateServer(tServer);
    }
 else     getLogger().warn("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str");
  }
 catch (  Exception e) {
    getLogger().error("String_Node_Str" + iServiceEvent.getName(),e);
  }
}
Program: 184949
Project: 184949
Buggy source:
public void serviceRemovedAction(ServiceEvent iServiceEvent){
  getLogger().info("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str"+ iServiceEvent.getType());
  Server tServer=Topology.getInstance().getServer(iServiceEvent.getName());
  if (tServer != null) {
    tServer.setState(State.OFFLINE);
    tServer.clearInetAddresses();
  }
 else   getLogger().warn("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str");
}

Fixed version (ground truth):
public void serviceRemovedAction(ServiceEvent iServiceEvent){
  getLogger().debug("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str"+ iServiceEvent.getType());
  try {
    Server tServer=Topology.getInstance().getServer(iServiceEvent.getName());
    if (tServer != null) {
      tServer.setState(State.OFFLINE);
      tServer.clearInetAddresses();
      Topology.getInstance().updateServer(tServer);
    }
 else     getLogger().warn("String_Node_Str" + iServiceEvent.getName() + "String_Node_Str");
  }
 catch (  Exception e) {
    getLogger().error("String_Node_Str" + iServiceEvent.getName(),e);
  }
}
Program: 184950
Project: 184950
Buggy source:
@Override public void stop() throws ServiceRunException {
}

Fixed version (ground truth):
@Override public void stop() throws ServiceRunException {
  Topology.getInstance().removeListener(this);
}
Program: 184951
Project: 184951
Buggy source:
@Override public void run() throws ServiceRunException {
}

Fixed version (ground truth):
@Override public void run() throws ServiceRunException {
  Topology.getInstance().addListener(this);
}
Program: 184952
Project: 184952
Buggy source:
void apply(Sound iSound){
  if (iSound.enabled != null)   enabled=iSound.enabled;
  if (iSound.volume != null)   volume=iSound.volume;
}

Fixed version (ground truth):
void apply(Sound iSound){
  if (iSound == null)   return;
  if (iSound.enabled != null)   enabled=iSound.enabled;
  if (iSound.volume != null)   volume=iSound.volume;
}
Program: 184953
Project: 184953
Buggy source:
abstract public void run() throws ServiceRunException ;

Fixed version (ground truth):
/** 
 * The run() method starts the service, but should be non blocking.
 * @throws ServiceRunException
 */
abstract public void run() throws ServiceRunException ;
Program: 184954
Project: 184954
Buggy source:
public RepositoryMonitor() throws ServiceSetupException {
  DAVRepositoryFactory.setup();
  mDAVLocation="String_Node_Str" + getProperty("String_Node_Str","String_Node_Str") + getProperty("String_Node_Str","String_Node_Str");
  getLogger().debug("String_Node_Str" + mDAVLocation);
  try {
    SVNURL tSVNLocation=SVNURL.parseURIDecoded(mDAVLocation);
    mSVNRepository=SVNRepositoryFactory.create(tSVNLocation,null);
  }
 catch (  SVNException e) {
    throw new ServiceSetupException(e);
  }
}

Fixed version (ground truth):
public RepositoryMonitor() throws ServiceSetupException {
  DAVRepositoryFactory.setup();
  mDAVLocation="String_Node_Str" + getProperty("String_Node_Str","String_Node_Str") + getProperty("String_Node_Str","String_Node_Str");
  getLogger().debug("String_Node_Str" + mDAVLocation);
  try {
    SVNURL tSVNLocation=SVNURL.parseURIDecoded(mDAVLocation);
    mSVNRepository=SVNRepositoryFactory.create(tSVNLocation,null);
  }
 catch (  SVNException e) {
    throw new ServiceSetupException(e);
  }
  Integer iInterval=Integer.parseInt(getProperty("String_Node_Str","String_Node_Str"));
  if (iInterval <= 0)   throw new ServiceSetupException("String_Node_Str");
  getLogger().debug("String_Node_Str" + iInterval + "String_Node_Str");
  mSVNMonitor=new Timer();
  mSVNMonitorInterval=iInterval;
}
Program: 184955
Project: 184955
Buggy source:
@Override public void run() throws ServiceRunException {
  checkout();
}

Fixed version (ground truth):
@Override public void run() throws ServiceRunException {
  checkout();
  mSVNMonitor.schedule(new Monitor(),mSVNMonitorInterval * 1000);
}
Program: 184956
Project: 184956
Buggy source:
void checkout() throws ServiceRunException {
  try {
    long tSVNRepositoryRevision=mSVNRepository.getLatestRevision();
    getLogger().debug("String_Node_Str");
    ISVNReporterBaton tConfigurationBaton=new DummyBaton(tSVNRepositoryRevision);
    ISVNEditor tConfigurationEditor=new ConfigurationEditor();
    mSVNRepository.update(tSVNRepositoryRevision,"String_Node_Str",true,tConfigurationBaton,tConfigurationEditor);
    getLogger().debug("String_Node_Str");
    ISVNReporterBaton tKioskBaton=new DummyBaton(tSVNRepositoryRevision);
    ISVNEditor tKioskEditor=new KioskConfigurationEditor();
    mSVNRepository.update(tSVNRepositoryRevision,"String_Node_Str",true,tKioskBaton,tKioskEditor);
  }
 catch (  SVNException e) {
    getLogger().error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
void checkout() throws ServiceRunException {
  try {
    mSVNRevision=mSVNRepository.getLatestRevision();
    getLogger().debug("String_Node_Str");
    ISVNReporterBaton tConfigurationBaton=new DummyBaton(mSVNRevision);
    ISVNEditor tConfigurationEditor=new ConfigurationEditor();
    mSVNRepository.update(mSVNRevision,"String_Node_Str",true,tConfigurationBaton,tConfigurationEditor);
    getLogger().debug("String_Node_Str");
    ISVNReporterBaton tKioskBaton=new DummyBaton(mSVNRevision);
    ISVNEditor tKioskEditor=new KioskConfigurationEditor();
    mSVNRepository.update(mSVNRevision,"String_Node_Str",true,tKioskBaton,tKioskEditor);
  }
 catch (  SVNException e) {
    getLogger().error("String_Node_Str",e);
  }
}
Program: 184957
Project: 184957
Buggy source:
public RegistrationConsumerImpl() throws RemoteException {
  super();
  String exp=ContainerConfig.getConfig().getOption(SPRING_CLASSPATH_EXPRESSION,DEFAULT_SPRING_CLASSPATH_EXPRESSION);
  String bean=ContainerConfig.getConfig().getOption(REGISTRATION_CONSUMER_BEAN_NAME,DEFAULT_REGISTRATION_CONSUMER_BEAN_NAME);
  if (this.getClass().getResourceAsStream(exp) == null) {
    System.out.print("String_Node_Str");
    this.consumer=new EchoRegistrationConsumer();
  }
 else {
    System.out.print("String_Node_Str");
    ApplicationContext ctx=new ClassPathXmlApplicationContext(exp);
    this.consumer=(RegistrationConsumerI)ctx.getBean(bean);
  }
}

Fixed version (ground truth):
public RegistrationConsumerImpl() throws RemoteException {
  super();
  String exp=ContainerConfig.getConfig().getOption(SPRING_CLASSPATH_EXPRESSION,DEFAULT_SPRING_CLASSPATH_EXPRESSION);
  String bean=ContainerConfig.getConfig().getOption(REGISTRATION_CONSUMER_BEAN_NAME,DEFAULT_REGISTRATION_CONSUMER_BEAN_NAME);
  if (this.getClass().getResourceAsStream(DEFAULT_APPCONTEXT_XML_PATH) == null) {
    System.out.print("String_Node_Str");
    this.consumer=new EchoRegistrationConsumer();
  }
 else {
    System.out.print("String_Node_Str");
    ApplicationContext ctx=new ClassPathXmlApplicationContext(exp);
    this.consumer=(RegistrationConsumerI)ctx.getBean(bean);
  }
}
Program: 184958
Project: 184958
Buggy source:
@Override protected Object getKeyObject(ResultSet rs,String colname) throws SQLException {
  return rs.getObject(colname);
}

Fixed version (ground truth):
@Override protected Object getKeyObject(ResultSet rs,String colname) throws SQLException {
  return rs.getInt(colname);
}
Program: 184959
Project: 184959
Buggy source:
public void testGetKeyObject() throws Exception {
  ResultSet rs=createMock(ResultSet.class);
  expect(rs.getObject("String_Node_Str")).andReturn(7);
  replay(rs);
  assertEquals(7,type.getKeyObject(rs,"String_Node_Str"));
  verifyMocks();
}

Fixed version (ground truth):
public void testGetKeyObject() throws Exception {
  ResultSet rs=createMock(ResultSet.class);
  expect(rs.getInt("String_Node_Str")).andReturn(7);
  replay(rs);
  assertEquals(7,type.getKeyObject(rs,"String_Node_Str"));
  verifyMocks();
}
Program: 184960
Project: 184960
Buggy source:
/** 
 * Create a transient copy of the source configuration.
 * @param source
 */
public static void create(Configuration source){
  TransientConfiguration copy=new TransientConfiguration(source.getProperties());
  copy.copyFrom(source);
}

Fixed version (ground truth):
/** 
 * Create a transient copy of the source configuration.
 * @param source
 */
public static Configuration create(Configuration source){
  TransientConfiguration copy=new TransientConfiguration(source.getProperties());
  copy.copyFrom(source);
  return copy;
}
Program: 184961
Project: 184961
Buggy source:
public Tab<C> getTargetTab(){
  int defaultTarget=getNumber() + 1;
  return getFlow().getTab(defaultTarget);
}

Fixed version (ground truth):
public Tab<C> getTargetTab(){
  int defaultTarget=Math.min(getNumber() + 1,getFlow().getTabCount() - 1);
  return getFlow().getTab(defaultTarget);
}
Program: 184962
Project: 184962
Buggy source:
public static void main(String[] args){
  final URI employeeUri=createEmployee("String_Node_Str");
  System.out.println("String_Node_Str" + employeeUri);
  Employee employee=getEmployee(employeeUri);
  System.out.println("String_Node_Str" + employee);
  deleteEmployee(employeeUri);
  try {
    getEmployee(employeeUri);
    System.out.println("String_Node_Str" + employeeUri + "String_Node_Str");
  }
 catch (  UniformInterfaceException e) {
    if (e.getResponse().getClientResponseStatus() != Status.NOT_FOUND) {
      throw new RuntimeException("String_Node_Str" + describeStatus(e.getResponse()));
    }
 else {
      System.out.println("String_Node_Str" + e.getResponse().toString());
    }
  }
  employee.name="String_Node_Str";
  updateEmployee(employee,employeeUri);
  Employee updatedEmployee=getEmployee(employeeUri);
  System.out.println("String_Node_Str" + updatedEmployee);
}

Fixed version (ground truth):
public static void main(String[] args){
  final URI employeeUri=createEmployee("String_Node_Str");
  System.out.println("String_Node_Str" + employeeUri);
  Employee employee=getEmployee(employeeUri);
  System.out.println("String_Node_Str" + employee);
  employee.name="String_Node_Str";
  updateEmployee(employee,employeeUri);
  Employee updatedEmployee=getEmployee(employeeUri);
  System.out.println("String_Node_Str" + updatedEmployee);
  if (!updatedEmployee.name.equals(employee.name)) {
    throw new RuntimeException("String_Node_Str" + employee.name + "String_Node_Str"+ updatedEmployee.name);
  }
  deleteEmployee(employeeUri);
  try {
    getEmployee(employeeUri);
    throw new RuntimeException("String_Node_Str" + employeeUri + "String_Node_Str");
  }
 catch (  UniformInterfaceException e) {
    if (e.getResponse().getClientResponseStatus() != Status.NOT_FOUND) {
      throw new RuntimeException("String_Node_Str" + describeStatus(e.getResponse()));
    }
 else {
      System.out.println("String_Node_Str" + e.getResponse().toString());
    }
  }
}
Program: 184963
Project: 184963
Buggy source:
private void addTitle(int index){
  Label titleLabel=getLabel((index + 1) + "String_Node_Str" + file.getName());
  titleLabel.setFont(Constants.HEADER_2);
  titleLabel.addMouseListener(getMouseListener("String_Node_Str" + file.getName(),new Work(){
    @Override public void executeWork(){
      BufferedImage previewImage=file.getImage();
      int index=1;
      for (      WallpaperScreen screen : Manager.get().getEngineSettings().getScreens()) {
        int x=screen.getX();
        int y=screen.getY();
        int x2=x + screen.getWidth();
        int y2=y + screen.getHeight();
        int xMid=x + screen.getWidth() / 2;
        int yMid=y + screen.getHeight() / 2;
        int backgroundSize=40;
        Graphics2D g2=(Graphics2D)previewImage.getGraphics();
        g2.setColor(new Color(0,0,0,100));
        g2.fillOval(xMid - backgroundSize,yMid - backgroundSize,backgroundSize * 2,backgroundSize * 2);
        g2.setStroke(new BasicStroke(5));
        g2.setColor(Color.black);
        g2.drawRect(x,y,x2,y2);
        g2.setFont(new Font("String_Node_Str",Font.PLAIN,45));
        g2.drawString(index + "String_Node_Str",xMid - 15,yMid + 15);
        index++;
      }
      Manager.get().showPreview(previewImage,"String_Node_Str" + file.getName());
    }
  }
));
  content.add(titleLabel);
}

Fixed version (ground truth):
private void addTitle(int index){
  Label titleLabel=getLabel((index + 1) + "String_Node_Str" + file.getName());
  titleLabel.setFont(Constants.HEADER_2);
  titleLabel.addMouseListener(getMouseListener("String_Node_Str" + file.getName(),new Work(){
    @Override public void executeWork(){
      BufferedImage previewImage=file.getImage();
      int index=1;
      for (      WallpaperScreen screen : Manager.get().getEngineSettings().getScreens()) {
        int x=screen.getX();
        int y=screen.getY();
        int x2=x + screen.getWidth();
        int y2=y + screen.getHeight();
        int xMid=x + screen.getWidth() / 2;
        int yMid=y + screen.getHeight() / 2;
        int backgroundSize=40;
        Graphics2D g2=(Graphics2D)previewImage.getGraphics();
        g2.setColor(new Color(0,0,0,100));
        g2.fillOval(xMid - backgroundSize,yMid - backgroundSize,backgroundSize * 2,backgroundSize * 2);
        g2.setStroke(new BasicStroke(5));
        g2.setColor(Color.black);
        g2.drawRect(x,y,x2,y2);
        g2.setColor(Color.white);
        g2.setFont(new Font("String_Node_Str",Font.PLAIN,45));
        g2.drawString(index + "String_Node_Str",xMid - 15,yMid + 15);
        index++;
      }
      Manager.get().showPreview(previewImage,"String_Node_Str" + file.getName());
    }
  }
));
  content.add(titleLabel);
}
Program: 184964
Project: 184964
Buggy source:
@Override public void run(){
  super.run();
  run=true;
  while (run) {
    try {
      long startTime=System.currentTimeMillis();
      listener.updateWallpaper();
      long remainingMillis=sleepMillis - (System.currentTimeMillis() - startTime);
      sleep(remainingMillis);
    }
 catch (    InterruptedException e) {
      run=false;
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  super.run();
  run=true;
  while (run) {
    long startTime=System.currentTimeMillis();
    listener.updateWallpaper();
    long remainingMillis=sleepMillis - (System.currentTimeMillis() - startTime);
    if (remainingMillis > 0) {
      try {
        sleep(remainingMillis);
      }
 catch (      InterruptedException e) {
        run=false;
      }
    }
  }
}
Program: 184966
Project: 184966
Buggy source:
private long copyBackupToFile(BackupDataInput data,File file,int toRead) throws IOException {
  final int CHUNK=8192;
  byte[] buf=new byte[CHUNK];
  CRC32 crc=new CRC32();
  FileOutputStream out=new FileOutputStream(file);
  while (toRead > 0) {
    int numRead=data.readEntityData(buf,0,CHUNK);
    crc.update(buf,0,numRead);
    out.write(buf,0,numRead);
    toRead-=numRead;
  }
  out.close();
  return crc.getValue();
}

Fixed version (ground truth):
private long copyBackupToFile(BackupDataInput data,File file,int toRead) throws IOException {
  final int CHUNK=8192;
  byte[] buf=new byte[CHUNK];
  CRC32 crc=new CRC32();
  FileOutputStream out=new FileOutputStream(file);
  try {
    while (toRead > 0) {
      int numRead=data.readEntityData(buf,0,CHUNK);
      crc.update(buf,0,numRead);
      out.write(buf,0,numRead);
      toRead-=numRead;
    }
  }
  finally {
    if (out != null) {
      out.close();
    }
  }
  return crc.getValue();
}
Program: 184968
Project: 184968
Buggy source:
private void copyFileToBackup(String key,File file,BackupDataOutput data) throws IOException {
  final int CHUNK=8192;
  byte[] buf=new byte[CHUNK];
  int toCopy=(int)file.length();
  data.writeEntityHeader(key,toCopy);
  FileInputStream in=new FileInputStream(file);
  int nRead;
  while (toCopy > 0) {
    nRead=in.read(buf,0,CHUNK);
    data.writeEntityData(buf,nRead);
    toCopy-=nRead;
  }
  in.close();
}

Fixed version (ground truth):
private void copyFileToBackup(String key,File file,BackupDataOutput data) throws IOException {
  final int CHUNK=8192;
  byte[] buf=new byte[CHUNK];
  int toCopy=(int)file.length();
  data.writeEntityHeader(key,toCopy);
  FileInputStream in=new FileInputStream(file);
  try {
    int nRead;
    while (toCopy > 0) {
      nRead=in.read(buf,0,CHUNK);
      data.writeEntityData(buf,nRead);
      toCopy-=nRead;
    }
  }
  finally {
    if (in != null) {
      in.close();
    }
  }
}
Program: 184969
Project: 184969
Buggy source:
private void writeBackupState(long fileSize,long crc,ParcelFileDescriptor stateFile) throws IOException {
  DataOutputStream out=new DataOutputStream(new FileOutputStream(stateFile.getFileDescriptor()));
  out.writeLong(fileSize);
  out.writeLong(crc);
  out.writeInt(BACKUP_AGENT_VERSION);
}

Fixed version (ground truth):
private void writeBackupState(long fileSize,long crc,ParcelFileDescriptor stateFile) throws IOException {
  DataOutputStream out=new DataOutputStream(new FileOutputStream(stateFile.getFileDescriptor()));
  try {
    out.writeLong(fileSize);
    out.writeLong(crc);
    out.writeInt(BACKUP_AGENT_VERSION);
  }
  finally {
    if (out != null) {
      out.close();
    }
  }
}
Program: 184971
Project: 184971
Buggy source:
public void write() throws IOException {
  FileWriter output=null;
  OutputStreamWriter writer=null;
  if (mFile.exists()) {
    mFile.delete();
  }
  try {
    output=new FileWriter(mFile);
    output.write(iteration + newLine);
    output.write(page + newLine);
    output.write(url + newLine);
  }
  finally {
    try {
      if (writer != null) {
        writer.close();
      }
    }
  finally {
      if (output != null) {
        output.close();
      }
    }
  }
}

Fixed version (ground truth):
public void write() throws IOException {
  FileWriter output=null;
  if (mFile.exists()) {
    mFile.delete();
  }
  try {
    output=new FileWriter(mFile);
    output.write(iteration + newLine);
    output.write(page + newLine);
    output.write(url + newLine);
  }
  finally {
    if (output != null) {
      output.close();
    }
  }
}
Program: 184973
Project: 184973
Buggy source:
private long copyBackupToFile(BackupDataInput data,File file,int toRead) throws IOException {
  final int CHUNK=8192;
  byte[] buf=new byte[CHUNK];
  CRC32 crc=new CRC32();
  FileOutputStream out=new FileOutputStream(file);
  while (toRead > 0) {
    int numRead=data.readEntityData(buf,0,CHUNK);
    crc.update(buf,0,numRead);
    out.write(buf,0,numRead);
    toRead-=numRead;
  }
  out.close();
  return crc.getValue();
}

Fixed version (ground truth):
private long copyBackupToFile(BackupDataInput data,File file,int toRead) throws IOException {
  final int CHUNK=8192;
  byte[] buf=new byte[CHUNK];
  CRC32 crc=new CRC32();
  FileOutputStream out=new FileOutputStream(file);
  try {
    while (toRead > 0) {
      int numRead=data.readEntityData(buf,0,CHUNK);
      crc.update(buf,0,numRead);
      out.write(buf,0,numRead);
      toRead-=numRead;
    }
  }
  finally {
    if (out != null) {
      out.close();
    }
  }
  return crc.getValue();
}
Program: 184975
Project: 184975
Buggy source:
private void copyFileToBackup(String key,File file,BackupDataOutput data) throws IOException {
  final int CHUNK=8192;
  byte[] buf=new byte[CHUNK];
  int toCopy=(int)file.length();
  data.writeEntityHeader(key,toCopy);
  FileInputStream in=new FileInputStream(file);
  int nRead;
  while (toCopy > 0) {
    nRead=in.read(buf,0,CHUNK);
    data.writeEntityData(buf,nRead);
    toCopy-=nRead;
  }
  in.close();
}

Fixed version (ground truth):
private void copyFileToBackup(String key,File file,BackupDataOutput data) throws IOException {
  final int CHUNK=8192;
  byte[] buf=new byte[CHUNK];
  int toCopy=(int)file.length();
  data.writeEntityHeader(key,toCopy);
  FileInputStream in=new FileInputStream(file);
  try {
    int nRead;
    while (toCopy > 0) {
      nRead=in.read(buf,0,CHUNK);
      data.writeEntityData(buf,nRead);
      toCopy-=nRead;
    }
  }
  finally {
    if (in != null) {
      in.close();
    }
  }
}
Program: 184976
Project: 184976
Buggy source:
private void writeBackupState(long fileSize,long crc,ParcelFileDescriptor stateFile) throws IOException {
  DataOutputStream out=new DataOutputStream(new FileOutputStream(stateFile.getFileDescriptor()));
  out.writeLong(fileSize);
  out.writeLong(crc);
  out.writeInt(BACKUP_AGENT_VERSION);
}

Fixed version (ground truth):
private void writeBackupState(long fileSize,long crc,ParcelFileDescriptor stateFile) throws IOException {
  DataOutputStream out=new DataOutputStream(new FileOutputStream(stateFile.getFileDescriptor()));
  try {
    out.writeLong(fileSize);
    out.writeLong(crc);
    out.writeInt(BACKUP_AGENT_VERSION);
  }
  finally {
    if (out != null) {
      out.close();
    }
  }
}
Program: 184979
Project: 184979
Buggy source:
@Override public void onProgressChanged(WebView view,int newProgress){
  mTitleBar.setProgress(newProgress);
  if (mFakeTitleBar != null) {
    mFakeTitleBar.setProgress(newProgress);
  }
  if (newProgress == 100) {
    CookieSyncManager.getInstance().sync();
    if (mInLoad) {
      mInLoad=false;
      updateInLoadMenuItems();
      if (!mOptionsMenuOpen || !mIconView) {
        hideFakeTitleBar();
      }
    }
    if (mNeedExtraScreenShot) {
      updateScreenshot(view);
      mNeedExtraScreenShot=false;
    }
  }
 else   if (!mInLoad) {
    mInLoad=true;
    updateInLoadMenuItems();
    if (!mOptionsMenuOpen || mIconView) {
      showFakeTitleBar();
    }
  }
}

Fixed version (ground truth):
@Override public void onProgressChanged(WebView view,int newProgress){
  mTitleBar.setProgress(newProgress);
  if (mFakeTitleBar != null) {
    mFakeTitleBar.setProgress(newProgress);
  }
  if (newProgress == 100) {
    CookieSyncManager.getInstance().sync();
    if (mInLoad) {
      mInLoad=false;
      updateInLoadMenuItems();
      if (!mOptionsMenuOpen || !mIconView) {
        hideFakeTitleBar();
      }
    }
  }
 else   if (!mInLoad) {
    mInLoad=true;
    updateInLoadMenuItems();
    if (!mOptionsMenuOpen || mIconView) {
      showFakeTitleBar();
    }
  }
}
Program: 184981
Project: 184981
Buggy source:
/** 
 * Show a dialog informing the user of the network error reported by WebCore.
 */
@Override public void onReceivedError(WebView view,int errorCode,String description,String failingUrl){
  if (errorCode != WebViewClient.ERROR_HOST_LOOKUP && errorCode != WebViewClient.ERROR_CONNECT && errorCode != WebViewClient.ERROR_BAD_URL && errorCode != WebViewClient.ERROR_UNSUPPORTED_SCHEME && errorCode != WebViewClient.ERROR_FILE) {
    queueError(errorCode,description);
  }
  Log.e(LOGTAG,"String_Node_Str" + errorCode + "String_Node_Str"+ failingUrl+ "String_Node_Str"+ description);
  mNeedExtraScreenShot=true;
  resetTitleAndRevertLockIcon();
}

Fixed version (ground truth):
/** 
 * Show a dialog informing the user of the network error reported by WebCore.
 */
@Override public void onReceivedError(WebView view,int errorCode,String description,String failingUrl){
  if (errorCode != WebViewClient.ERROR_HOST_LOOKUP && errorCode != WebViewClient.ERROR_CONNECT && errorCode != WebViewClient.ERROR_BAD_URL && errorCode != WebViewClient.ERROR_UNSUPPORTED_SCHEME && errorCode != WebViewClient.ERROR_FILE) {
    queueError(errorCode,description);
  }
  Log.e(LOGTAG,"String_Node_Str" + errorCode + "String_Node_Str"+ failingUrl+ "String_Node_Str"+ description);
  resetTitleAndRevertLockIcon();
}
Program: 184983
Project: 184983
Buggy source:
private Bitmap createScreenshot(WebView view){
  Picture thumbnail=view.capturePicture();
  Bitmap bm=Bitmap.createBitmap(getDesiredThumbnailWidth(this),getDesiredThumbnailHeight(this),Bitmap.Config.ARGB_4444);
  Canvas canvas=new Canvas(bm);
  int contentWidth=view.getContentWidth();
  if (contentWidth > 0) {
    float scaleFactor=(float)getDesiredThumbnailWidth(this) / (float)contentWidth;
    canvas.scale(scaleFactor,scaleFactor);
  }
  thumbnail.draw(canvas);
  return bm;
}

Fixed version (ground truth):
private Bitmap createScreenshot(WebView view){
  Picture thumbnail=view.capturePicture();
  Bitmap bm=Bitmap.createBitmap(getDesiredThumbnailWidth(this),getDesiredThumbnailHeight(this),Bitmap.Config.ARGB_4444);
  Canvas canvas=new Canvas(bm);
  int thumbnailWidth=thumbnail.getWidth();
  if (thumbnailWidth > 0) {
    float scaleFactor=(float)getDesiredThumbnailWidth(this) / (float)thumbnailWidth;
    canvas.scale(scaleFactor,scaleFactor);
  }
  thumbnail.draw(canvas);
  return bm;
}
Program: 184984
Project: 184984
Buggy source:
public void handleMessage(Message msg){
switch (msg.what) {
case FOCUS_NODE_HREF:
    String url=(String)msg.getData().get("String_Node_Str");
  if (url == null || url.length() == 0) {
    break;
  }
HashMap focusNodeMap=(HashMap)msg.obj;
WebView view=(WebView)focusNodeMap.get("String_Node_Str");
if (getTopWindow() != view) {
break;
}
switch (msg.arg1) {
case R.id.open_context_menu_id:
case R.id.view_image_context_menu_id:
loadURL(getTopWindow(),url);
break;
case R.id.open_newtab_context_menu_id:
final TabControl.Tab parent=mTabControl.getCurrentTab();
final TabControl.Tab newTab=openTab(url);
if (newTab != parent) {
parent.addChildTab(newTab);
}
break;
case R.id.bookmark_context_menu_id:
Intent intent=new Intent(BrowserActivity.this,AddBookmarkPage.class);
intent.putExtra("String_Node_Str",url);
startActivity(intent);
break;
case R.id.share_link_context_menu_id:
Browser.sendString(BrowserActivity.this,url,getText(R.string.choosertitle_sharevia).toString());
break;
case R.id.copy_link_context_menu_id:
copy(url);
break;
case R.id.save_link_context_menu_id:
case R.id.download_context_menu_id:
onDownloadStartNoStream(url,null,null,null,-1);
break;
}
break;
case LOAD_URL:
loadURL(getTopWindow(),(String)msg.obj);
break;
case STOP_LOAD:
stopLoading();
break;
case CANCEL_CREDS_REQUEST:
resumeAfterCredentials();
break;
case RELEASE_WAKELOCK:
if (mWakeLock.isHeld()) {
mWakeLock.release();
}
break;
}
}

Fixed version (ground truth):
public void handleMessage(Message msg){
switch (msg.what) {
case FOCUS_NODE_HREF:
{
      String url=(String)msg.getData().get("String_Node_Str");
      if (url == null || url.length() == 0) {
        break;
      }
      HashMap focusNodeMap=(HashMap)msg.obj;
      WebView view=(WebView)focusNodeMap.get("String_Node_Str");
      if (getTopWindow() != view) {
        break;
      }
switch (msg.arg1) {
case R.id.open_context_menu_id:
case R.id.view_image_context_menu_id:
        loadURL(getTopWindow(),url);
      break;
case R.id.open_newtab_context_menu_id:
    final TabControl.Tab parent=mTabControl.getCurrentTab();
  final TabControl.Tab newTab=openTab(url);
if (newTab != parent) {
  parent.addChildTab(newTab);
}
break;
case R.id.bookmark_context_menu_id:
Intent intent=new Intent(BrowserActivity.this,AddBookmarkPage.class);
intent.putExtra("String_Node_Str",url);
startActivity(intent);
break;
case R.id.share_link_context_menu_id:
Browser.sendString(BrowserActivity.this,url,getText(R.string.choosertitle_sharevia).toString());
break;
case R.id.copy_link_context_menu_id:
copy(url);
break;
case R.id.save_link_context_menu_id:
case R.id.download_context_menu_id:
onDownloadStartNoStream(url,null,null,null,-1);
break;
}
break;
}
case LOAD_URL:
loadURL(getTopWindow(),(String)msg.obj);
break;
case STOP_LOAD:
stopLoading();
break;
case CANCEL_CREDS_REQUEST:
resumeAfterCredentials();
break;
case RELEASE_WAKELOCK:
if (mWakeLock.isHeld()) {
mWakeLock.release();
}
break;
case UPDATE_BOOKMARK_THUMBNAIL:
WebView view=(WebView)msg.obj;
if (view != null) {
updateScreenshot(view);
}
break;
}
}
Program: 184985
Project: 184985
Buggy source:
@Override public void onProgressChanged(WebView view,int newProgress){
  mTitleBar.setProgress(newProgress);
  if (mFakeTitleBar != null) {
    mFakeTitleBar.setProgress(newProgress);
  }
  if (newProgress == 100) {
    CookieSyncManager.getInstance().sync();
    if (mInLoad) {
      mInLoad=false;
      updateInLoadMenuItems();
      if (!mOptionsMenuOpen || !mIconView) {
        hideFakeTitleBar();
      }
    }
    if (mNeedExtraScreenShot) {
      updateScreenshot(view);
      mNeedExtraScreenShot=false;
    }
  }
 else   if (!mInLoad) {
    mInLoad=true;
    updateInLoadMenuItems();
    if (!mOptionsMenuOpen || mIconView) {
      showFakeTitleBar();
    }
  }
}

Fixed version (ground truth):
@Override public void onProgressChanged(WebView view,int newProgress){
  mTitleBar.setProgress(newProgress);
  if (mFakeTitleBar != null) {
    mFakeTitleBar.setProgress(newProgress);
  }
  if (newProgress == 100) {
    CookieSyncManager.getInstance().sync();
    if (mInLoad) {
      mInLoad=false;
      updateInLoadMenuItems();
      if (!mOptionsMenuOpen || !mIconView) {
        hideFakeTitleBar();
      }
    }
  }
 else   if (!mInLoad) {
    mInLoad=true;
    updateInLoadMenuItems();
    if (!mOptionsMenuOpen || mIconView) {
      showFakeTitleBar();
    }
  }
}
Program: 184987
Project: 184987
Buggy source:
/** 
 * Show a dialog informing the user of the network error reported by WebCore.
 */
@Override public void onReceivedError(WebView view,int errorCode,String description,String failingUrl){
  if (errorCode != WebViewClient.ERROR_HOST_LOOKUP && errorCode != WebViewClient.ERROR_CONNECT && errorCode != WebViewClient.ERROR_BAD_URL && errorCode != WebViewClient.ERROR_UNSUPPORTED_SCHEME && errorCode != WebViewClient.ERROR_FILE) {
    queueError(errorCode,description);
  }
  Log.e(LOGTAG,"String_Node_Str" + errorCode + "String_Node_Str"+ failingUrl+ "String_Node_Str"+ description);
  mNeedExtraScreenShot=true;
  resetTitleAndRevertLockIcon();
}

Fixed version (ground truth):
/** 
 * Show a dialog informing the user of the network error reported by WebCore.
 */
@Override public void onReceivedError(WebView view,int errorCode,String description,String failingUrl){
  if (errorCode != WebViewClient.ERROR_HOST_LOOKUP && errorCode != WebViewClient.ERROR_CONNECT && errorCode != WebViewClient.ERROR_BAD_URL && errorCode != WebViewClient.ERROR_UNSUPPORTED_SCHEME && errorCode != WebViewClient.ERROR_FILE) {
    queueError(errorCode,description);
  }
  Log.e(LOGTAG,"String_Node_Str" + errorCode + "String_Node_Str"+ failingUrl+ "String_Node_Str"+ description);
  resetTitleAndRevertLockIcon();
}