Program: 70564
Project: 70564
Buggy source:
@Override public void execute(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  HttpRequest request=(DefaultHttpRequest)e.getMessage();
  String uri=request.getUri();
  String path=uri.split("String_Node_Str")[0].trim();
  String[] pathArray=path.split("String_Node_Str");
  String alias=pathArray[2];
  String requestFile=pathArray[3];
  if (alias == null || requestFile == null) {
    HttpUtil.sendError(ctx,HttpResponseStatus.NOT_FOUND);
    return;
  }
  HlsLiveStream liveStream=HlsLiveStreamMagr.INSTANCE().getHlsLiveStreamByAlias(alias);
  if (liveStream == null) {
    HttpUtil.sendError(ctx,HttpResponseStatus.NOT_FOUND);
    return;
  }
  if (requestFile.equals(LIVE_M3U8)) {
    HlsClientSession clientSession=null;
    QueryStringDecoder decoder=new QueryStringDecoder(request.getUri());
    List<String> sessionId=decoder.getParameters().get("String_Node_Str");
    if (sessionId != null && !sessionId.isEmpty()) {
      clientSession=liveStream.getClientSessionsById(sessionId.get(0));
    }
    LOGGER.info("String_Node_Str",uri,clientSession);
    if (clientSession == null) {
      clientSession=liveStream.newClientSession();
      StringBuffer url=new StringBuffer(50);
      url.append(path).append("String_Node_Str").append(clientSession.getId());
      LOGGER.info("String_Node_Str",url.toString());
      HttpResponse response=HttpUtil.redirectFound(url.toString());
      e.getChannel().write(response);
      return;
    }
    M3U8 m3u8=clientSession.getM3u8File(requestFile);
    DefaultHttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.OK);
    byte[] content=m3u8.getBuf();
    long fileMTime=m3u8.getTime();
    response.headers().add(HttpHeaders.Names.SERVER,Versions.SERVER_VERSION);
    response.headers().add(HttpHeaders.Names.DATE,HttpUtil.getDateString(fileMTime));
    response.headers().add(HttpHeaders.Names.CONTENT_TYPE,HttpUtil.getMimeType(requestFile));
    response.headers().add(HttpHeaders.Names.CONTENT_LENGTH,content.length);
    response.headers().add(HttpHeaders.Names.CACHE_CONTROL,"String_Node_Str");
    response.setContent(ChannelBuffers.copiedBuffer(content));
    e.getChannel().write(response);
  }
 else {
    LOGGER.info("String_Node_Str",uri);
    int tsIndex=Integer.valueOf(requestFile.substring(0,requestFile.indexOf("String_Node_Str"))).intValue();
    String ifModifiedSince=request.headers().get(HttpHeaders.Names.IF_MODIFIED_SINCE);
    if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
      SimpleDateFormat dateFormatter=new SimpleDateFormat(HttpUtil.HTTP_DATE_FORMAT,Locale.US);
      Date mdate=dateFormatter.parse(ifModifiedSince);
      int mdateSec=(int)(mdate.getTime() / 1000L);
      TsSegment tsSegment=liveStream.fetchTsSegment(tsIndex);
      int fileMTimeSec=tsSegment != null ? (int)(tsSegment.getCtime() / 1000L) : 0;
      if (mdateSec == fileMTimeSec) {
        HttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.NOT_MODIFIED);
        response.headers().add(HttpHeaders.Names.CACHE_CONTROL,"String_Node_Str");
        HttpUtil.sendNotModified(ctx,response);
        return;
      }
    }
    TsSegment tsSegment=liveStream.fetchTsSegment(tsIndex);
    if (tsSegment == null) {
      HttpUtil.sendError(ctx,HttpResponseStatus.NOT_FOUND);
      return;
    }
    DefaultHttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.OK);
    byte[] content=tsSegment.getData();
    long fileMTime=tsSegment.getCtime();
    response.headers().add(HttpHeaders.Names.SERVER,Versions.SERVER_VERSION);
    response.headers().add(HttpHeaders.Names.DATE,HttpUtil.getDateString(fileMTime));
    response.headers().add(HttpHeaders.Names.CONTENT_TYPE,HttpUtil.getMimeType(requestFile));
    response.headers().add(HttpHeaders.Names.CONTENT_LENGTH,content.length);
    response.headers().add(HttpHeaders.Names.LAST_MODIFIED,HttpUtil.getDateString(fileMTime));
    response.headers().add(HttpHeaders.Names.EXPIRES,HttpUtil.getDateString(fileMTime + LIVE_CACHE_TIME));
    response.headers().add(HttpHeaders.Names.CACHE_CONTROL,"String_Node_Str" + (LIVE_CACHE_TIME / 1000));
    response.setContent(ChannelBuffers.copiedBuffer(content));
    e.getChannel().write(response);
  }
}

