nus-yam/ex-repair huggingface dataset:
Program: 10791
Project: 10791
Buggy source:
protected void playFileWithPipeline(BrowserType browserType,String recordingFile,int playtime,int x,int y,Color... expectedColors) throws InterruptedException {
  MediaPipeline mp=kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEP=new PlayerEndpoint.Builder(mp,recordingFile).build();
  WebRtcEndpoint webRtcEP=new WebRtcEndpoint.Builder(mp).build();
  playerEP.connect(webRtcEP);
  BrowserClient browserClient=new BrowserClient.Builder().browserType(browserType).client(Client.WEBRTC).build();
  browserClient.init();
  String browserkey="String_Node_Str";
  addBrowserClient(browserkey,browserClient);
  final CountDownLatch eosLatch=new CountDownLatch(1);
  playerEP.addEndOfStreamListener(new EventListener<EndOfStreamEvent>(){
    @Override public void onEvent(    EndOfStreamEvent event){
      eosLatch.countDown();
    }
  }
);
  getBrowser(browserkey).subscribeEvents("String_Node_Str");
  getBrowser(browserkey).initWebRtc(webRtcEP,WebRtcChannel.AUDIO_AND_VIDEO,WebRtcMode.RCV_ONLY);
  playerEP.play();
  makeAssertions(browserkey,"String_Node_Str",browserClient,playtime,x,y,eosLatch,expectedColors);
  if (mp != null) {
    mp.release();
  }
}

Fixed version (ground truth):
protected void playFileWithPipeline(BrowserType browserType,String recordingFile,int playtime,int x,int y,Color... expectedColors) throws InterruptedException {
  MediaPipeline mp=kurentoClient.createMediaPipeline();
  PlayerEndpoint playerEP=new PlayerEndpoint.Builder(mp,recordingFile).build();
  WebRtcEndpoint webRtcEP=new WebRtcEndpoint.Builder(mp).build();
  playerEP.connect(webRtcEP);
  BrowserClient browserClient=new BrowserClient.Builder().browserType(browserType).client(Client.WEBRTC).build();
  String browserkey="String_Node_Str";
  addBrowserClient(browserkey,browserClient);
  final CountDownLatch eosLatch=new CountDownLatch(1);
  playerEP.addEndOfStreamListener(new EventListener<EndOfStreamEvent>(){
    @Override public void onEvent(    EndOfStreamEvent event){
      eosLatch.countDown();
    }
  }
);
  getBrowser(browserkey).subscribeEvents("String_Node_Str");
  getBrowser(browserkey).initWebRtc(webRtcEP,WebRtcChannel.AUDIO_AND_VIDEO,WebRtcMode.RCV_ONLY);
  playerEP.play();
  makeAssertions(browserkey,"String_Node_Str",browserClient,playtime,x,y,eosLatch,expectedColors);
  if (mp != null) {
    mp.release();
  }
}
Program: 10792
Project: 10792
Buggy source:
public void addBrowserClient(String browserkey,BrowserClient browserClient){
  testScenario.getBrowserMap().put(browserkey,browserClient);
}

Fixed version (ground truth):
public void addBrowserClient(String browserKey,BrowserClient browserClient){
  testScenario.getBrowserMap().put(browserKey,browserClient);
  initBrowserClient(browserKey,browserClient);
}
Program: 10793
Project: 10793
Buggy source:
@Before public void setupKurentoTest(){
  if (testScenario != null) {
    for (    String browserKey : testScenario.getBrowserMap().keySet()) {
      BrowserClient browserClient=testScenario.getBrowserMap().get(browserKey);
      browserClient.setId(browserKey);
      browserClient.setName(testName.getMethodName());
      browserClient.init();
      String kurentoTestJs="String_Node_Str";
      kurentoTestJs+="String_Node_Str";
      kurentoTestJs+="String_Node_Str";
      kurentoTestJs+="String_Node_Str";
      browserClient.executeScript(kurentoTestJs);
    }
  }
}

Fixed version (ground truth):
@Before public void setupKurentoTest(){
  if (testScenario != null) {
    for (    String browserKey : testScenario.getBrowserMap().keySet()) {
      BrowserClient browserClient=testScenario.getBrowserMap().get(browserKey);
      initBrowserClient(browserKey,browserClient);
    }
  }
}
Program: 10795
Project: 10795
Buggy source:
public static String getSimpleTestName(){
  String out=testName;
  if (out.indexOf("String_Node_Str") != -1) {
    out=out.substring(0,out.indexOf("String_Node_Str")) + "String_Node_Str";
  }
  return out;
}

Fixed version (ground truth):
public static String getSimpleTestName(){
  String out=testName;
  if (testName != null && out.indexOf("String_Node_Str") != -1) {
    out=out.substring(0,out.indexOf("String_Node_Str")) + "String_Node_Str";
  }
  return out;
}
Program: 10796
Project: 10796
Buggy source:
public Object unflattenValue(String paramName,Type type,Object value,ObjectRefsManager manager){
  if (type instanceof Class) {
    Class<?> clazz=(Class<?>)type;
    if (isPrimitiveClass(clazz)) {
      return value;
    }
 else     if (clazz.isEnum()) {
      return unflattenEnumConstant(type,value,clazz);
    }
 else {
      if (value instanceof String) {
        return unflattenRemoteObject(type,(String)value,manager);
      }
 else       if (value instanceof Props) {
        return unflattedComplexType(clazz,(Props)value,manager);
      }
 else {
        throw new ProtocolException("String_Node_Str" + type + "String_Node_Str");
      }
    }
  }
 else   if (type instanceof ParameterizedType) {
    ParameterizedType pType=(ParameterizedType)type;
    if (((Class<?>)pType.getRawType()).isAssignableFrom(List.class)) {
      return unflattenList(paramName,(List<?>)value,pType.getActualTypeArguments()[0],manager);
    }
  }
  throw new ProtocolException("String_Node_Str" + type + "String_Node_Str");
}

