nus-yam/ex-repair huggingface dataset:
Program: 160709
Project: 160709
Buggy source:
@Override public GivenCleaner run(GivenUUIDGenerator given,ImmutableMap<String,String> params){
  NamedComponent<UUIDGenerator> playbackUUIDComponent=NamedComponent.of(UUIDGenerator.class,given.getTargetComponentName(),new UUIDGenerator.PlaybackUUIDGenerator(given.getPlaybackUUIDs()));
  final UUIDGeneratorFactory.OverridenMachineCleaner cleaner=UUIDGeneratorFactory.overwriteUUIDGenerator(playbackUUIDComponent);
  return new GivenCleaner(){
    @Override public void cleanUp(){
      cleaner.cleanup();
    }
  }
;
}

Fixed version (ground truth):
@Override public GivenCleaner run(GivenUUIDGenerator given,ImmutableMap<String,String> params){
  NamedComponent<UUIDGenerator> playbackUUIDComponent=NamedComponent.of(UUIDGenerator.class,given.getTargetComponentName(),new UUIDGenerator.PlaybackUUIDGenerator(given.getPlaybackUUIDs()));
  final UUIDGenerators.OverridenMachineCleaner cleaner=UUIDGenerators.overrideUUIDGenerator(playbackUUIDComponent);
  return new GivenCleaner(){
    @Override public void cleanUp(){
      cleaner.cleanup();
    }
  }
;
}
Program: 160710
Project: 160710
Buggy source:
@Provides public RestxSessionCookieDescriptor restxSessionCookieDescriptor(@Named("String_Node_Str") Optional<String> appName){
  if (appName.isPresent()) {
    return new RestxSessionCookieDescriptor(String.format("String_Node_Str","String_Node_Str",appName),String.format("String_Node_Str","String_Node_Str",appName));
  }
 else {
    return new RestxSessionCookieDescriptor("String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
@Provides public RestxSessionCookieDescriptor restxSessionCookieDescriptor(@Named("String_Node_Str") Optional<String> appName){
  if (appName.isPresent()) {
    return new RestxSessionCookieDescriptor(String.format("String_Node_Str","String_Node_Str",appName.get()),String.format("String_Node_Str","String_Node_Str",appName.get()));
  }
 else {
    return new RestxSessionCookieDescriptor("String_Node_Str","String_Node_Str");
  }
}
Program: 160711
Project: 160711
Buggy source:
@Override public boolean isPersistentCookie(String cookie){
  return request.getCookies().contains(cookie) ? request.getCookie(cookie).getExpiry() > 0 : false;
}

Fixed version (ground truth):
@Override public boolean isPersistentCookie(String cookie){
  Map<String,String> cookiesMap=getCookiesMap();
  return cookiesMap.containsKey(cookie) ? request.getCookie(cookie).getExpiry() > 0 : false;
}
Program: 160712
Project: 160712
Buggy source:
@Override public String getCookieValue(String cookie,String defaultValue){
  return request.getCookies().contains(cookie) ? request.getCookie(cookie).getValue() : defaultValue;
}

Fixed version (ground truth):
@Override public String getCookieValue(String cookie,String defaultValue){
  Map<String,String> cookiesMap=getCookiesMap();
  return cookiesMap.containsKey(cookie) ? cookiesMap.get(cookie) : defaultValue;
}
Program: 160714
Project: 160714
Buggy source:
@Override public NamedComponent<JongoCollection> customize(NamedComponent<JongoCollection> namedComponent){
  if (namedComponent.getName().equals(given.getCollection())) {
    Mapper mapper=satisfiedBOM.getOne(mapperQuery).get().getComponent();
    return new NamedComponent<>(namedComponent.getName(),new SequencedJongoCollection(namedComponent.getComponent(),mapper,mapper.getObjectIdUpdater(),iteratingSequence));
  }
 else {
    return namedComponent;
  }
}

Fixed version (ground truth):
@Override public NamedComponent<JongoCollection> customize(NamedComponent<JongoCollection> namedComponent){
  if (namedComponent.getName().getName().equals(given.getCollection())) {
    Mapper mapper=satisfiedBOM.getOne(mapperQuery).get().getComponent();
    return new NamedComponent<>(namedComponent.getName(),new SequencedJongoCollection(namedComponent.getComponent(),mapper,mapper.getObjectIdUpdater(),iteratingSequence));
  }
 else {
    return namedComponent;
  }
}
Program: 160715
Project: 160715
Buggy source:
@Override protected ComponentCustomizerEngine doNewComponent(final SatisfiedBOM satisfiedBOM){
  return new SingleComponentNameCustomizerEngine<JongoCollection>(0,Name.of(JongoCollection.class,given.getCollection())){
    @Override public NamedComponent<JongoCollection> customize(    NamedComponent<JongoCollection> namedComponent){
      if (namedComponent.getName().equals(given.getCollection())) {
        Mapper mapper=satisfiedBOM.getOne(mapperQuery).get().getComponent();
        return new NamedComponent<>(namedComponent.getName(),new SequencedJongoCollection(namedComponent.getComponent(),mapper,mapper.getObjectIdUpdater(),iteratingSequence));
      }
 else {
        return namedComponent;
      }
    }
  }
;
}

Fixed version (ground truth):
@Override protected ComponentCustomizerEngine doNewComponent(final SatisfiedBOM satisfiedBOM){
  return new SingleComponentNameCustomizerEngine<JongoCollection>(0,Name.of(JongoCollection.class,given.getCollection())){
    @Override public NamedComponent<JongoCollection> customize(    NamedComponent<JongoCollection> namedComponent){
      if (namedComponent.getName().getName().equals(given.getCollection())) {
        Mapper mapper=satisfiedBOM.getOne(mapperQuery).get().getComponent();
        return new NamedComponent<>(namedComponent.getName(),new SequencedJongoCollection(namedComponent.getComponent(),mapper,mapper.getObjectIdUpdater(),iteratingSequence));
      }
 else {
        return namedComponent;
      }
    }
  }
;
}
Program: 160716
Project: 160716
Buggy source:
public void route(RestxRequest restxRequest,RestxResponse restxResponse) throws IOException {
  RestxSpecTape tape=null;
  if (restxSpecRecorder != null && !restxRequest.getRestxPath().startsWith("String_Node_Str")) {
    tape=restxSpecRecorder.record(restxRequest,restxResponse);
    restxRequest=tape.getRecordingRequest();
    restxResponse=tape.getRecordingResponse();
  }
  if (getLoadFactoryMode().equals("String_Node_Str")) {
    loadFactory();
  }
  try {
    mainRouter.route(restxRequest,restxResponse);
  }
  finally {
    if (tape != null) {
      restxSpecRecorder.stop(tape);
    }
    if (getLoadFactoryMode().equals("String_Node_Str")) {
      closeFactory();
    }
  }
}

Fixed version (ground truth):
@Override public void route(RestxRequest restxRequest,RestxResponse restxResponse) throws IOException {
  RestxSpecTape tape=null;
  if (restxSpecRecorder != null && !restxRequest.getRestxPath().startsWith("String_Node_Str")) {
    tape=restxSpecRecorder.record(restxRequest,restxResponse);
    restxRequest=tape.getRecordingRequest();
    restxResponse=tape.getRecordingResponse();
  }
  Factory factory=loadFactory(newFactoryBuilder(getFactoryContextName(restxRequest.getPort()),restxSpecRecorder));
  try {
    newStdRouter(factory).route(restxRequest,restxResponse);
  }
  finally {
    if (tape != null) {
      restxSpecRecorder.stop(tape);
    }
    factory.close();
  }
}
Program: 160717
Project: 160717
Buggy source:
private void logPrompt(String baseUri,String state){
  logger.info("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + state + (RestxContext.Modes.RECORDING.equals(getMode()) ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ (mainRouter != null ? ("String_Node_Str" + mainRouter.getNbFilters() + "String_Node_Str") : "String_Node_Str")+ (mainRouter != null ? ("String_Node_Str" + mainRouter.getNbRoutes() + "String_Node_Str") : "String_Node_Str")+ "String_Node_Str"+ "String_Node_Str"+ baseUri+ "String_Node_Str"+ "String_Node_Str");
}

Fixed version (ground truth):
private static void logPrompt(String baseUri,String state,StdRestxMainRouter mainRouter){
  logger.info("String_Node_Str" + "String_Node_Str" + "String_Node_Str" + state + (RestxContext.Modes.RECORDING.equals(getMode()) ? "String_Node_Str" : "String_Node_Str")+ "String_Node_Str"+ (mainRouter != null ? ("String_Node_Str" + mainRouter.getNbFilters() + "String_Node_Str") : "String_Node_Str")+ (mainRouter != null ? ("String_Node_Str" + mainRouter.getNbRoutes() + "String_Node_Str") : "String_Node_Str")+ (baseUri == null || baseUri.isEmpty() ? "String_Node_Str" : "String_Node_Str" + "String_Node_Str" + baseUri + "String_Node_Str")+ "String_Node_Str");
}
Program: 160718
Project: 160718
Buggy source:
private String getLoadFactoryMode(){
  return System.getProperty("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
private static String getLoadFactoryMode(){
  return System.getProperty("String_Node_Str",RestxContext.Modes.RECORDING.equals(getMode()) ? "String_Node_Str" : "String_Node_Str");
}
Program: 160719
Project: 160719
Buggy source:
private void loadFactory(){
  Factory.Builder builder=Factory.builder().addFromServiceLoader().addLocalMachines(Factory.LocalMachines.threadLocal()).addLocalMachines(Factory.LocalMachines.contextLocal(contextName));
  if (restxSpecRecorder != null) {
    builder.addLocalMachines(Factory.LocalMachines.contextLocal(RestxContext.Modes.RECORDING));
    builder.addMachine(new SingletonFactoryMachine<>(0,NamedComponent.of(RestxSpecRecorder.class,"String_Node_Str",restxSpecRecorder)));
  }
  factory=builder.build();
  logger.debug("String_Node_Str",factory.dumper());
  mainRouter=new StdRestxMainRouter(factory.queryByClass(RestxRouting.class).findOne().get().getComponent());
}

Fixed version (ground truth):
private static Factory loadFactory(Factory.Builder builder){
  Factory factory=builder.build();
  logger.debug("String_Node_Str",factory.dumper());
  return factory;
}
Program: 160720
Project: 160720
Buggy source:
public static void main(String[] args) throws Exception {
  WebServer server=new SimpleWebServer(WEB_APP_LOCATION,8086);
  System.setProperty("String_Node_Str",server.baseUrl() + "String_Node_Str");
  System.setProperty("String_Node_Str","String_Node_Str");
  server.startAndAwait();
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  WebServer server=new SimpleWebServer(WEB_APP_LOCATION,8086);
  server.startAndAwait();
}
Program: 160721
Project: 160721
Buggy source:
public void start() throws Exception {
  server=new Server();
  server.setThreadPool(createThreadPool());
  server.addConnector(createConnector());
  server.setHandler(createHandlers());
  server.setStopAtShutdown(true);
  server.start();
}

Fixed version (ground truth):
public void start() throws Exception {
  server=new Server();
  server.setThreadPool(createThreadPool());
  server.addConnector(createConnector());
  server.setHandler(createHandlers(createContext()));
  server.setStopAtShutdown(true);
  server.start();
}
Program: 160722
Project: 160722
Buggy source:
private HandlerCollection createHandlers(){
  WebAppContext ctx=new WebAppContext();
  ctx.setContextPath("String_Node_Str");
  ctx.setWar(appBase);
  if (!Strings.isNullOrEmpty(webInfLocation)) {
    ctx.setDescriptor(webInfLocation);
  }
  HashLoginService loginService=new HashLoginService();
  loginService.setIdentityService(new DefaultIdentityService());
  ctx.getSecurityHandler().setLoginService(loginService);
  ctx.getSecurityHandler().setIdentityService(loginService.getIdentityService());
  HandlerList contexts=new HandlerList();
  contexts.setHandlers(new Handler[]{ctx});
  HandlerCollection result=new HandlerCollection();
  result.setHandlers(new Handler[]{contexts});
  return result;
}

Fixed version (ground truth):
private HandlerCollection createHandlers(WebAppContext webAppContext){
  HandlerList contexts=new HandlerList();
  contexts.setHandlers(new Handler[]{webAppContext});
  HandlerCollection result=new HandlerCollection();
  result.setHandlers(new Handler[]{contexts});
  return result;
}
Program: 160723
Project: 160723
Buggy source:
@Override public void start() throws Exception {
  logger.info("String_Node_Str");
  if (router instanceof RestxMainRouterFactory) {
    RestxMainRouterFactory mainRouterFactory=(RestxMainRouterFactory)router;
    mainRouterFactory.init();
  }
  Container container=new Container(){
    @Override public void handle(    Request request,    Response response){
      try {
        if (request.getTarget().startsWith(routerPath)) {
          router.route(new SimpleRestxRequest(routerPath,request),new SimpleRestxResponse(response));
        }
 else {
          response.getPrintStream().print("String_Node_Str");
          response.getPrintStream().close();
        }
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
  Server server=new ContainerServer(container);
  connection=new SocketConnection(server);
  SocketAddress address=new InetSocketAddress(port);
  connection.connect(address);
}

Fixed version (ground truth):
@Override public void start() throws Exception {
  logger.debug("String_Node_Str");
  Container container=new Container(){
    @Override public void handle(    Request request,    Response response){
      try {
        if (request.getTarget().startsWith(routerPath)) {
          router.route(new SimpleRestxRequest(routerPath,request),new SimpleRestxResponse(response));
        }
 else {
          response.getPrintStream().print("String_Node_Str");
          response.getPrintStream().close();
        }
      }
 catch (      IOException e) {
        throw new RuntimeException(e);
      }
    }
  }
;
  Server server=new ContainerServer(container);
  connection=new SocketConnection(server);
  SocketAddress address=new InetSocketAddress(port);
  connection.connect(address);
}
Program: 160724
Project: 160724
Buggy source:
public TomcatWebServer(String appBase,int port) throws ServletException {
  this.port=port;
  tomcat=new Tomcat();
  tomcat.setPort(port);
  tomcat.setBaseDir("String_Node_Str");
  tomcat.getHost().setAppBase("String_Node_Str");
  String contextPath="String_Node_Str";
  StandardServer server=(StandardServer)tomcat.getServer();
  AprLifecycleListener listener=new AprLifecycleListener();
  server.addLifecycleListener(listener);
  tomcat.addWebapp(contextPath,appBase);
}

Fixed version (ground truth):
public TomcatWebServer(String appBase,int port) throws ServletException {
  this.port=port;
  tomcat=new Tomcat();
  tomcat.setPort(port);
  tomcat.setBaseDir("String_Node_Str");
  tomcat.getHost().setAppBase("String_Node_Str");
  String contextPath="String_Node_Str";
  StandardServer server=(StandardServer)tomcat.getServer();
  AprLifecycleListener listener=new AprLifecycleListener();
  server.addLifecycleListener(listener);
  Context context=tomcat.addWebapp(contextPath,appBase);
  context.getServletContext().setInitParameter("String_Node_Str",baseUrl());
}
Program: 160725
Project: 160725
Buggy source:
@Override public void init(ServletConfig config) throws ServletException {
  super.init(config);
  mainRouter.init();
  init(mainRouter);
}

Fixed version (ground truth):
@Override public void init(ServletConfig config) throws ServletException {
  super.init(config);
  String baseUri=System.getProperty("String_Node_Str","String_Node_Str");
  String baseServer=config.getServletContext().getInitParameter("String_Node_Str");
  if (baseUri.isEmpty() && baseServer != null) {
    Collection<String> mappings=config.getServletContext().getServletRegistration(config.getServletName()).getMappings();
    if (!mappings.isEmpty()) {
      String routerPath=mappings.iterator().next();
      if (routerPath.endsWith("String_Node_Str")) {
        routerPath=routerPath.substring(0,routerPath.length() - 2);
      }
      baseUri=baseServer + routerPath;
    }
  }
  init(RestxMainRouterFactory.newInstance(baseUri));
}
Program: 160726
Project: 160726
Buggy source:
@Override public PrintWriter getWriter() throws IOException {
  if (charset == null) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    charset=Charsets.UTF_8.name();
  }
  return writer=new PrintWriter(new OutputStreamWriter(response.getPrintStream(),charset),true);
}

Fixed version (ground truth):
@Override public PrintWriter getWriter() throws IOException {
  if (writer != null) {
    return writer;
  }
  if (charset == null) {
    logger.warn("String_Node_Str" + "String_Node_Str");
    charset=Charsets.UTF_8.name();
  }
  return writer=new PrintWriter(new OutputStreamWriter(response.getPrintStream(),charset),true);
}
Program: 160727
Project: 160727
Buggy source:
@Override public OutputStream getOutputStream() throws IOException {
  return outputStream=response.getOutputStream();
}

Fixed version (ground truth):
@Override public OutputStream getOutputStream() throws IOException {
  if (outputStream != null) {
    return outputStream;
  }
  return outputStream=response.getOutputStream();
}
Program: 160729
Project: 160729
Buggy source:
public void check(ImmutableMap<String,String> params){
  Stopwatch stopwatch=new Stopwatch().start();
  String url=checkNotNull(params.get(BASE_URL),BASE_URL + "String_Node_Str") + "String_Node_Str" + getPath();
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println(getMethod() + "String_Node_Str" + url);
  System.out.println();
  HttpRequest httpRequest=new HttpRequest(url,getMethod());
  if (!cookies.isEmpty()) {
    StringBuilder sb=new StringBuilder();
    for (    Map.Entry<String,String> entry : cookies.entrySet()) {
      sb.append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append("String_Node_Str");
    }
    sb.setLength(sb.length() - 2);
    httpRequest.header("String_Node_Str",sb.toString());
  }
  if (!Strings.isNullOrEmpty(getBody())) {
    httpRequest.send(getBody());
    System.out.println(getBody());
  }
  System.out.println();
  int code=httpRequest.code();
  System.out.println("String_Node_Str");
  System.out.println(code);
  System.out.println();
  String body=httpRequest.body(Charsets.UTF_8.name());
  System.out.println(body);
  System.out.println();
  Assertions.assertThat(code).isEqualTo(getThen().getExpectedCode());
  MatcherAssert.assertThat(body,SameJSONAs.sameJSONAs(getThen().getExpected()).allowingExtraUnexpectedFields());
  System.out.printf("String_Node_Str",getMethod(),getPath(),stopwatch.stop().toString());
}

Fixed version (ground truth):
public void check(ImmutableMap<String,String> params){
  Stopwatch stopwatch=new Stopwatch().start();
  String url=checkNotNull(params.get(BASE_URL),BASE_URL + "String_Node_Str") + "String_Node_Str" + getPath();
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str");
  System.out.println(getMethod() + "String_Node_Str" + url);
  System.out.println();
  HttpRequest httpRequest=new HttpRequest(url,getMethod());
  if (!cookies.isEmpty()) {
    StringBuilder sb=new StringBuilder();
    for (    Map.Entry<String,String> entry : cookies.entrySet()) {
      sb.append(entry.getKey()).append("String_Node_Str").append(entry.getValue()).append("String_Node_Str");
    }
    sb.setLength(sb.length() - 2);
    httpRequest.header("String_Node_Str",sb.toString());
  }
  if (!Strings.isNullOrEmpty(getBody())) {
    httpRequest.contentType("String_Node_Str");
    httpRequest.send(getBody());
    System.out.println(getBody());
  }
  System.out.println();
  int code=httpRequest.code();
  System.out.println("String_Node_Str");
  System.out.println(code);
  System.out.println();
  String body=httpRequest.body(Charsets.UTF_8.name());
  System.out.println(body);
  System.out.println();
  Assertions.assertThat(code).isEqualTo(getThen().getExpectedCode());
  MatcherAssert.assertThat(body,SameJSONAs.sameJSONAs(getThen().getExpected()).allowingExtraUnexpectedFields());
  System.out.printf("String_Node_Str",getMethod(),getPath(),stopwatch.stop().toString());
}
Program: 160730
Project: 160730
Buggy source:
@Override public Query<T> setMandatory(boolean mandatory){
  return new ClassQuery(mayGetFactory(),isMandatory(),getComponentClass());
}

Fixed version (ground truth):
@Override public Query<T> setMandatory(boolean mandatory){
  return new ClassQuery(mayGetFactory(),mandatory,getComponentClass());
}
Program: 160732
Project: 160732
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  if (intent != null && connectivityAction(intent)) {
    boolean isConnected=getIsConnected(context,intent);
    String info=intent.getStringExtra(ConnectivityManager.EXTRA_EXTRA_INFO);
    String reason=intent.getStringExtra(ConnectivityManager.EXTRA_REASON);
    notifyMerlinService(context,new ConnectivityChangeEvent(isConnected,info,reason));
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onReceive(Context context,Intent intent){
  if (intent != null && connectivityAction(intent)) {
    boolean isConnected=getIsConnected(context,intent);
    String info=intent.getStringExtra(ConnectivityManager.EXTRA_EXTRA_INFO);
    String reason=intent.getStringExtra(ConnectivityManager.EXTRA_REASON);
    notifyMerlinService(context,new ConnectivityChangeEvent(isConnected,info,reason));
  }
}
Program: 160733
Project: 160733
Buggy source:
@Override public Request head(String endpoint){
  try {
    HttpURLConnection urlConnection=connectTo(endpoint);
    setConnectionToHeadRequest(urlConnection);
    disableRedirects(urlConnection);
    return new MerlinHttpRequest(urlConnection);
  }
 catch (  MalformedURLException e) {
    throw new RequestException(e);
  }
catch (  IOException e) {
    throw new RequestException(e);
  }
}

Fixed version (ground truth):
@Override public Request head(String endpoint){
  try {
    HttpURLConnection urlConnection=connectTo(endpoint);
    urlConnection.setRequestProperty("String_Node_Str","String_Node_Str");
    setConnectionToHeadRequest(urlConnection);
    disableRedirects(urlConnection);
    return new MerlinHttpRequest(urlConnection);
  }
 catch (  MalformedURLException e) {
    throw new RequestException(e);
  }
catch (  IOException e) {
    throw new RequestException(e);
  }
}
Program: 160734
Project: 160734
Buggy source:
private void notifyMerlinService(Context context,ConnectivityChangeEvent connectivityChangedEvent){
  IBinder binder=peekService(context,new Intent(context,MerlinService.class));
  MerlinService merlinService=getMerlinService(binder);
  if (isAvailable(merlinService)) {
    merlinService.onConnectivityChanged(connectivityChangedEvent);
  }
}

Fixed version (ground truth):
private void notifyMerlinService(Context context,ConnectivityChangeEvent connectivityChangedEvent){
  MerlinService merlinService=getMerlinService(context);
  if (isAvailable(merlinService)) {
    merlinService.onConnectivityChanged(connectivityChangedEvent);
  }
}
Program: 160735
Project: 160735
Buggy source:
private boolean isAvailable(MerlinService merlinService){
  return merlinService != null;
}

Fixed version (ground truth):
private static boolean isAvailable(Object object){
  return object != null;
}
Program: 160736
Project: 160736
Buggy source:
protected MerlinService getMerlinService(IBinder binder){
  return ((MerlinService.LocalBinder)binder).getService();
}

Fixed version (ground truth):
protected MerlinService getMerlinService(Context context){
  IBinder binder=peekService(context,new Intent(context,MerlinService.class));
  if (isAvailable(binder)) {
    return ((MerlinService.LocalBinder)binder).getService();
  }
  return null;
}
Program: 160737
Project: 160737
Buggy source:
@Before public void setUp() throws Exception {
  initMocks(this);
  connectivityReceiver=new ConnectivityReceiver(){
    @Override protected MerlinService getMerlinService(    IBinder binder){
      return merlinService;
    }
  }
;
}

Fixed version (ground truth):
@Before public void setUp() throws Exception {
  initMocks(this);
  connectivityReceiver=new ConnectivityReceiver(){
    @Override protected MerlinService getMerlinService(    Context context){
      return merlinService;
    }
  }
;
}
Program: 160738
Project: 160738
Buggy source:
@Override protected MerlinService getMerlinService(IBinder binder){
  return merlinService;
}

Fixed version (ground truth):
@Override protected MerlinService getMerlinService(Context context){
  return merlinService;
}
Program: 160739
Project: 160739
Buggy source:
/** 
 * Validates all fields for adding a user
 */
public void validateSaveUser(){
  if (user == null || user.getUsername() == null || user.getUsername().trim().equals("String_Node_Str")) {
    addFieldError("String_Node_Str",REQUIRED);
  }
  if (user == null || user.getLastNm() == null || user.getLastNm().trim().equals("String_Node_Str")) {
    addFieldError("String_Node_Str",REQUIRED);
  }
  if (user == null || user.getFirstNm() == null || user.getFirstNm().trim().equals("String_Node_Str")) {
    addFieldError("String_Node_Str",REQUIRED);
  }
  if (user != null && user.getPassword() != null && !user.getPassword().trim().equals("String_Node_Str")) {
    if (!user.getPassword().equals(user.getPasswordConfirm())) {
      addActionError("String_Node_Str");
    }
 else     if (!PasswordUtil.isValid(user.getPassword())) {
      addActionError(PasswordUtil.PASSWORD_REQ_ERROR_MSG);
    }
  }
  if (user != null && user.getId() == null && (user.getPassword() == null || user.getPassword().trim().equals("String_Node_Str"))) {
    addActionError("String_Node_Str");
  }
  if (user != null && !UserDB.isUnique(user.getId(),user.getUsername())) {
    addActionError("String_Node_Str");
  }
  if (!this.getFieldErrors().isEmpty() || !this.getActionErrors().isEmpty()) {
    Long userId=AuthUtil.getUserId(servletRequest.getSession());
    sortedSet=UserDB.getUserSet(sortedSet);
    user.setId(userId);
  }
}

Fixed version (ground truth):
/** 
 * Validates all fields for adding a user
 */
public void validateSaveUser(){
  if (user == null || user.getUsername() == null || user.getUsername().trim().equals("String_Node_Str")) {
    addFieldError("String_Node_Str",REQUIRED);
  }
  if (user == null || user.getLastNm() == null || user.getLastNm().trim().equals("String_Node_Str")) {
    addFieldError("String_Node_Str",REQUIRED);
  }
  if (user == null || user.getFirstNm() == null || user.getFirstNm().trim().equals("String_Node_Str")) {
    addFieldError("String_Node_Str",REQUIRED);
  }
  if (user != null && user.getPassword() != null && !user.getPassword().trim().equals("String_Node_Str")) {
    if (!user.getPassword().equals(user.getPasswordConfirm())) {
      addActionError("String_Node_Str");
    }
 else     if (!PasswordUtil.isValid(user.getPassword())) {
      addActionError(PasswordUtil.PASSWORD_REQ_ERROR_MSG);
    }
  }
  if (user != null && user.getId() == null && (user.getPassword() == null || user.getPassword().trim().equals("String_Node_Str"))) {
    addActionError("String_Node_Str");
  }
  if (user != null && !UserDB.isUnique(user.getId(),user.getUsername())) {
    addActionError("String_Node_Str");
  }
  if (!this.getFieldErrors().isEmpty() || !this.getActionErrors().isEmpty()) {
    sortedSet=UserDB.getUserSet(sortedSet);
  }
}
Program: 160742
Project: 160742
Buggy source:
/** 
 * AST_FUNC_DECL nodes are function-declaring nodes for top-level functions (as opposed to methods declared within a class scope.) Any AST_FUNC_DECL node has exactly four children: 1) AST_PARAM_LIST 2) NULL, for structural compatibility with AST_CLOSURE 3) AST_STMT_LIST 4) AST_NAME or NULL, indicating the return type This test checks a function's name and children in the following PHP code: function foo() : int {}
 */
@Test public void testFunctionDefCreation() throws IOException, InvalidCSVFile {
  handleCSVFiles("String_Node_Str");
  ASTNode node=ast.getNodeById((long)6);
  assertThat(node,instanceOf(FunctionDef.class));
  assertEquals("String_Node_Str",((FunctionDef)node).getName());
  assertEquals(4,node.getChildCount());
  assertEquals(ast.getNodeById((long)9),((FunctionDef)node).getParameterList());
  assertEquals(ast.getNodeById((long)11),((FunctionDef)node).getContent());
  assertEquals(ast.getNodeById((long)12),((FunctionDef)node).getReturnType());
  assertEquals(ast.getNodeById((long)13),((FunctionDef)node).getReturnType().getNameChild());
  assertEquals("String_Node_Str",((FunctionDef)node).getReturnType().getNameChild().getEscapedCodeStr());
}

Fixed version (ground truth):
/** 
 * AST_FUNC_DECL nodes are function-declaring nodes for top-level functions (as opposed to methods declared within a class scope.) Any AST_FUNC_DECL node has exactly four children: 1) AST_PARAM_LIST 2) NULL, for structural compatibility with AST_CLOSURE 3) AST_STMT_LIST 4) AST_NAME or NULL, indicating the return type This test checks a function's name and children in the following PHP code: function foo() : int {}
 */
@Test public void testFunctionDefCreation() throws IOException, InvalidCSVFile {
  handleCSVFiles("String_Node_Str");
  ASTNode node=ast.getNodeById((long)6);
  assertThat(node,instanceOf(FunctionDef.class));
  assertEquals("String_Node_Str",((FunctionDef)node).getName());
  assertEquals("String_Node_Str",((FunctionDef)node).getName());
  assertEquals("String_Node_Str",((FunctionDef)node).getName());
  assertEquals(4,node.getChildCount());
  assertEquals(ast.getNodeById((long)9),((FunctionDef)node).getParameterList());
  assertEquals(ast.getNodeById((long)11),((FunctionDef)node).getContent());
  assertEquals(ast.getNodeById((long)12),((FunctionDef)node).getReturnType());
  assertEquals(ast.getNodeById((long)13),((FunctionDef)node).getReturnType().getNameChild());
  assertEquals("String_Node_Str",((FunctionDef)node).getReturnType().getNameChild().getEscapedCodeStr());
}
Program: 160743
Project: 160743
Buggy source:
public void importCSVFiles(String nodeFilename,String edgeFilename) throws IOException {
  openNodeFile(nodeFilename);
  openEdgeFile(edgeFilename);
  openDatabaseForBatchInsert();
  initializeDatabase();
  importNodes();
  importEdges();
  closeDatabase();
}

Fixed version (ground truth):
public void importCSVFiles(String nodeFilename,String edgeFilename) throws IOException {
  openNodeFile(nodeFilename);
  openEdgeFile(edgeFilename);
  isNewDatabase=!databaseExists(dbName);
  if (!isNewDatabase())   return;
  openDatabaseForBatchInsert();
  initializeDatabase();
  importNodes();
  importEdges();
  closeDatabase();
}
Program: 160744
Project: 160744
Buggy source:
public void initializeDatabase() throws IOException {
  isNewDatabase=!databaseExists(dbName);
  if (!isNewDatabase())   return;
  DatabaseInitializer initializer=new DatabaseInitializer();
  initializer.setVertexKeys(nodeFile.getKeys());
  initializer.initialize(tx);
}

Fixed version (ground truth):
public void initializeDatabase() throws IOException {
  DatabaseInitializer initializer=new DatabaseInitializer();
  initializer.setVertexKeys(nodeFile.getKeys());
  initializer.initialize(tx);
}
Program: 160745
Project: 160745
Buggy source:
public void initialize(OrientGraph tx){
  createNodeProperties();
  createIndices();
}

Fixed version (ground truth):
public void initialize(OrientGraph tx){
  this.tx=tx;
  createNodeProperties();
  createIndices();
}
Program: 160746
Project: 160746
Buggy source:
private static OctopusProject createOctopusProjectForName(String name) throws IOException {
  Path pathToProject=getPathToProject(name);
  Files.createDirectories(pathToProject);
  OctopusProject newProject=new OctopusProject(name,pathToProject.toString());
  TitanLocalDatabaseManager databaseManager=new TitanLocalDatabaseManager();
  databaseManager.initializeDatabaseForProject(newProject);
  return newProject;
}

Fixed version (ground truth):
private static OctopusProject createOctopusProjectForName(String name) throws IOException {
  Path pathToProject=getPathToProject(name);
  Files.createDirectories(pathToProject);
  OctopusProject newProject=new OctopusProject(name,pathToProject.toString());
  return newProject;
}
Program: 160747
Project: 160747
Buggy source:
public static void create(String name) throws IOException {
  if (projectsDir == null)   throw new IllegalStateException("String_Node_Str");
  if (doesProjectExist(name))   throw new RuntimeException("String_Node_Str");
  OctopusProject project=createOctopusProjectForName(name);
  logger.debug("String_Node_Str" + name);
  nameToProject.put(name,project);
}

Fixed version (ground truth):
public static void create(String name) throws IOException {
  if (projectsDir == null)   throw new IllegalStateException("String_Node_Str");
  if (doesProjectExist(name))   throw new RuntimeException("String_Node_Str");
  OctopusProject project=createOctopusProjectForName(name);
  TitanLocalDatabaseManager databaseManager=new TitanLocalDatabaseManager();
  databaseManager.initializeDatabaseForProject(project);
  logger.debug("String_Node_Str" + name);
  nameToProject.put(name,project);
}
Program: 160748
Project: 160748
Buggy source:
@Override public void visitFile(Path filename){
  String basePath=filename.getParent().toString();
  String nodeFilename=basePath + File.separator + "String_Node_Str";
  String edgeFilename=basePath + File.separator + "String_Node_Str";
  System.out.println(nodeFilename);
  String name=joernProject.getName();
  ImportJob importJob=new ImportJob(nodeFilename,edgeFilename,name);
  (new ImportCSVRunnable(importJob)).run();
}

Fixed version (ground truth):
@Override public void visitFile(Path filename){
  String basePath=filename.getParent().toString();
  String nodeFilename=basePath + File.separator + "String_Node_Str";
  String edgeFilename=basePath + File.separator + "String_Node_Str";
  String name=joernProject.getName();
  ImportJob importJob=new ImportJob(nodeFilename,edgeFilename,name);
  (new ImportCSVRunnable(importJob)).run();
}
Program: 160749
Project: 160749
Buggy source:
private static void loadProject(Path projectDir) throws IOException {
  String projectName=projectDir.getFileName().toString();
  OctopusProject newProject=createOctopusProjectForName(projectName);
  nameToProject.put(projectName,newProject);
}

Fixed version (ground truth):
private static void loadProject(Path projectDir) throws IOException {
  String projectName=projectDir.getFileName().toString();
  OctopusProject newProject=createOctopusProjectForName(projectName);
  logger.debug("String_Node_Str" + projectName);
  nameToProject.put(projectName,newProject);
}
Program: 160750
Project: 160750
Buggy source:
public static OctopusProject getProjectByName(String name){
  return nameToProject.get(name);
}

Fixed version (ground truth):
public static OctopusProject getProjectByName(String name){
  if (name == null) {
    System.out.println(getStackTrace());
  }
  logger.debug("String_Node_Str" + name);
  return nameToProject.get(name);
}
Program: 160752
Project: 160752
Buggy source:
/** 
 * Reads lines from the edgeReader, file by file. Assumes that the functions currently in the csvNodeIds map are exactly those referenced by the next edge rows until meeting the next FILE_OF edge.
 */
private void addEdgeRowsUntilNextFile() throws InvalidCSVFile {
  while (edgeReader.hasNextRow()) {
    KeyedCSVRow currEdgeRow=edgeReader.getNextRow();
    System.out.println(currEdgeRow);
    String currType=currEdgeRow.getFieldForKey(PHPCSVEdgeTypes.TYPE);
    if (currType.equals(PHPCSVEdgeTypes.TYPE_DIRECTORY_OF))     continue;
    if (currType.equals(PHPCSVEdgeTypes.TYPE_FILE_OF))     break;
    if (currType.equals(PHPCSVEdgeTypes.TYPE_CFG_ENTRY) || currType.equals(PHPCSVEdgeTypes.TYPE_CFG_EXIT))     continue;
    if (!currType.equals(PHPCSVEdgeTypes.TYPE_AST_PARENT_OF))     throw new InvalidCSVFile("String_Node_Str" + edgeReader.getCurrentLineNumber() + "String_Node_Str"+ "String_Node_Str"+ currType+ "String_Node_Str");
    String startId=currEdgeRow.getFieldForKey(PHPCSVEdgeTypes.START_ID);
    String endId=currEdgeRow.getFieldForKey(PHPCSVEdgeTypes.END_ID);
    for (    CSVAST csvAST : csvNodeIds.keySet()) {
      Set<String> nodeSet=csvNodeIds.get(csvAST);
      if (nodeSet.contains(startId) && nodeSet.contains(endId))       csvAST.addEdgeRow(currEdgeRow);
    }
  }
  csvNodeIds.clear();
}

Fixed version (ground truth):
/** 
 * Reads lines from the edgeReader, file by file. Assumes that the functions currently in the csvNodeIds map are exactly those referenced by the next edge rows until meeting the next FILE_OF edge.
 */
private void addEdgeRowsUntilNextFile() throws InvalidCSVFile {
  while (edgeReader.hasNextRow()) {
    KeyedCSVRow currEdgeRow=edgeReader.getNextRow();
    String currType=currEdgeRow.getFieldForKey(PHPCSVEdgeTypes.TYPE);
    if (currType.equals(PHPCSVEdgeTypes.TYPE_DIRECTORY_OF))     continue;
    if (currType.equals(PHPCSVEdgeTypes.TYPE_FILE_OF))     break;
    if (currType.equals(PHPCSVEdgeTypes.TYPE_CFG_ENTRY) || currType.equals(PHPCSVEdgeTypes.TYPE_CFG_EXIT))     continue;
    if (!currType.equals(PHPCSVEdgeTypes.TYPE_AST_PARENT_OF))     throw new InvalidCSVFile("String_Node_Str" + edgeReader.getCurrentLineNumber() + "String_Node_Str"+ "String_Node_Str"+ currType+ "String_Node_Str");
    String startId=currEdgeRow.getFieldForKey(PHPCSVEdgeTypes.START_ID);
    String endId=currEdgeRow.getFieldForKey(PHPCSVEdgeTypes.END_ID);
    for (    CSVAST csvAST : csvNodeIds.keySet()) {
      Set<String> nodeSet=csvNodeIds.get(csvAST);
      if (nodeSet.contains(startId) && nodeSet.contains(endId))       csvAST.addEdgeRow(currEdgeRow);
    }
  }
  csvNodeIds.clear();
}
Program: 160753
Project: 160753
Buggy source:
/** 
 * Creates a new CG instance based on the lists of known function definitions and function calls. Call this after all function definitions and calls have been added to the lists using addFunctionDef(FunctionDef) and addFunctionCall(CallExpression). After a call graph has been constructed, these lists are automatically reset.
 * @return A new call graph instance.
 */
public static CG newInstance(){
  CG cg=new CG();
  createFunctionCallEdges(cg);
  createStaticMethodCallEdges(cg);
  createConstructorCallEdges(cg);
  createNonStaticMethodCallEdges(cg);
  reset();
  return cg;
}

Fixed version (ground truth):
/** 
 * Creates a new CG instance based on the lists of known function definitions and function calls. Call this after all function definitions and calls have been added to the lists using addFunctionDef(FunctionDef) and addFunctionCall(CallExpression). After a call graph has been constructed, these lists are automatically reset.
 * @return A new call graph instance.
 */
public static CG newInstance(){
  CG cg=new CG();
  createFunctionCallEdges(cg);
  createStaticMethodCallEdges(cg);
  createConstructorCallEdges(cg);
  createNonStaticMethodCallEdges(cg);
  System.err.println("String_Node_Str" + blacklistedMethodNames.size() + "String_Node_Str"+ "String_Node_Str"+ nonStaticMethodDefs.size()+ "String_Node_Str");
  reset();
  return cg;
}
Program: 160755
Project: 160755
Buggy source:
/** 
 * foo.php ------- namespace A; include_once "bar.php"; class ClassOne { public function foo() {} } $classtwo = new \B\ClassTwo(); $classtwo->bar(); bar.php ------- namespace B; include_once "foo.php"; class ClassTwo { public function foo() {} } $classone = new \A\ClassOne(); $classone->foo();
 */
@Test public void testTwoFilesNamespacedNonStaticCalls() throws IOException, InvalidCSVFile {
  CG cg=getCGForCSVFiles("String_Node_Str");
  assertEquals(4,cg.size());
  assertEquals(2,cg.numberOfCallers());
  assertEquals(2,cg.numberOfCallees());
  assertEquals(cg.numberOfEdges(),cg.numberOfCallers());
  assertTrue(edgeExists(cg,32,54));
  assertTrue(edgeExists(cg,68,18));
}

Fixed version (ground truth):
/** 
 * foo.php ------- namespace A; include_once "bar.php"; class ClassOne { public function foo() {} } $classtwo = new \B\ClassTwo(); $classtwo->bar(); bar.php ------- namespace B; include_once "foo.php"; class ClassTwo { public function bar() {} } $classone = new \A\ClassOne(); $classone->foo();
 */
@Test public void testTwoFilesNamespacedNonStaticCalls() throws IOException, InvalidCSVFile {
  CG cg=getCGForCSVFiles("String_Node_Str");
  assertEquals(4,cg.size());
  assertEquals(2,cg.numberOfCallers());
  assertEquals(2,cg.numberOfCallees());
  assertEquals(cg.numberOfEdges(),cg.numberOfCallers());
  assertTrue(edgeExists(cg,32,54));
  assertTrue(edgeExists(cg,68,18));
}
Program: 160756
Project: 160756
Buggy source:
public CodeLocation getLocation(){
  return location;
}

Fixed version (ground truth):
public CodeLocation getLocation(){
  return this.location;
}
Program: 160757
Project: 160757
Buggy source:
private void setChildNumber(int num){
  childNumber=num;
}

Fixed version (ground truth):
private void setChildNumber(int num){
  this.childNumber=num;
}
Program: 160758
Project: 160758
Buggy source:
public int getChildNumber(){
  return childNumber;
}

Fixed version (ground truth):
public int getChildNumber(){
  return this.childNumber;
}
Program: 160759
Project: 160759
Buggy source:
public void setLocation(CodeLocation loc){
  this.location=loc;
}

Fixed version (ground truth):
public void setLocation(CodeLocation location){
  this.location=location;
}
Program: 160760
Project: 160760
Buggy source:
public Long getNodeId(){
  Long id;
  try {
    id=Long.parseLong(getProperty(ASTNodeProperties.NODE_ID));
  }
 catch (  NumberFormatException e) {
    id=-1l;
    e.printStackTrace();
  }
  return id;
}

Fixed version (ground truth):
public Long getNodeId(){
  Long id;
  try {
    id=Long.parseLong(getProperty(ASTNodeProperties.NODE_ID));
  }
 catch (  NumberFormatException e) {
    id=-1l;
    System.err.println("String_Node_Str" + super.toString() + "String_Node_Str"+ "String_Node_Str"+ getTypeAsString()+ "String_Node_Str"+ getLocation()+ "String_Node_Str"+ getCodeStr()+ "String_Node_Str");
    e.printStackTrace();
  }
  return id;
}
Program: 160761
Project: 160761
Buggy source:
public String getLocationString(){
  return location.toString();
}

Fixed version (ground truth):
public String getLocationString(){
  return this.location.toString();
}
Program: 160762
Project: 160762
Buggy source:
@Override public String toString(){
  if (null != getEscapedCodeStr() && null != getProperty(ASTNodeProperties.NODE_ID))   return "String_Node_Str" + getProperty(ASTNodeProperties.NODE_ID) + "String_Node_Str"+ getEscapedCodeStr()+ "String_Node_Str";
  if (null != getEscapedCodeStr())   return "String_Node_Str" + getEscapedCodeStr() + "String_Node_Str";
  if (null != getProperty(ASTNodeProperties.NODE_ID))   return "String_Node_Str" + getProperty(ASTNodeProperties.NODE_ID) + "String_Node_Str"+ getTypeAsString()+ "String_Node_Str";
  return super.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  if (null != getEscapedCodeStr() && null != getProperty(ASTNodeProperties.NODE_ID))   return "String_Node_Str" + getNodeId() + "String_Node_Str"+ getEscapedCodeStr()+ "String_Node_Str";
  if (null != getEscapedCodeStr())   return "String_Node_Str" + getEscapedCodeStr() + "String_Node_Str";
  if (null != getProperty(ASTNodeProperties.NODE_ID))   return "String_Node_Str" + getNodeId() + "String_Node_Str"+ getTypeAsString()+ "String_Node_Str";
  return super.toString();
}
Program: 160763
Project: 160763
Buggy source:
public void setStatement(Expression expression){
  ExpressionStatement expressionStatement=new ExpressionStatement();
  expressionStatement.setExpression(expression);
  setStatement(expressionStatement);
}

Fixed version (ground truth):
public void setStatement(Statement statement){
  this.statement=statement;
  super.addChild(statement);
}
Program: 160766
Project: 160766
Buggy source:
/** 
 * do ; while($foo); do bar(); while($foo);
 */
@Test public void testMinimalDoCreation() throws IOException, InvalidCSVFile {
  String nodeStr=nodeHeader;
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  String edgeStr=edgeHeader;
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  handle(nodeStr,edgeStr);
  ASTNode node=ast.getNodeById((long)3);
  ASTNode node2=ast.getNodeById((long)7);
  assertThat(node,instanceOf(DoStatement.class));
  assertEquals(2,node.getChildCount());
  assertNull(((DoStatement)node).getStatement());
  assertThat(node2,instanceOf(DoStatement.class));
  assertEquals(2,node2.getChildCount());
  assertThat(((DoStatement)node2).getStatement(),not(instanceOf(CompoundStatement.class)));
  assertThat(((DoStatement)node2).getStatement(),instanceOf(ExpressionStatement.class));
  assertEquals(ast.getNodeById((long)8),((ExpressionStatement)((DoStatement)node2).getStatement()).getExpression());
}

Fixed version (ground truth):
/** 
 * do ; while($foo); do bar(); while($foo);
 */
@Test public void testMinimalDoCreation() throws IOException, InvalidCSVFile {
  String nodeStr=nodeHeader;
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  nodeStr+="String_Node_Str";
  String edgeStr=edgeHeader;
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  edgeStr+="String_Node_Str";
  handle(nodeStr,edgeStr);
  ASTNode node=ast.getNodeById((long)3);
  ASTNode node2=ast.getNodeById((long)7);
  assertThat(node,instanceOf(DoStatement.class));
  assertEquals(2,node.getChildCount());
  assertNull(((DoStatement)node).getStatement());
  assertThat(node2,instanceOf(DoStatement.class));
  assertEquals(2,node2.getChildCount());
  assertThat(((DoStatement)node2).getStatement(),not(instanceOf(CompoundStatement.class)));
  assertThat(((DoStatement)node2).getStatement(),instanceOf(ExpressionStatement.class));
  assertEquals(ast.getNodeById((long)8),((ExpressionStatement)((DoStatement)node2).getStatement()).getExpression());
  assertEquals(Long.valueOf(8),((ExpressionStatement)((DoStatement)node2).getStatement()).getNodeId());
}