Fixed version (ground truth):
@Override public void execute(ChannelHandlerContext ctx,MessageEvent e) throws Exception {
  HttpRequest request=(DefaultHttpRequest)e.getMessage();
  String uri=request.getUri();
  String path=uri.split("String_Node_Str")[0].trim();
  String[] pathArray=path.split("String_Node_Str");
  String alias=pathArray[2];
  String requestFile=pathArray[3];
  if (alias == null || requestFile == null) {
    HttpUtil.sendError(ctx,HttpResponseStatus.NOT_FOUND);
    return;
  }
  HlsLiveStream liveStream=HlsLiveStreamMagr.INSTANCE().getHlsLiveStreamByAlias(alias);
  if (liveStream == null) {
    HttpUtil.sendError(ctx,HttpResponseStatus.NOT_FOUND);
    return;
  }
  if (requestFile.equals(LIVE_M3U8)) {
    HlsClientSession clientSession=null;
    QueryStringDecoder decoder=new QueryStringDecoder(request.getUri());
    List<String> sessionId=decoder.getParameters().get("String_Node_Str");
    if (sessionId != null && !sessionId.isEmpty()) {
      clientSession=liveStream.getClientSessionsById(sessionId.get(0));
    }
    LOGGER.info("String_Node_Str",uri,clientSession);
    if (clientSession == null) {
      clientSession=liveStream.newClientSession();
      StringBuffer url=new StringBuffer(50);
      url.append(path).append("String_Node_Str").append(clientSession.getId());
      LOGGER.info("String_Node_Str",url.toString());
      HttpResponse response=HttpUtil.redirectFound(url.toString());
      e.getChannel().write(response);
      return;
    }
    M3U8 m3u8=clientSession.getM3u8File(requestFile);
    DefaultHttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.OK);
    byte[] content=m3u8.getBuf();
    long fileMTime=m3u8.getTime();
    response.headers().add(HttpHeaders.Names.SERVER,Versions.SERVER_VERSION);
    response.headers().add(HttpHeaders.Names.DATE,HttpUtil.getDateString(fileMTime));
    response.headers().add(HttpHeaders.Names.CONTENT_TYPE,HttpUtil.getMimeType(requestFile));
    response.headers().add(HttpHeaders.Names.CONTENT_LENGTH,content.length);
    response.headers().add(HttpHeaders.Names.CACHE_CONTROL,"String_Node_Str");
    response.setContent(ChannelBuffers.copiedBuffer(content));
    e.getChannel().write(response);
  }
 else {
    LOGGER.info("String_Node_Str",uri);
    int tsIndex=Integer.valueOf(requestFile.substring(0,requestFile.indexOf("String_Node_Str"))).intValue();
    String ifModifiedSince=request.headers().get(HttpHeaders.Names.IF_MODIFIED_SINCE);
    if (ifModifiedSince != null && !ifModifiedSince.isEmpty()) {
      SimpleDateFormat dateFormatter=new SimpleDateFormat(HttpUtil.HTTP_DATE_FORMAT,Locale.US);
      Date mdate=dateFormatter.parse(ifModifiedSince);
      int mdateSec=(int)(mdate.getTime() / 1000L);
      TsSegment tsSegment=liveStream.fetchTsSegmentByIndex(tsIndex);
      int fileMTimeSec=tsSegment != null ? (int)(tsSegment.getCtime() / 1000L) : 0;
      if (mdateSec == fileMTimeSec) {
        HttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.NOT_MODIFIED);
        response.headers().add(HttpHeaders.Names.CACHE_CONTROL,"String_Node_Str");
        HttpUtil.sendNotModified(ctx,response);
        return;
      }
    }
    TsSegment tsSegment=liveStream.fetchTsSegmentByIndex(tsIndex);
    if (tsSegment == null) {
      HttpUtil.sendError(ctx,HttpResponseStatus.NOT_FOUND);
      return;
    }
    DefaultHttpResponse response=new DefaultHttpResponse(HttpVersion.HTTP_1_1,HttpResponseStatus.OK);
    byte[] content=tsSegment.getData();
    long fileMTime=tsSegment.getCtime();
    response.headers().add(HttpHeaders.Names.SERVER,Versions.SERVER_VERSION);
    response.headers().add(HttpHeaders.Names.DATE,HttpUtil.getDateString(fileMTime));
    response.headers().add(HttpHeaders.Names.CONTENT_TYPE,HttpUtil.getMimeType(requestFile));
    response.headers().add(HttpHeaders.Names.CONTENT_LENGTH,content.length);
    response.headers().add(HttpHeaders.Names.LAST_MODIFIED,HttpUtil.getDateString(fileMTime));
    response.headers().add(HttpHeaders.Names.EXPIRES,HttpUtil.getDateString(fileMTime + LIVE_CACHE_TIME));
    response.headers().add(HttpHeaders.Names.CACHE_CONTROL,"String_Node_Str" + (LIVE_CACHE_TIME / 1000));
    response.setContent(ChannelBuffers.copiedBuffer(content));
    e.getChannel().write(response);
  }
}