Fixed version (ground truth):
public Object unflattenValue(String paramName,Type type,Object value,ObjectRefsManager manager){
  if (type instanceof Class) {
    Class<?> clazz=(Class<?>)type;
    if (isPrimitiveClass(clazz)) {
      return value;
    }
 else     if (clazz.isEnum()) {
      return unflattenEnumConstant(type,value,clazz);
    }
 else {
      if (value instanceof String) {
        return unflattenRemoteObject(type,(String)value,manager);
      }
 else       if (value instanceof Props) {
        return unflattedComplexType(clazz,(Props)value,manager);
      }
 else       if (value instanceof KurentoObject) {
        return value;
      }
 else {
        throw new ProtocolException("String_Node_Str" + type + "String_Node_Str");
      }
    }
  }
 else   if (type instanceof ParameterizedType) {
    ParameterizedType pType=(ParameterizedType)type;
    if (((Class<?>)pType.getRawType()).isAssignableFrom(List.class)) {
      return unflattenList(paramName,(List<?>)value,pType.getActualTypeArguments()[0],manager);
    }
  }
  throw new ProtocolException("String_Node_Str" + type + "String_Node_Str");
}
Program: 10797
Project: 10797
Buggy source:
protected void sendKeepAlives(){
  if (mode == Mode.PER_ID_AS_SESSION) {
    for (    String id : ids.keySet()) {
      JsonObject params=new JsonObject();
      params.addProperty("String_Node_Str",id);
      try {
        client.sendRequest("String_Node_Str",params);
      }
 catch (      IOException e) {
        log.error("String_Node_Str" + id,e);
      }
    }
  }
 else   if (mode == Mode.PER_ID_AS_MEDIAPIPELINE) {
    for (    String id : ids.keySet()) {
      JsonObject params=new JsonObject();
      params.addProperty("String_Node_Str",id);
      try {
        client.sendRequest(new Request<JsonObject>(id,null,"String_Node_Str",params));
      }
 catch (      JsonRpcErrorException e) {
        log.warn("String_Node_Str" + "String_Node_Str",id,e.getMessage());
      }
catch (      IOException e) {
        log.error("String_Node_Str" + id,e);
      }
    }
  }
 else   if (mode == Mode.PER_CLIENT) {
    try {
      client.sendRequest("String_Node_Str",null);
    }
 catch (    IOException e) {
      throw new KurentoException("String_Node_Str" + client.getSession().getSessionId());
    }
  }
 else {
    throw new KurentoException("String_Node_Str" + mode);
  }
  log.debug("String_Node_Str");
}

Fixed version (ground truth):
protected void sendKeepAlives(){
  if (mode == Mode.PER_ID_AS_SESSION) {
    for (    String id : ids.keySet()) {
      JsonObject params=new JsonObject();
      params.addProperty("String_Node_Str",id);
      try {
        client.sendRequest("String_Node_Str",params);
      }
 catch (      IOException e) {
        log.error("String_Node_Str" + id,e);
      }
    }
  }
 else   if (mode == Mode.PER_ID_AS_MEDIAPIPELINE) {
    for (    String id : ids.keySet()) {
      JsonObject params=new JsonObject();
      params.addProperty("String_Node_Str",id);
      try {
        client.sendRequest(new Request<>(id,null,"String_Node_Str",params));
      }
 catch (      JsonRpcErrorException e) {
        log.warn("String_Node_Str" + "String_Node_Str",id,e.getMessage());
      }
catch (      IOException e) {
        log.error("String_Node_Str" + id,e);
      }
    }
  }
 else   if (mode == Mode.PER_CLIENT) {
    try {
      client.sendRequest("String_Node_Str",null);
    }
 catch (    IOException e) {
      throw new KurentoException("String_Node_Str" + client.getSession().getSessionId());
    }
  }
 else {
    throw new KurentoException("String_Node_Str" + mode);
  }
  log.debug("String_Node_Str");
}
Program: 10799
Project: 10799
Buggy source:
public void updateWebSocketSession(WebSocketSession wsSession){
synchronized (this) {
    this.wsSession=wsSession;
  }
}

Fixed version (ground truth):
public void updateWebSocketSession(WebSocketSession wsSession){
synchronized (wsSession) {
    this.wsSession=wsSession;
  }
}
Program: 10800
Project: 10800
Buggy source:
private <P,R>Response<R> sendRequestWebSocket(Request<P> request,Class<R> resultClass){
  Future<Response<JsonElement>> responseFuture=null;
  if (request.getId() != null) {
    responseFuture=pendingRequests.prepareResponse(request.getId());
  }
  try {
synchronized (this) {
      wsSession.sendMessage(new TextMessage(JsonUtils.toJson(request)));
    }
  }
 catch (  Exception e) {
    throw new KurentoException("String_Node_Str" + JsonUtils.toJson(request) + "String_Node_Str"+ wsSession.getId()+ "String_Node_Str",e);
  }
  if (responseFuture == null) {
    return null;
  }
  Response<JsonElement> responseJsonObject;
  try {
    responseJsonObject=responseFuture.get();
  }
 catch (  InterruptedException e) {
    throw new JsonRpcException("String_Node_Str",e);
  }
catch (  ExecutionException e) {
    throw new JsonRpcException("String_Node_Str",e);
  }
  return MessageUtils.convertResponse(responseJsonObject,resultClass);
}

Fixed version (ground truth):
private <P,R>Response<R> sendRequestWebSocket(Request<P> request,Class<R> resultClass){
  Future<Response<JsonElement>> responseFuture=null;
  if (request.getId() != null) {
    responseFuture=pendingRequests.prepareResponse(request.getId());
  }
  try {
synchronized (wsSession) {
      wsSession.sendMessage(new TextMessage(JsonUtils.toJson(request)));
    }
  }
 catch (  Exception e) {
    throw new KurentoException("String_Node_Str" + JsonUtils.toJson(request) + "String_Node_Str"+ wsSession.getId()+ "String_Node_Str",e);
  }
  if (responseFuture == null) {
    return null;
  }
  Response<JsonElement> responseJsonObject;
  try {
    responseJsonObject=responseFuture.get();
  }
 catch (  InterruptedException e) {
    throw new JsonRpcException("String_Node_Str",e);
  }
catch (  ExecutionException e) {
    throw new JsonRpcException("String_Node_Str",e);
  }
  return MessageUtils.convertResponse(responseJsonObject,resultClass);
}
Program: 10802
Project: 10802
Buggy source:
public BrowserClient(Builder builder){
  this.builder=builder;
  this.scope=builder.scope;
  this.video=builder.video;
  this.audio=builder.audio;
  this.serverPort=builder.serverPort;
  this.client=builder.client;
  this.browserType=builder.browserType;
  this.usePhysicalCam=builder.usePhysicalCam;
  this.enableScreenCapture=builder.enableScreenCapture;
  this.recordAudio=builder.recordAudio;
  this.audioSampleRate=builder.audioSampleRate;
  this.audioChannel=builder.audioChannel;
  this.browserVersion=builder.browserVersion;
  this.platform=builder.platform;
  this.timeout=builder.timeout;
  this.colorDistance=builder.colorDistance;
  this.thresholdTime=builder.thresholdTime;
  this.hostAddress=builder.hostAddress;
  this.protocol=builder.protocol;
  this.numInstances=builder.numInstances;
  this.browserPerInstance=builder.browserPerInstance;
  this.login=builder.login;
  this.passwd=builder.passwd;
  this.pem=builder.pem;
}

