Program: 174768
Project: 174768
Buggy source:
/** 
 * @in
 */
public void execute(WebScriptRequest req,WebScriptResponse res) throws IOException {
  ContentReader textReader=null;
  Exception transformException=null;
  String nodeIDString=req.getParameter("String_Node_Str");
  if (nodeIDString == null) {
    throw new WebScriptException("String_Node_Str");
  }
  long nodeId=Long.valueOf(nodeIDString).longValue();
  String propertyQName=req.getParameter("String_Node_Str");
  QName propertyName=null;
  if (propertyQName == null) {
    propertyName=ContentModel.PROP_CONTENT;
  }
 else {
    propertyName=QName.createQName(propertyQName);
  }
  Pair<Long,NodeRef> pair=nodeDAO.getNodePair(nodeId);
  if (pair == null) {
    throw new WebScriptException("String_Node_Str");
  }
  NodeRef nodeRef=pair.getSecond();
  Date modified=(Date)nodeService.getProperty(nodeRef,ContentModel.PROP_MODIFIED);
  if (modified == null) {
    modified=new Date();
  }
  long modifiedSince=-1;
  String modifiedSinceStr=req.getHeader("String_Node_Str");
  if (modifiedSinceStr != null) {
    try {
      modifiedSince=dateFormat.parse(modifiedSinceStr).getTime();
    }
 catch (    Throwable e) {
      if (logger.isWarnEnabled()) {
        logger.warn("String_Node_Str" + modifiedSinceStr);
      }
    }
    if (modifiedSince > 0L) {
      long modDate=(modified.getTime() / 1000L) * 1000L;
      if (modDate <= modifiedSince) {
        res.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
        return;
      }
    }
  }
  ContentReader reader=contentService.getReader(nodeRef,propertyName);
  if (reader == null) {
    res.setStatus(HttpStatus.SC_NO_CONTENT);
    return;
  }
  try {
    TransformationOptions options=new TransformationOptions();
    options.setUse("String_Node_Str");
    options.setSourceNodeRef(nodeRef);
    transformerDebug.pushAvailable(reader.getContentUrl(),reader.getMimetype(),MimetypeMap.MIMETYPE_TEXT_PLAIN,options);
    long sourceSize=reader.getSize();
    List<ContentTransformer> transformers=contentService.getActiveTransformers(reader.getMimetype(),sourceSize,MimetypeMap.MIMETYPE_TEXT_PLAIN,options);
    transformerDebug.availableTransformers(transformers,sourceSize,options,"String_Node_Str");
    if (transformers.isEmpty()) {
      res.setHeader(TRANSFORM_STATUS_HEADER,"String_Node_Str");
      res.setStatus(HttpStatus.SC_NO_CONTENT);
      return;
    }
    ContentTransformer transformer=transformers.get(0);
    ContentWriter writer=contentService.getTempWriter();
    writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
    writer.setEncoding("String_Node_Str");
    try {
      long start=System.currentTimeMillis();
      transformer.transform(reader,writer);
      long transformDuration=System.currentTimeMillis() - start;
      res.setHeader(TRANSFORM_DURATION_HEADER,String.valueOf(transformDuration));
    }
 catch (    ContentIOException e) {
      transformException=e;
    }
    if (transformException == null) {
      textReader=writer.getReader();
      if (textReader == null || !textReader.exists()) {
        transformException=new ContentIOException("String_Node_Str" + "String_Node_Str" + transformer + "String_Node_Str"+ "String_Node_Str"+ writer);
      }
    }
    if (transformException != null) {
      res.setHeader(TRANSFORM_STATUS_HEADER,"String_Node_Str");
      res.setHeader(TRANSFORM_EXCEPTION_HEADER,transformException.getMessage());
      res.setStatus(HttpStatus.SC_NO_CONTENT);
    }
 else {
      res.setStatus(HttpStatus.SC_OK);
      streamContentImpl(req,res,textReader,null,null,false,modified,String.valueOf(modified.getTime()),null,null);
    }
  }
  finally {
    transformerDebug.popAvailable();
  }
}

