Program: 39474
Project: 39474
Buggy source:
/** 
 * Converts HTML obtained from an <code>InputStream</code> to objects that will be added to a <code>PdfDocument</code>, using specific <code>ConverterProperties</code>, returning a <code>Document</code> instance.
 * @param htmlStream the <code>InputStream</code> with the source HTML
 * @param pdfDocument the <code>PdfDocument</code> instance
 * @param converterProperties a <code>ConverterProperties</code> instance
 * @return a <code>Document</code> instance
 * @throws IOException Signals that an I/O exception has occurred.
 */
public static Document convertToDocument(InputStream htmlStream,PdfDocument pdfDocument,ConverterProperties converterProperties) throws IOException {
  String licenseKeyClassName="String_Node_Str";
  String licenseKeyProductClassName="String_Node_Str";
  String licenseKeyFeatureClassName="String_Node_Str";
  String checkLicenseKeyMethodName="String_Node_Str";
  try {
    Class licenseKeyClass=Class.forName(licenseKeyClassName);
    Class licenseKeyProductClass=Class.forName(licenseKeyProductClassName);
    Class licenseKeyProductFeatureClass=Class.forName(licenseKeyFeatureClassName);
    Object licenseKeyProductFeatureArray=Array.newInstance(licenseKeyProductFeatureClass,0);
    Class[] params=new Class[]{String.class,Integer.TYPE,Integer.TYPE,licenseKeyProductFeatureArray.getClass()};
    Constructor licenseKeyProductConstructor=licenseKeyProductClass.getConstructor(params);
    Object licenseKeyProductObject=licenseKeyProductConstructor.newInstance(Html2PdfProductInfo.PRODUCT_NAME,Html2PdfProductInfo.MAJOR_VERSION,Html2PdfProductInfo.MINOR_VERSION,licenseKeyProductFeatureArray);
    Method method=licenseKeyClass.getMethod(checkLicenseKeyMethodName,licenseKeyProductClass);
    method.invoke(null,licenseKeyProductObject);
  }
 catch (  Exception e) {
    if (!Version.isAGPLVersion()) {
      throw new RuntimeException(e.getCause());
    }
  }
  if (pdfDocument.getReader() != null) {
    throw new Html2PdfException(Html2PdfException.PdfDocumentShouldBeInWritingMode);
  }
  IHtmlParser parser=new JsoupHtmlParser();
  String detectedCharset=detectEncoding(htmlStream);
  IDocumentNode doc=parser.parse(htmlStream,detectedCharset);
  return Attacher.attach(doc,pdfDocument,converterProperties);
}

Fixed version (ground truth):
/** 
 * Converts HTML obtained from an   {@link InputStream} to objects thatwill be added to a  {@link PdfDocument}, using specific   {@link ConverterProperties}, returning a   {@link Document} instance.
 * @param htmlStream the {@link InputStream} with the source HTML
 * @param pdfDocument the {@link PdfDocument} instance
 * @param converterProperties a {@link ConverterProperties} instance
 * @return a {@link Document} instance
 * @throws IOException Signals that an I/O exception has occurred.
 */
public static Document convertToDocument(InputStream htmlStream,PdfDocument pdfDocument,ConverterProperties converterProperties) throws IOException {
  String licenseKeyClassName="String_Node_Str";
  String licenseKeyProductClassName="String_Node_Str";
  String licenseKeyFeatureClassName="String_Node_Str";
  String checkLicenseKeyMethodName="String_Node_Str";
  try {
    Class licenseKeyClass=Class.forName(licenseKeyClassName);
    Class licenseKeyProductClass=Class.forName(licenseKeyProductClassName);
    Class licenseKeyProductFeatureClass=Class.forName(licenseKeyFeatureClassName);
    Object licenseKeyProductFeatureArray=Array.newInstance(licenseKeyProductFeatureClass,0);
    Class[] params=new Class[]{String.class,Integer.TYPE,Integer.TYPE,licenseKeyProductFeatureArray.getClass()};
    Constructor licenseKeyProductConstructor=licenseKeyProductClass.getConstructor(params);
    Object licenseKeyProductObject=licenseKeyProductConstructor.newInstance(Html2PdfProductInfo.PRODUCT_NAME,Html2PdfProductInfo.MAJOR_VERSION,Html2PdfProductInfo.MINOR_VERSION,licenseKeyProductFeatureArray);
    Method method=licenseKeyClass.getMethod(checkLicenseKeyMethodName,licenseKeyProductClass);
    method.invoke(null,licenseKeyProductObject);
  }
 catch (  Exception e) {
    if (!Version.isAGPLVersion()) {
      throw new RuntimeException(e.getCause());
    }
  }
  if (pdfDocument.getReader() != null) {
    throw new Html2PdfException(Html2PdfException.PdfDocumentShouldBeInWritingMode);
  }
  IHtmlParser parser=new JsoupHtmlParser();
  String detectedCharset=detectEncoding(htmlStream);
  IDocumentNode doc=parser.parse(htmlStream,detectedCharset);
  return Attacher.attach(doc,pdfDocument,converterProperties);
}