Program: 100881
Project: 100881
Buggy source:
/** 
 * Module execution point
 * @see org.dita.dost.module.AbstractPipelineModule#execute(org.dita.dost.pipeline.AbstractPipelineInput)
 * @author Stephen
 */
public AbstractPipelineOutput execute(AbstractPipelineInput input) throws DITAOTException {
  String ditaInput=((PipelineHashIO)input).getAttribute(Constants.ANT_INVOKER_PARAM_INPUTMAP);
  String style=((PipelineHashIO)input).getAttribute(Constants.ANT_INVOKER_EXT_PARAM_STYLE);
  String out=((PipelineHashIO)input).getAttribute(Constants.ANT_INVOKER_EXT_PARAM_OUTPUT);
  OutputStreamWriter output=null;
  DITAOTJavaLogger logger=new DITAOTJavaLogger();
  MergeMapParser mapParser=new MergeMapParser();
  String midResult=null;
  StringReader midStream=null;
  File outputDir=null;
  if (ditaInput == null || !new File(ditaInput).exists()) {
    logger.logError(MessageUtils.getMessage("String_Node_Str").toString());
    return null;
  }
  if (out == null) {
    logger.logError(MessageUtils.getMessage("String_Node_Str").toString());
    return null;
  }
  mapParser.read(ditaInput);
  midResult=new StringBuffer(Constants.XML_HEAD).append("String_Node_Str").append(((StringBuffer)mapParser.getContent().getValue())).append("String_Node_Str").toString();
  midStream=new StringReader(midResult);
  try {
    outputDir=new File(out).getParentFile();
    if (!outputDir.exists()) {
      outputDir.mkdirs();
    }
    if (style != null) {
      TransformerFactory factory=TransformerFactory.newInstance();
      Transformer transformer=factory.newTransformer(new StreamSource(new FileInputStream(style)));
      transformer.transform(new StreamSource(midStream),new StreamResult(new File(out)));
    }
 else {
      output=new OutputStreamWriter(new FileOutputStream(out),Constants.UTF8);
      output.write(midResult);
      output.flush();
    }
  }
 catch (  Exception e) {
    logger.logException(e);
  }
 finally {
    try {
      if (output != null) {
        output.close();
      }
      midStream.close();
    }
 catch (    Exception e) {
      logger.logException(e);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Module execution point
 * @see org.dita.dost.module.AbstractPipelineModule#execute(org.dita.dost.pipeline.AbstractPipelineInput)
 * @author Stephen
 */
public AbstractPipelineOutput execute(AbstractPipelineInput input) throws DITAOTException {
  String ditaInput=((PipelineHashIO)input).getAttribute(Constants.ANT_INVOKER_PARAM_INPUTMAP);
  String style=((PipelineHashIO)input).getAttribute(Constants.ANT_INVOKER_EXT_PARAM_STYLE);
  String out=((PipelineHashIO)input).getAttribute(Constants.ANT_INVOKER_EXT_PARAM_OUTPUT);
  OutputStreamWriter output=null;
  DITAOTJavaLogger logger=new DITAOTJavaLogger();
  MergeMapParser mapParser=new MergeMapParser();
  String midResult=null;
  StringReader midStream=null;
  File outputDir=null;
  if (ditaInput == null || !new File(ditaInput).exists()) {
    logger.logError(MessageUtils.getMessage("String_Node_Str").toString());
    return null;
  }
  if (out == null) {
    logger.logError(MessageUtils.getMessage("String_Node_Str").toString());
    return null;
  }
  mapParser.read(ditaInput);
  midResult=new StringBuffer(Constants.XML_HEAD).append("String_Node_Str").append(((StringBuffer)mapParser.getContent().getValue())).append("String_Node_Str").toString();
  midStream=new StringReader(midResult);
  try {
    outputDir=new File(out).getParentFile();
    if (!outputDir.exists()) {
      outputDir.mkdirs();
    }
    if (style != null) {
      TransformerFactory factory=TransformerFactory.newInstance();
      Transformer transformer=factory.newTransformer(new StreamSource(new FileInputStream(style)));
      transformer.transform(new StreamSource(midStream),new StreamResult(new FileOutputStream(new File(out))));
    }
 else {
      output=new OutputStreamWriter(new FileOutputStream(out),Constants.UTF8);
      output.write(midResult);
      output.flush();
    }
  }
 catch (  Exception e) {
    logger.logException(e);
  }
 finally {
    try {
      if (output != null) {
        output.close();
      }
      midStream.close();
    }
 catch (    Exception e) {
      logger.logException(e);
    }
  }
  return null;
}