Fixed version (ground truth):
/** 
 * @in
 */
public void execute(WebScriptRequest req,WebScriptResponse res) throws IOException {
  ContentReader textReader=null;
  Exception transformException=null;
  String nodeIDString=req.getParameter("String_Node_Str");
  if (nodeIDString == null) {
    throw new WebScriptException("String_Node_Str");
  }
  long nodeId=Long.valueOf(nodeIDString).longValue();
  String propertyQName=req.getParameter("String_Node_Str");
  QName propertyName=null;
  if (propertyQName == null) {
    propertyName=ContentModel.PROP_CONTENT;
  }
 else {
    propertyName=QName.createQName(propertyQName);
  }
  Pair<Long,NodeRef> pair=nodeDAO.getNodePair(nodeId);
  if (pair == null) {
    res.setStatus(HttpStatus.SC_NO_CONTENT);
    return;
  }
  NodeRef nodeRef=pair.getSecond();
  Date modified=(Date)nodeService.getProperty(nodeRef,ContentModel.PROP_MODIFIED);
  if (modified == null) {
    modified=new Date();
  }
  long modifiedSince=-1;
  String modifiedSinceStr=req.getHeader("String_Node_Str");
  if (modifiedSinceStr != null) {
    try {
      modifiedSince=dateFormat.parse(modifiedSinceStr).getTime();
    }
 catch (    Throwable e) {
      if (logger.isWarnEnabled()) {
        logger.warn("String_Node_Str" + modifiedSinceStr);
      }
    }
    if (modifiedSince > 0L) {
      long modDate=(modified.getTime() / 1000L) * 1000L;
      if (modDate <= modifiedSince) {
        res.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
        return;
      }
    }
  }
  ContentReader reader=contentService.getReader(nodeRef,propertyName);
  if (reader == null) {
    res.setStatus(HttpStatus.SC_NO_CONTENT);
    return;
  }
  try {
    TransformationOptions options=new TransformationOptions();
    options.setUse("String_Node_Str");
    options.setSourceNodeRef(nodeRef);
    transformerDebug.pushAvailable(reader.getContentUrl(),reader.getMimetype(),MimetypeMap.MIMETYPE_TEXT_PLAIN,options);
    long sourceSize=reader.getSize();
    List<ContentTransformer> transformers=contentService.getActiveTransformers(reader.getMimetype(),sourceSize,MimetypeMap.MIMETYPE_TEXT_PLAIN,options);
    transformerDebug.availableTransformers(transformers,sourceSize,options,"String_Node_Str");
    if (transformers.isEmpty()) {
      res.setHeader(TRANSFORM_STATUS_HEADER,"String_Node_Str");
      res.setStatus(HttpStatus.SC_NO_CONTENT);
      return;
    }
    ContentTransformer transformer=transformers.get(0);
    ContentWriter writer=contentService.getTempWriter();
    writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN);
    writer.setEncoding("String_Node_Str");
    try {
      long start=System.currentTimeMillis();
      transformer.transform(reader,writer);
      long transformDuration=System.currentTimeMillis() - start;
      res.setHeader(TRANSFORM_DURATION_HEADER,String.valueOf(transformDuration));
    }
 catch (    ContentIOException e) {
      transformException=e;
    }
    if (transformException == null) {
      textReader=writer.getReader();
      if (textReader == null || !textReader.exists()) {
        transformException=new ContentIOException("String_Node_Str" + "String_Node_Str" + transformer + "String_Node_Str"+ "String_Node_Str"+ writer);
      }
    }
    if (transformException != null) {
      res.setHeader(TRANSFORM_STATUS_HEADER,"String_Node_Str");
      res.setHeader(TRANSFORM_EXCEPTION_HEADER,transformException.getMessage());
      res.setStatus(HttpStatus.SC_NO_CONTENT);
    }
 else {
      res.setStatus(HttpStatus.SC_OK);
      streamContentImpl(req,res,textReader,null,null,false,modified,String.valueOf(modified.getTime()),null,null);
    }
  }
  finally {
    transformerDebug.popAvailable();
  }
}