Fixed version (ground truth):
public BrowserClient(Builder builder){
  this.builder=builder;
  this.scope=builder.scope;
  this.video=builder.video;
  this.audio=builder.audio;
  this.serverPort=builder.serverPort;
  this.client=builder.client;
  this.browserType=builder.browserType;
  this.usePhysicalCam=builder.usePhysicalCam;
  this.enableScreenCapture=builder.enableScreenCapture;
  this.recordAudio=builder.recordAudio;
  this.audioSampleRate=builder.audioSampleRate;
  this.audioChannel=builder.audioChannel;
  this.browserVersion=builder.browserVersion;
  this.platform=builder.platform;
  this.timeout=builder.timeout;
  this.colorDistance=builder.colorDistance;
  this.thresholdTime=builder.thresholdTime;
  this.hostAddress=builder.hostAddress;
  this.protocol=builder.protocol;
  this.numInstances=builder.numInstances;
  this.browserPerInstance=builder.browserPerInstance;
  this.login=builder.login;
  this.passwd=builder.passwd;
  this.pem=builder.pem;
  this.publicIp=builder.publicIp;
}
Program: 10803
Project: 10803
Buggy source:
public void createSaucelabsDriver(DesiredCapabilities capabilities) throws MalformedURLException {
  String sauceLabsUser=getProperty(SAUCELAB_USER_PROPERTY);
  String sauceLabsKey=getProperty(SAUCELAB_KEY_PROPERTY);
  capabilities.setCapability("String_Node_Str",browserVersion);
  capabilities.setCapability("String_Node_Str",platform);
  if (name != null) {
    capabilities.setCapability("String_Node_Str",name);
  }
  driver=new RemoteWebDriver(new URL("String_Node_Str" + sauceLabsUser + "String_Node_Str"+ sauceLabsKey+ "String_Node_Str"),capabilities);
}

Fixed version (ground truth):
public void createSaucelabsDriver(DesiredCapabilities capabilities) throws MalformedURLException {
  assertPublicIpNotNull();
  String sauceLabsUser=getProperty(SAUCELAB_USER_PROPERTY);
  String sauceLabsKey=getProperty(SAUCELAB_KEY_PROPERTY);
  if (sauceLabsUser == null || sauceLabsKey == null) {
    throw new RuntimeException("String_Node_Str" + SAUCELAB_USER_PROPERTY + "String_Node_Str"+ sauceLabsUser+ "String_Node_Str"+ SAUCELAB_KEY_PROPERTY+ "String_Node_Str"+ sauceLabsKey);
  }
  capabilities.setCapability("String_Node_Str",browserVersion);
  capabilities.setCapability("String_Node_Str",platform);
  if (name != null) {
    capabilities.setCapability("String_Node_Str",name);
  }
  driver=new RemoteWebDriver(new URL("String_Node_Str" + sauceLabsUser + "String_Node_Str"+ sauceLabsKey+ "String_Node_Str"),capabilities);
}
Program: 10805
Project: 10805
Buggy source:
public BrowserClient build(){
  hostAddress=getProperty(TEST_PUBLIC_IP_PROPERTY,TEST_PUBLIC_IP_DEFAULT);
  return new BrowserClient(this);
}

Fixed version (ground truth):
public BrowserClient build(){
  return new BrowserClient(this);
}
Program: 10808
Project: 10808
Buggy source:
private void createHtmlPages(){
  try {
    final String outputFolder=new ClassPathResource("String_Node_Str").getFile().getAbsolutePath() + File.separator;
    Configuration cfg=new Configuration();
    cfg.setClassForTemplateLoading(KurentoJsBase.class,"String_Node_Str");
    Template template=cfg.getTemplate("String_Node_Str");
    Map<String,Object> data=new HashMap<String,Object>();
    data.put("String_Node_Str",kurentoUrl);
    for (    String lib : kurentoLibs) {
      Writer writer=new FileWriter(new File(outputFolder + lib + "String_Node_Str"));
      data.put("String_Node_Str",lib);
      if (lib.contains("String_Node_Str")) {
        data.put("String_Node_Str","String_Node_Str");
      }
 else {
        data.put("String_Node_Str","String_Node_Str");
      }
      template.process(data,writer);
      writer.flush();
      writer.close();
    }
  }
 catch (  Exception e) {
    Assert.fail("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
private void createHtmlPages(){
  try {
    final String outputFolder=new ClassPathResource("String_Node_Str").getFile().getAbsolutePath() + File.separator;
    Configuration cfg=new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
    cfg.setClassForTemplateLoading(KurentoJsBase.class,"String_Node_Str");
    Template template=cfg.getTemplate("String_Node_Str");
    Map<String,Object> data=new HashMap<String,Object>();
    data.put("String_Node_Str",kurentoUrl);
    for (    String lib : kurentoLibs) {
      Writer writer=new FileWriter(new File(outputFolder + lib + "String_Node_Str"));
      data.put("String_Node_Str",lib);
      if (lib.contains("String_Node_Str")) {
        data.put("String_Node_Str","String_Node_Str");
      }
 else {
        data.put("String_Node_Str","String_Node_Str");
      }
      template.process(data,writer);
      writer.flush();
      writer.close();
    }
  }
 catch (  Exception e) {
    Assert.fail("String_Node_Str" + e.getMessage());
  }
}
Program: 10809
Project: 10809
Buggy source:
public KurentoJsBowerTest(){
  kurentoUrl="String_Node_Str";
}

Fixed version (ground truth):
public KurentoJsBowerTest(){
  super(new TestScenario());
  kurentoUrl="String_Node_Str";
}
Program: 10810
Project: 10810
Buggy source:
public KurentoJsReleaseTest(){
  kurentoUrl=getProperty("String_Node_Str",DEFAULT_KURENTO_JS_URL);
  log.debug("String_Node_Str",kurentoUrl);
  if (!kurentoUrl.endsWith("String_Node_Str")) {
    kurentoUrl+="String_Node_Str";
  }
}

Fixed version (ground truth):
public KurentoJsReleaseTest(){
  super(new TestScenario());
  kurentoUrl=getProperty("String_Node_Str",DEFAULT_KURENTO_JS_URL);
  log.debug("String_Node_Str",kurentoUrl);
  if (!kurentoUrl.endsWith("String_Node_Str")) {
    kurentoUrl+="String_Node_Str";
  }
}
Program: 10811
Project: 10811
Buggy source:
@Override public void registerJsonRpcHandlers(JsonRpcHandlerRegistry registry){
  registry.addHandler(echoJsonRpcHandler(),"String_Node_Str");
  registry.addHandler(new BidirectionalTest.Handler(),"String_Node_Str");
  registry.addHandler(new BidirectionalMultiTest.Handler(),"String_Node_Str");
  registry.addHandler(new ServerEventsTest.Handler(),"String_Node_Str");
  registry.addHandler(new AsyncServerTest.Handler(),"String_Node_Str");
  registry.addHandler(new ErrorServerTest.Handler(),"String_Node_Str");
  registry.addPerSessionHandler(MultipleSessionsTest.Handler.class,"String_Node_Str");
  registry.addPerSessionHandler("String_Node_Str","String_Node_Str");
  registry.addHandler(new NewSessionTest.Handler(),"String_Node_Str");
  registry.addHandler(new CloseSessionTest.Handler(),"String_Node_Str");
  registry.addHandler(new ReconnectionTest.Handler(),"String_Node_Str");
  registry.addHandler(new ConnectionListenerTest.Handler(),"String_Node_Str");
  registry.addHandler(new NotificationTest.Handler(),"String_Node_Str");
}

Fixed version (ground truth):
@Override public void registerJsonRpcHandlers(JsonRpcHandlerRegistry registry){
  registry.addHandler(echoJsonRpcHandler(),"String_Node_Str");
  registry.addHandler(new BidirectionalTest.Handler(),"String_Node_Str");
  registry.addHandler(new BidirectionalMultiTest.Handler(),"String_Node_Str");
  registry.addHandler(new ServerEventsTest.Handler(),"String_Node_Str");
  registry.addHandler(new AsyncServerTest.Handler(),"String_Node_Str");
  registry.addHandler(new ErrorServerTest.Handler(),"String_Node_Str");
  registry.addPerSessionHandler(MultipleSessionsTest.Handler.class,"String_Node_Str");
  registry.addPerSessionHandler("String_Node_Str","String_Node_Str");
  registry.addHandler(new NewSessionTest.Handler(),"String_Node_Str");
  registry.addHandler(new CloseSessionTest.Handler(),"String_Node_Str");
  registry.addHandler(new ReconnectionTest.Handler(),"String_Node_Str");
  registry.addHandler(new ReconnectionServerTest.Handler(),"String_Node_Str");
  registry.addHandler(new ConnectionListenerTest.Handler(),"String_Node_Str");
  registry.addHandler(new NotificationTest.Handler(),"String_Node_Str");
}
Program: 10812
Project: 10812
Buggy source:
@Override public void handleRequest(HttpServletRequest servletRequest,final HttpServletResponse servletResponse) throws ServletException, IOException {
  String messageJson=getBodyAsString(servletRequest);
  ServerSessionFactory factory=new ServerSessionFactory(){
    @Override public ServerSession createSession(    String sessionId,    Object registerInfo,    SessionsManager sessionsManager){
      return new HttpRequestServerSession(sessionId,registerInfo,sessionsManager,null);
    }
  }
;
  ResponseSender responseSender=new ResponseSender(){
    @Override public void sendResponse(    Message message) throws IOException {
      servletResponse.getWriter().println(message);
    }
  }
;
  String internalSessionId=null;
  HttpSession session=servletRequest.getSession(false);
  if (session != null) {
    internalSessionId=session.getId();
  }
  protocolManager.processMessage(messageJson,factory,responseSender,internalSessionId);
}

Fixed version (ground truth):
@Override public void handleRequest(HttpServletRequest servletRequest,final HttpServletResponse servletResponse) throws ServletException, IOException {
  String messageJson=getBodyAsString(servletRequest);
  ServerSessionFactory factory=new ServerSessionFactory(){
    @Override public ServerSession createSession(    String sessionId,    Object registerInfo,    SessionsManager sessionsManager){
      return new HttpRequestServerSession(sessionId,registerInfo,sessionsManager,null);
    }
    @Override public void updateSessionOnReconnection(    ServerSession session){
      throw new UnsupportedOperationException();
    }
  }
;
  ResponseSender responseSender=new ResponseSender(){
    @Override public void sendResponse(    Message message) throws IOException {
      servletResponse.getWriter().println(message);
    }
  }
;
  String internalSessionId=null;
  HttpSession session=servletRequest.getSession(false);
  if (session != null) {
    internalSessionId=session.getId();
  }
  protocolManager.processMessage(messageJson,factory,responseSender,internalSessionId);
}
Program: 10813
Project: 10813
Buggy source:
private void processReconnectMessage(ServerSessionFactory factory,Request<JsonElement> request,ResponseSender responseSender,String transportId) throws IOException {
  String sessionId=request.getSessionId();
  if (sessionId == null) {
    responseSender.sendResponse(new Response<>(request.getId(),new ResponseError(99999,"String_Node_Str")));
  }
 else {
    ServerSession session=sessionsManager.get(sessionId);
    if (session != null) {
      String oldTransportId=session.getTransportId();
      session.setTransportId(transportId);
      sessionsManager.updateTransportId(session,oldTransportId);
      cancelCloseTimer(session);
      responseSender.sendResponse(new Response<>(sessionId,request.getId(),RECONNECTION_SUCCESSFUL));
    }
 else {
      responseSender.sendResponse(new Response<>(request.getId(),new ResponseError(99999,RECONNECTION_ERROR)));
    }
  }
}

Fixed version (ground truth):
private void processReconnectMessage(ServerSessionFactory factory,Request<JsonElement> request,ResponseSender responseSender,String transportId) throws IOException {
  String sessionId=request.getSessionId();
  if (sessionId == null) {
    responseSender.sendResponse(new Response<>(request.getId(),new ResponseError(99999,"String_Node_Str")));
  }
 else {
    ServerSession session=sessionsManager.get(sessionId);
    if (session != null) {
      String oldTransportId=session.getTransportId();
      session.setTransportId(transportId);
      factory.updateSessionOnReconnection(session);
      sessionsManager.updateTransportId(session,oldTransportId);
      cancelCloseTimer(session);
      responseSender.sendResponse(new Response<>(sessionId,request.getId(),RECONNECTION_SUCCESSFUL));
    }
 else {
      responseSender.sendResponse(new Response<>(request.getId(),new ResponseError(99999,RECONNECTION_ERROR)));
    }
  }
}
Program: 10814
Project: 10814
Buggy source:
@Override public void handleTextMessage(final WebSocketSession wsSession,TextMessage message) throws Exception {
  try {
    String messageJson=message.getPayload();
    log.debug("String_Node_Str",messageJson);
    ServerSessionFactory factory=new ServerSessionFactory(){
      @Override public ServerSession createSession(      String sessionId,      Object registerInfo,      SessionsManager sessionsManager){
        return new WebSocketServerSession(sessionId,registerInfo,sessionsManager,wsSession);
      }
    }
;
    protocolManager.processMessage(messageJson,factory,new WebSocketResponseSender(wsSession),wsSession.getId());
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void handleTextMessage(final WebSocketSession wsSession,TextMessage message) throws Exception {
  try {
    String messageJson=message.getPayload();
    log.debug("String_Node_Str",messageJson);
    ServerSessionFactory factory=new ServerSessionFactory(){
      @Override public ServerSession createSession(      String sessionId,      Object registerInfo,      SessionsManager sessionsManager){
        return new WebSocketServerSession(sessionId,registerInfo,sessionsManager,wsSession);
      }
      @Override public void updateSessionOnReconnection(      ServerSession session){
        ((WebSocketServerSession)session).updateWebSocketSession(wsSession);
      }
    }
;
    protocolManager.processMessage(messageJson,factory,new WebSocketResponseSender(wsSession),wsSession.getId());
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
}
Program: 10815
Project: 10815
Buggy source:
private <P,R>Response<R> sendRequestWebSocket(Request<P> request,Class<R> resultClass){
  Future<Response<JsonElement>> responseFuture=null;
  if (request.getId() != null) {
    responseFuture=pendingRequests.prepareResponse(request.getId());
  }
  try {
synchronized (wsSession) {
      wsSession.sendMessage(new TextMessage(JsonUtils.toJson(request)));
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",JsonUtils.toJson(request),wsSession.getId(),e);
    return null;
  }
  if (responseFuture == null) {
    return null;
  }
  Response<JsonElement> responseJsonObject;
  try {
    responseJsonObject=responseFuture.get();
  }
 catch (  InterruptedException e) {
    throw new JsonRpcException("String_Node_Str",e);
  }
catch (  ExecutionException e) {
    throw new JsonRpcException("String_Node_Str",e);
  }
  return MessageUtils.convertResponse(responseJsonObject,resultClass);
}

Fixed version (ground truth):
private <P,R>Response<R> sendRequestWebSocket(Request<P> request,Class<R> resultClass){
  Future<Response<JsonElement>> responseFuture=null;
  if (request.getId() != null) {
    responseFuture=pendingRequests.prepareResponse(request.getId());
  }
  try {
synchronized (this) {
      wsSession.sendMessage(new TextMessage(JsonUtils.toJson(request)));
    }
  }
 catch (  Exception e) {
    throw new KurentoException("String_Node_Str" + JsonUtils.toJson(request) + "String_Node_Str"+ wsSession.getId()+ "String_Node_Str",e);
  }
  if (responseFuture == null) {
    return null;
  }
  Response<JsonElement> responseJsonObject;
  try {
    responseJsonObject=responseFuture.get();
  }
 catch (  InterruptedException e) {
    throw new JsonRpcException("String_Node_Str",e);
  }
catch (  ExecutionException e) {
    throw new JsonRpcException("String_Node_Str",e);
  }
  return MessageUtils.convertResponse(responseJsonObject,resultClass);
}
Program: 10816
Project: 10816
Buggy source:
private void makeAssertions(String messageAppend,BrowserClient browser,int playtime,int x,int y,CountDownLatch eosLatch,Color... expectedColors) throws InterruptedException {
  Assert.assertTrue("String_Node_Str" + messageAppend,browser.waitForEvent("String_Node_Str"));
  for (  Color color : expectedColors) {
    Assert.assertTrue("String_Node_Str" + color + "String_Node_Str"+ messageAppend,browser.similarColorAt(color,x,y));
  }
  if (eosLatch != null) {
    Assert.assertTrue("String_Node_Str",eosLatch.await(TIMEOUT_EOS,TimeUnit.SECONDS));
  }
 else {
    Assert.assertTrue("String_Node_Str",browser.waitForEvent("String_Node_Str"));
  }
  double currentTime=browser.getCurrentTime();
  Assert.assertTrue("String_Node_Str" + playtime + "String_Node_Str"+ currentTime+ "String_Node_Str"+ messageAppend,compare(playtime,currentTime));
}

Fixed version (ground truth):
private void makeAssertions(String messageAppend,BrowserClient browser,int playtime,int x,int y,CountDownLatch eosLatch,Color... expectedColors) throws InterruptedException {
  Assert.assertTrue("String_Node_Str" + messageAppend,browser.waitForEvent("String_Node_Str"));
  for (  Color color : expectedColors) {
    Assert.assertTrue("String_Node_Str" + color + "String_Node_Str"+ messageAppend,browser.similarColorAt(color,x,y));
  }
  if (eosLatch != null) {
    Assert.assertTrue("String_Node_Str",eosLatch.await(TIMEOUT_EOS,TimeUnit.SECONDS));
  }
 else {
    Thread.sleep(playtime * 1000);
  }
  double currentTime=browser.getCurrentTime();
  Assert.assertTrue("String_Node_Str" + playtime + "String_Node_Str"+ currentTime+ "String_Node_Str"+ messageAppend,compare(playtime,currentTime));
}
Program: 10817
Project: 10817
Buggy source:
private void internalSendResponse(Response<? extends Object> response) throws IOException {
  boolean notResponded=setRespondedIfNot();
  if (notResponded) {
    if (response.getSessionId() == null && INJECT_SESSION_ID) {
      response.setSessionId(session.getSessionId());
    }
    responseSender.sendResponse(response);
  }
 else {
    throw new RequestAlreadyRespondedException("String_Node_Str");
  }
}

Fixed version (ground truth):
private void internalSendResponse(Response<? extends Object> response) throws IOException {
  boolean notResponded=setRespondedIfNot();
  if (notResponded) {
    if (response.getSessionId() == null && INJECT_SESSION_ID) {
      response.setSessionId(session.getSessionId());
    }
    if (response.getId() == null) {
      response.setId(request.getId());
    }
    responseSender.sendResponse(response);
  }
 else {
    throw new RequestAlreadyRespondedException("String_Node_Str");
  }
}
Program: 10818
Project: 10818
Buggy source:
public WebSocketServerSession(String sessionId,Object registerInfo,SessionsManager sessionsManager,WebSocketSession wsSession){
  super(sessionId,registerInfo,sessionsManager,wsSession.getId());
  this.wsSession=wsSession;
  this.setRsHelper(new JsonRpcRequestSenderHelper(sessionId){
    @Override public <P,R>Response<R> internalSendRequest(    Request<P> request,    Class<R> resultClass) throws IOException {
      return sendRequestWebSocket(request,resultClass);
    }
    @Override protected void internalSendRequest(    Request<? extends Object> request,    Class<JsonElement> class1,    Continuation<Response<JsonElement>> continuation){
      throw new UnsupportedOperationException("String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
public WebSocketServerSession(String sessionId,Object registerInfo,SessionsManager sessionsManager,WebSocketSession wsSession){
  super(sessionId,registerInfo,sessionsManager,wsSession.getId());
  this.wsSession=wsSession;
  this.setRsHelper(new JsonRpcRequestSenderHelper(sessionId){
    @Override public <P,R>Response<R> internalSendRequest(    Request<P> request,    Class<R> resultClass) throws IOException {
      return sendRequestWebSocket(request,resultClass);
    }
    @Override protected void internalSendRequest(    Request<? extends Object> request,    Class<JsonElement> resultClass,    Continuation<Response<JsonElement>> continuation){
      sendRequestWebSocket(request,resultClass,continuation);
    }
  }
);
}
Program: 10819
Project: 10819
Buggy source:
@Override protected void internalSendRequest(Request<? extends Object> request,Class<JsonElement> class1,Continuation<Response<JsonElement>> continuation){
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override protected void internalSendRequest(Request<? extends Object> request,Class<JsonElement> resultClass,Continuation<Response<JsonElement>> continuation){
  sendRequestWebSocket(request,resultClass,continuation);
}
Program: 10820
Project: 10820
Buggy source:
@Override public void close() throws IOException {
  try {
    wsSession.close();
  }
  finally {
    super.close();
  }
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  try {
    execService.shutdown();
    wsSession.close();
  }
  finally {
    super.close();
  }
}
Program: 10821
Project: 10821
Buggy source:
public void subscribeEvents(String... eventType){
  for (  final String e : eventType) {
    CountDownLatch latch=new CountDownLatch(1);
    countDownLatchEvents.put(e,latch);
    this.addEventListener(e,new BrowserEventListener(){
      @Override public void onEvent(      String event){
        consoleLog(ConsoleLogLevel.info,"String_Node_Str" + event);
        countDownLatchEvents.get(e).countDown();
      }
    }
);
  }
}

Fixed version (ground truth):
public void subscribeEvents(String... eventType){
  subscribeEventsToVideoTag("String_Node_Str",eventType);
}
Program: 10822
Project: 10822
Buggy source:
@Override public void onEvent(String event){
  consoleLog(ConsoleLogLevel.info,"String_Node_Str" + event);
  countDownLatchEvents.get(e).countDown();
}

Fixed version (ground truth):
@Override public void onEvent(String event){
  consoleLog(ConsoleLogLevel.info,"String_Node_Str" + videoTag + "String_Node_Str"+ event);
  countDownLatchEvents.get(e).countDown();
}
Program: 10823
Project: 10823
Buggy source:
@SuppressWarnings("String_Node_Str") public void addEventListener(final String eventType,final BrowserEventListener eventListener){
  Thread t=new Thread(){
    public void run(){
      js.executeScript("String_Node_Str" + eventType + "String_Node_Str");
      try {
        (new WebDriverWait(driver,timeout)).until(new ExpectedCondition<Boolean>(){
          public Boolean apply(          WebDriver d){
            return d.findElement(By.id("String_Node_Str")).getAttribute("String_Node_Str").equalsIgnoreCase(eventType);
          }
        }
);
        eventListener.onEvent(eventType);
      }
 catch (      Throwable t) {
        log.error("String_Node_Str",t.getMessage());
        this.interrupt();
        this.stop();
      }
    }
  }
;
  callbackThreads.add(t);
  t.setDaemon(true);
  t.start();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void addEventListener(final String videoTag,final String eventType,final BrowserEventListener eventListener){
  Thread t=new Thread(){
    public void run(){
      js.executeScript(videoTag + "String_Node_Str" + eventType+ "String_Node_Str");
      try {
        (new WebDriverWait(driver,timeout)).until(new ExpectedCondition<Boolean>(){
          public Boolean apply(          WebDriver d){
            return d.findElement(By.id("String_Node_Str")).getAttribute("String_Node_Str").equalsIgnoreCase(eventType);
          }
        }
);
        eventListener.onEvent(eventType);
      }
 catch (      Throwable t) {
        log.error("String_Node_Str",t.getMessage());
        this.interrupt();
        this.stop();
      }
    }
  }
;
  callbackThreads.add(t);
  t.setDaemon(true);
  t.start();
}
Program: 10825
Project: 10825
Buggy source:
@Override public synchronized void onEvent(ChangeColorEvent e){
  if (e.getVideoTag() == VideoTag.LOCAL) {
    lastLocalColorChangeTime=e.getTime();
    lastLocalColor=e.getColor();
    localEventLatch.release();
  }
 else   if (e.getVideoTag() == VideoTag.REMOTE) {
    lastRemoteColorChangeTime=e.getTime();
    lastRemoteColor=e.getColor();
    remoteEventLatch.release();
  }
}

Fixed version (ground truth):
@Override public synchronized void onEvent(ChangeColorEvent e){
  if (e.getVideoTag() == VideoTag.LOCAL) {
    lastLocalColorChangeTimeAbsolute=new Date().getTime();
    lastLocalColorChangeTime=e.getTime();
    lastLocalColor=e.getColor();
    localEventLatch.release();
  }
 else   if (e.getVideoTag() == VideoTag.REMOTE) {
    lastRemoteColorChangeTimeAbsolute=new Date().getTime();
    lastRemoteColorChangeTime=e.getTime();
    lastRemoteColor=e.getColor();
    remoteEventLatch.release();
  }
}
Program: 10826
Project: 10826
Buggy source:
@Override public void afterConnectionClosed(WebSocketSession wsSession,org.springframework.web.socket.CloseStatus status) throws Exception {
  log.info("String_Node_Str" + status);
  if (status.equals(CloseStatus.GOING_AWAY)) {
    log.info("String_Node_Str");
  }
 else   if (!status.equals(CloseStatus.NORMAL)) {
    log.error("String_Node_Str" + status.getCode());
  }
 else {
    log.info("String_Node_Str");
  }
  protocolManager.closeSessionIfTimeout(wsSession.getId(),status.getReason());
}

Fixed version (ground truth):
@Override public void afterConnectionClosed(WebSocketSession wsSession,org.springframework.web.socket.CloseStatus status) throws Exception {
  log.info("String_Node_Str" + status);
  if (status.getCode() == CloseStatus.GOING_AWAY.getCode()) {
    log.info("String_Node_Str");
  }
 else   if (!status.equals(CloseStatus.NORMAL)) {
    log.error("String_Node_Str" + status.getCode());
  }
 else {
    log.info("String_Node_Str");
  }
  protocolManager.closeSessionIfTimeout(wsSession.getId(),status.getReason());
}
Program: 10827
Project: 10827
Buggy source:
@Override public void handleTransportError(Session session,Throwable exception) throws Exception {
}

Fixed version (ground truth):
@Override public void handleTransportError(Session session,Throwable exception) throws Exception {
  log.warn("String_Node_Str",exception);
}
Program: 10828
Project: 10828
Buggy source:
@Override public void handleTransportError(WebSocketSession session,Throwable exception) throws Exception {
  log.warn("String_Node_Str",exception);
}

Fixed version (ground truth):
@Override public void handleTransportError(WebSocketSession session,Throwable exception) throws Exception {
  protocolManager.processTransportError(session.getId(),exception);
}
Program: 10829
Project: 10829
Buggy source:
@Override public void afterConnectionClosed(WebSocketSession wsSession,org.springframework.web.socket.CloseStatus status) throws Exception {
  log.info("String_Node_Str" + status);
  if (!status.equals(CloseStatus.NORMAL)) {
    log.error("String_Node_Str");
  }
 else {
    log.info("String_Node_Str");
  }
  protocolManager.closeSessionIfTimeout(wsSession.getId(),status.getReason());
}

Fixed version (ground truth):
@Override public void afterConnectionClosed(WebSocketSession wsSession,org.springframework.web.socket.CloseStatus status) throws Exception {
  log.info("String_Node_Str" + status);
  if (status.equals(CloseStatus.GOING_AWAY)) {
    log.info("String_Node_Str");
  }
 else   if (!status.equals(CloseStatus.NORMAL)) {
    log.error("String_Node_Str" + status.getCode());
  }
 else {
    log.info("String_Node_Str");
  }
  protocolManager.closeSessionIfTimeout(wsSession.getId(),status.getReason());
}
Program: 10830
Project: 10830
Buggy source:
public void setSamplingTime(long samplingTime) throws IOException {
  if (remoteKms != null) {
    sendMessage("String_Node_Str" + samplingTime);
  }
 else {
    monitor.incrementLatencyErrors();
  }
}

Fixed version (ground truth):
public void setSamplingTime(long samplingTime) throws IOException {
  if (remoteKms != null) {
    sendMessage("String_Node_Str" + samplingTime);
  }
 else {
    monitor.setSamplingTime(samplingTime);
  }
}
Program: 10831
Project: 10831
Buggy source:
@Override public void handleTransportError(WebSocketSession session,Throwable exception) throws Exception {
  RoomParticipant user=(RoomParticipant)session.getAttributes().get(USER);
  if (!user.isClosed()) {
    log.warn("String_Node_Str",exception);
  }
}

Fixed version (ground truth):
@Override public void handleTransportError(WebSocketSession session,Throwable exception) throws Exception {
  RoomParticipant user=(RoomParticipant)session.getAttributes().get(USER);
  if (user != null && !user.isClosed()) {
    log.warn("String_Node_Str",exception);
  }
}
Program: 10833
Project: 10833
Buggy source:
private void startKurentoTreeServer(){
  System.setProperty("String_Node_Str",System.getProperty("String_Node_Str","String_Node_Str"));
  String kmsUri=PropertiesManager.getProperty(KurentoServicesTestHelper.KMS_WS_URI_PROP,KurentoServicesTestHelper.KMS_WS_URI_DEFAULT);
  System.setProperty(KurentoTreeServerApp.KMSS_URIS_PROPERTY,"String_Node_Str" + kmsUri + "String_Node_Str"+ kmsUri+ "String_Node_Str");
  KurentoTreeServerApp.start();
}

Fixed version (ground truth):
private void startKurentoTreeServer(){
  String kmsUri=PropertiesManager.getProperty(KurentoServicesTestHelper.KMS_WS_URI_PROP,KurentoServicesTestHelper.KMS_WS_URI_DEFAULT);
  System.setProperty(KurentoTreeServerApp.KMSS_URIS_PROPERTY,"String_Node_Str" + kmsUri + "String_Node_Str"+ kmsUri+ "String_Node_Str");
  System.setProperty(KurentoTreeServerApp.WEBSOCKET_PORT_PROPERTY,Integer.toString(KurentoServicesTestHelper.getAppHttpPort()));
  KurentoTreeServerApp.start();
}
Program: 10834
Project: 10834
Buggy source:
@Test public void registrarTest() throws IOException, InterruptedException {
  String port=System.getProperty("String_Node_Str","String_Node_Str");
  System.setProperty(KurentoTreeServerApp.KMSS_URIS_PROPERTY,"String_Node_Str");
  ConfigurableApplicationContext context=SpringApplication.run(TestConfiguration.class,"String_Node_Str" + port);
  context.start();
  JsonRpcClientWebSocket client=new JsonRpcClientWebSocket("String_Node_Str" + port + "String_Node_Str");
  String wsUri="String_Node_Str";
  JsonObject params=new JsonObject();
  params.addProperty("String_Node_Str",wsUri);
  client.sendRequest("String_Node_Str",params);
  assertThat(registeredKmss.poll(),is(wsUri));
  client.close();
  context.close();
}

Fixed version (ground truth):
@Test public void registrarTest() throws IOException, InterruptedException {
  int port=KurentoServicesTestHelper.getAppHttpPort();
  System.setProperty(KurentoTreeServerApp.KMSS_URIS_PROPERTY,"String_Node_Str");
  ConfigurableApplicationContext context=SpringApplication.run(TestConfiguration.class,"String_Node_Str" + port);
  context.start();
  JsonRpcClientWebSocket client=new JsonRpcClientWebSocket("String_Node_Str" + port + "String_Node_Str");
  String wsUri="String_Node_Str";
  JsonObject params=new JsonObject();
  params.addProperty("String_Node_Str",wsUri);
  client.sendRequest("String_Node_Str",params);
  assertThat(registeredKmss.poll(),is(wsUri));
  client.close();
  context.close();
}
Program: 10835
Project: 10835
Buggy source:
public static JsonRpcClient createJsonRpcClient(){
  String rabbitMqHost=getProperty(RABBITMQ_HOST_PROPERTY);
  if (rabbitMqHost != null) {
    String port=getProperty(RABBITMQ_PORT_PROPERTY,RABBITMQ_PORT_DEFAULT);
    String host=getProperty(RABBITMQ_HOST_PROPERTY,RABBITMQ_HOST_DEFAULT);
    String username=getProperty(RABBITMQ_USERNAME_PROPERTY,RABBITMQ_USERNAME_DEFAULT);
    String password=getProperty(RABBITMQ_PASSWORD_PROPERTY,RABBITMQ_PASSWORD_DEFAULT);
    String vhost=getProperty(RABBITMQ_VHOST_PROPERTY,RABBITMQ_VHOST_DEFAULT);
    log.info("String_Node_Str");
    return newJsonRpcClientRabbitMq(host,port,username,password,vhost);
  }
  String wsUri=getProperty(MEDIA_SERVER_WS_URI_PROPERTY,MEDIA_SERVER_WS_URI_DEFAULT);
  log.info("String_Node_Str");
  log.info("String_Node_Str" + wsUri);
  return new JsonRpcClientWebSocket(wsUri);
}

Fixed version (ground truth):
public static JsonRpcClient createJsonRpcClient(){
  String rabbitMqHost=getProperty(RABBITMQ_HOST_PROPERTY);
  if (rabbitMqHost != null) {
    String port=getProperty(RABBITMQ_PORT_PROPERTY,RABBITMQ_PORT_DEFAULT);
    String host=getProperty(RABBITMQ_HOST_PROPERTY,RABBITMQ_HOST_DEFAULT);
    String username=getProperty(RABBITMQ_USERNAME_PROPERTY,RABBITMQ_USERNAME_DEFAULT);
    String password=getProperty(RABBITMQ_PASSWORD_PROPERTY,RABBITMQ_PASSWORD_DEFAULT);
    String vhost=getProperty(RABBITMQ_VHOST_PROPERTY,RABBITMQ_VHOST_DEFAULT);
    log.info("String_Node_Str");
    return newJsonRpcClientRabbitMq(host,port,username,password,vhost);
  }
  String host=getProperty(KMS_WEBSOCKETS_HOST_PROPERTY,KMS_WEBSOCKETS_HOST_DEFAULT);
  String port=getProperty(KMS_WEBSOCKETS_PORT_PROPERTY,KMS_WEBSOCKETS_PORT_DEFAULT);
  String path=getProperty(KMS_WEBSOCKETS_PATH_PROPERTY,KMS_WEBSOCKETS_PATH_DEFAULT);
  String wsUri="String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str"+ path;
  log.info("String_Node_Str");
  log.info("String_Node_Str" + wsUri);
  return new JsonRpcClientWebSocket(wsUri);
}
Program: 10836
Project: 10836
Buggy source:
@Override public String getProperty(String property){
  String systemProperty=System.getProperty(property);
  if (systemProperty != null) {
    return systemProperty;
  }
  String[] tokens=property.split("String_Node_Str");
  int lastTokenNumber=tokens.length - 1;
  JsonObject currentObject=configFile;
  for (int i=0; i < tokens.length; i++) {
    JsonElement element=currentObject.get(tokens[i]);
    if (element == null) {
      return null;
    }
    if (i == lastTokenNumber) {
      return element.getAsString();
    }
    try {
      currentObject=(JsonObject)element;
    }
 catch (    ClassCastException e) {
      return null;
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public String getProperty(String property){
  String systemProperty=System.getProperty(property);
  if (systemProperty != null) {
    return systemProperty;
  }
  String[] tokens=property.split("String_Node_Str");
  int lastTokenNumber=tokens.length - 1;
  JsonObject currentObject=configFile;
  for (int i=0; i < tokens.length; i++) {
    JsonElement element=currentObject.get(tokens[i]);
    if (element == null) {
      return null;
    }
    if (i == lastTokenNumber) {
      if (element instanceof JsonPrimitive) {
        return element.getAsString();
      }
 else {
        return element.toString();
      }
    }
    try {
      currentObject=(JsonObject)element;
    }
 catch (    ClassCastException e) {
      return null;
    }
  }
  return null;
}
Program: 10837
Project: 10837
Buggy source:
/** 
 * Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception).
 * @param istream The input stream to read from
 * @param ostream The output stream to write to
 * @return Exception which occurred during processing
 */
protected IOException copyStreams(InputStream istream,OutputStream ostream){
  IOException exception=null;
  byte buffer[]=new byte[INPUT_BUFFER_SIZE];
  int len=buffer.length;
  while (true) {
    try {
      len=istream.read(buffer);
      if (len == -1) {
        break;
      }
      ostream.write(buffer,0,len);
      log.debug("String_Node_Str" + len);
    }
 catch (    IOException e) {
      exception=e;
      len=-1;
      break;
    }
  }
  return exception;
}

Fixed version (ground truth):
/** 
 * Copy the contents of the specified input stream to the specified output stream, and ensure that both streams are closed before returning (even in the face of an exception).
 * @param istream The input stream to read from
 * @param ostream The output stream to write to
 * @return Exception which occurred during processing
 */
protected IOException copyStreams(InputStream istream,OutputStream ostream){
  IOException exception=null;
  byte buffer[]=new byte[INPUT_BUFFER_SIZE];
  int len=buffer.length;
  while (true) {
    try {
      len=istream.read(buffer);
      if (len == -1) {
        break;
      }
      ostream.write(buffer,0,len);
      log.debug("String_Node_Str",len);
    }
 catch (    IOException e) {
      exception=e;
      len=-1;
      break;
    }
  }
  return exception;
}