nus-yam/ex-repair huggingface dataset:
Program: 39453
Project: 39453
Buggy source:
/** 
 * Creates a new   {@link AbstractSelectFieldRenderer} instance.
 * @param modelElement the model element
 */
public AbstractSelectFieldRenderer(AbstractSelectField modelElement){
  super(modelElement);
  addChild(createFlatRenderer());
}

Fixed version (ground truth):
/** 
 * Creates a new   {@link AbstractSelectFieldRenderer} instance.
 * @param modelElement the model element
 */
public AbstractSelectFieldRenderer(AbstractSelectField modelElement){
  super(modelElement);
  addChild(createFlatRenderer());
  setProperty(Property.SPLIT_CHARACTERS,new NoSplitCharacters());
}
Program: 39454
Project: 39454
Buggy source:
private IRenderer createFlatRenderer(boolean addAllOptionsToChildren){
  AbstractSelectField selectField=(AbstractSelectField)modelElement;
  List<IBlockElement> options=selectField.getOptions();
  Div pseudoContainer=new Div();
  for (  IBlockElement option : options) {
    pseudoContainer.add(option);
  }
  List<Paragraph> allOptions;
  IRenderer pseudoRendererSubTree=pseudoContainer.createRendererSubTree();
  if (addAllOptionsToChildren) {
    allOptions=getAllOptionsFlatElements(pseudoRendererSubTree);
  }
 else {
    allOptions=getSingleSelectedOptionFlatRenderer(pseudoRendererSubTree);
  }
  if (allOptions.isEmpty()) {
    allOptions.add(createComboBoxOptionFlatElement());
  }
  pseudoContainer.getChildren().clear();
  for (  Paragraph option : allOptions) {
    pseudoContainer.add(option);
  }
  IRenderer rendererSubTree=pseudoContainer.createRendererSubTree();
  replaceParagraphRenderers(rendererSubTree);
  return rendererSubTree;
}

Fixed version (ground truth):
private IRenderer createFlatRenderer(boolean addAllOptionsToChildren){
  AbstractSelectField selectField=(AbstractSelectField)modelElement;
  List<IBlockElement> options=selectField.getOptions();
  Div pseudoContainer=new Div();
  for (  IBlockElement option : options) {
    pseudoContainer.add(option);
  }
  List<Paragraph> allOptions;
  IRenderer pseudoRendererSubTree=pseudoContainer.createRendererSubTree();
  if (addAllOptionsToChildren) {
    allOptions=getAllOptionsFlatElements(pseudoRendererSubTree);
  }
 else {
    allOptions=getSingleSelectedOptionFlatRenderer(pseudoRendererSubTree);
  }
  if (allOptions.isEmpty()) {
    allOptions.add(createComboBoxOptionFlatElement());
  }
  pseudoContainer.getChildren().clear();
  for (  Paragraph option : allOptions) {
    pseudoContainer.add(option);
  }
  IRenderer rendererSubTree=pseudoContainer.createRendererSubTree();
  return rendererSubTree;
}
Program: 39455
Project: 39455
Buggy source:
@Override protected IRenderer createFlatRenderer(){
  AbstractSelectField selectField=(AbstractSelectField)modelElement;
  List<IBlockElement> options=selectField.getOptions();
  Div optionsContainer=new Div();
  for (  IBlockElement option : options) {
    optionsContainer.add(option);
  }
  IRenderer rendererSubTree;
  if (optionsContainer.getChildren().isEmpty()) {
    Paragraph pStub=new Paragraph("String_Node_Str").setMargin(0);
    pStub.setProperty(Property.OVERFLOW_X,OverflowPropertyValue.VISIBLE);
    pStub.setProperty(Property.OVERFLOW_Y,OverflowPropertyValue.VISIBLE);
    pStub.setProperty(Html2PdfProperty.FORM_FIELD_SELECTED,false);
    optionsContainer.add(pStub);
    rendererSubTree=optionsContainer.createRendererSubTree();
  }
 else {
    rendererSubTree=optionsContainer.createRendererSubTree();
    replaceParagraphRenderers(rendererSubTree);
    List<IRenderer> selectedOptions=getSelectedOptions(rendererSubTree);
    for (    IRenderer selectedOption : selectedOptions) {
      applySelectedStyle(selectedOption);
    }
  }
  return rendererSubTree;
}

Fixed version (ground truth):
@Override protected IRenderer createFlatRenderer(){
  AbstractSelectField selectField=(AbstractSelectField)modelElement;
  List<IBlockElement> options=selectField.getOptions();
  Div optionsContainer=new Div();
  for (  IBlockElement option : options) {
    optionsContainer.add(option);
  }
  IRenderer rendererSubTree;
  if (optionsContainer.getChildren().isEmpty()) {
    Paragraph pStub=new Paragraph("String_Node_Str").setMargin(0);
    pStub.setProperty(Property.OVERFLOW_X,OverflowPropertyValue.VISIBLE);
    pStub.setProperty(Property.OVERFLOW_Y,OverflowPropertyValue.VISIBLE);
    pStub.setProperty(Html2PdfProperty.FORM_FIELD_SELECTED,false);
    optionsContainer.add(pStub);
    rendererSubTree=optionsContainer.createRendererSubTree();
  }
 else {
    rendererSubTree=optionsContainer.createRendererSubTree();
    List<IRenderer> selectedOptions=getSelectedOptions(rendererSubTree);
    for (    IRenderer selectedOption : selectedOptions) {
      applySelectedStyle(selectedOption);
    }
  }
  return rendererSubTree;
}
Program: 39456
Project: 39456
Buggy source:
@Test public void selectMinMaxWidthCalculationTest01() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}

Fixed version (ground truth):
@Test @LogMessages(messages=@LogMessage(messageTemplate=LogMessageConstant.TABLE_WIDTH_IS_MORE_THAN_EXPECTED_DUE_TO_MIN_WIDTH)) public void selectMinMaxWidthCalculationTest01() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}
Program: 39457
Project: 39457
Buggy source:
@Test public void selectWidthTest04() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}

Fixed version (ground truth):
@Test @LogMessages(messages=@LogMessage(messageTemplate=LogMessageConstant.INLINE_BLOCK_ELEMENT_WILL_BE_CLIPPED,count=1)) public void selectWidthTest04() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}
Program: 39458
Project: 39458
Buggy source:
@Test public void selectBasicTest10() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}

Fixed version (ground truth):
@Test @LogMessages(messages=@LogMessage(messageTemplate=LogMessageConstant.INLINE_BLOCK_ELEMENT_WILL_BE_CLIPPED,count=1)) public void selectBasicTest10() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}
Program: 39460
Project: 39460
Buggy source:
private static String detectCharsetFromBom(ByteBuffer byteData,String charsetName){
  byteData.mark();
  byte[] bom=new byte[4];
  if (byteData.remaining() >= bom.length) {
    byteData.get(bom);
    byteData.rewind();
  }
  if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == (byte)0xFE && bom[3] == (byte)0xFF || bom[0] == (byte)0xFF && bom[1] == (byte)0xFE && bom[2] == 0x00 && bom[3] == 0x00) {
    charsetName="String_Node_Str";
  }
 else   if (bom[0] == (byte)0xFE && bom[1] == (byte)0xFF || bom[0] == (byte)0xFF && bom[1] == (byte)0xFE) {
    charsetName="String_Node_Str";
  }
 else   if (bom[0] == (byte)0xEF && bom[1] == (byte)0xBB && bom[2] == (byte)0xBF) {
    charsetName="String_Node_Str";
    byteData.position(3);
  }
  return charsetName;
}

Fixed version (ground truth):
private static String detectCharsetFromBom(ByteBuffer byteData,String charsetName){
  ((Buffer)byteData).mark();
  byte[] bom=new byte[4];
  if (byteData.remaining() >= bom.length) {
    byteData.get(bom);
    ((Buffer)byteData).rewind();
  }
  if (bom[0] == 0x00 && bom[1] == 0x00 && bom[2] == (byte)0xFE && bom[3] == (byte)0xFF || bom[0] == (byte)0xFF && bom[1] == (byte)0xFE && bom[2] == 0x00 && bom[3] == 0x00) {
    charsetName="String_Node_Str";
  }
 else   if (bom[0] == (byte)0xFE && bom[1] == (byte)0xFF || bom[0] == (byte)0xFF && bom[1] == (byte)0xFE) {
    charsetName="String_Node_Str";
  }
 else   if (bom[0] == (byte)0xEF && bom[1] == (byte)0xBB && bom[2] == (byte)0xBF) {
    charsetName="String_Node_Str";
    ((Buffer)byteData).position(3);
  }
  return charsetName;
}
Program: 39462
Project: 39462
Buggy source:
/** 
 * Merge parent CSS declarations.
 * @param styles the styles map
 * @param cssProperty the CSS property
 * @param parentPropValue the parent properties value
 */
private void mergeParentCssDeclaration(Map<String,String> styles,String cssProperty,String parentPropValue,String parentFontSize){
  String childPropValue=styles.get(cssProperty);
  if ((childPropValue == null && CssInheritance.isInheritable(cssProperty)) || CssConstants.INHERIT.equals(childPropValue)) {
    if (CssUtils.isRelativeValue(parentPropValue) && !CssUtils.isRemValue(parentPropValue)) {
      int pos=CssUtils.determinePositionBetweenValueAndUnit(parentFontSize);
      float fontSize=Float.parseFloat(parentFontSize.substring(0,pos));
      float resolvedRelativeValue=CssUtils.parseRelativeValue(parentPropValue,fontSize);
      styles.put(cssProperty,String.valueOf(resolvedRelativeValue) + parentFontSize.substring(pos,parentFontSize.length()));
    }
 else     styles.put(cssProperty,parentPropValue);
  }
 else   if (CssConstants.TEXT_DECORATION.equals(cssProperty) && !CssConstants.INLINE_BLOCK.equals(styles.get(CssConstants.DISPLAY))) {
    styles.put(cssProperty,CssPropertyMerger.mergeTextDecoration(childPropValue,parentPropValue));
  }
}

Fixed version (ground truth):
/** 
 * Merge parent CSS declarations.
 * @param styles the styles map
 * @param cssProperty the CSS property
 * @param parentPropValue the parent properties value
 */
private void mergeParentCssDeclaration(Map<String,String> styles,String cssProperty,String parentPropValue,Map<String,String> parentStyles){
  String childPropValue=styles.get(cssProperty);
  if ((childPropValue == null && CssInheritance.isInheritable(cssProperty)) || CssConstants.INHERIT.equals(childPropValue)) {
    if (CssUtils.isRelativeValue(parentPropValue) && !CssUtils.isRemValue(parentPropValue)) {
      if (parentPropValue != null && (!parentPropValue.endsWith(CssConstants.PERCENTAGE) || parentPropValue.endsWith(CssConstants.PERCENTAGE) && (CssConstants.FONT_SIZE.equals(cssProperty) || CssConstants.VERTICAL_ALIGN.equals(cssProperty) || CssConstants.LINE_HEIGHT.equals(cssProperty)))) {
        String parentFontSize=parentStyles.get(CssConstants.FONT_SIZE);
        int pos=CssUtils.determinePositionBetweenValueAndUnit(parentFontSize);
        float fontSize=Float.parseFloat(parentFontSize.substring(0,pos));
        float resolvedRelativeValue=CssUtils.parseRelativeValue(parentPropValue,fontSize);
        styles.put(cssProperty,String.valueOf(resolvedRelativeValue) + parentFontSize.substring(pos,parentFontSize.length()));
      }
 else       styles.put(cssProperty,parentPropValue);
    }
 else     styles.put(cssProperty,parentPropValue);
  }
 else   if (CssConstants.TEXT_DECORATION.equals(cssProperty) && !CssConstants.INLINE_BLOCK.equals(styles.get(CssConstants.DISPLAY))) {
    styles.put(cssProperty,CssPropertyMerger.mergeTextDecoration(childPropValue,parentPropValue));
  }
}
Program: 39463
Project: 39463
Buggy source:
@Test @Ignore("String_Node_Str") public void fontFaceWoffTest02() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}

Fixed version (ground truth):
@Test public void fontFaceWoffTest02() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}
Program: 39464
Project: 39464
Buggy source:
@Test public void w3cProblemTest04() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}

Fixed version (ground truth):
@Test @LogMessages(messages={@LogMessage(messageTemplate=com.itextpdf.io.LogMessageConstant.FONT_SUBSET_ISSUE)}) public void w3cProblemTest04() throws IOException, InterruptedException {
  runTest("String_Node_Str");
}
Program: 39465
Project: 39465
Buggy source:
@Override public void processEnd(IElementNode element,ProcessorContext context){
  flushInlineElementsToWaitingCell();
  if (null != waitingCell) {
    processCell(waitingCell,true);
  }
}

Fixed version (ground truth):
@Override public void processEnd(IElementNode element,ProcessorContext context){
  flushWaitingCell();
}
Program: 39466
Project: 39466
Buggy source:
@Override public void processEnd(IElementNode element,ProcessorContext context){
  if (null != waitingCell) {
    processCell(waitingCell,true);
  }
  table=tableWrapper.toTable(null);
}

Fixed version (ground truth):
@Override public void processEnd(IElementNode element,ProcessorContext context){
  flushWaitingCell();
  table=tableWrapper.toTable(null);
}
Program: 39467
Project: 39467
Buggy source:
@Override public void close(){
  if (waitingElement != null) {
    super.addChild(waitingElement);
  }
  super.close();
  if (TRIM_LAST_BLANK_PAGE) {
    PdfDocument pdfDocument=document.getPdfDocument();
    if (pdfDocument.getNumberOfPages() > 1) {
      PdfPage lastPage=pdfDocument.getLastPage();
      if (lastPage.getContentStreamCount() == 1 && lastPage.getContentStream(0).getOutputStream().getCurrentPos() <= 0) {
        pdfDocument.removePage(pdfDocument.getNumberOfPages());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void close(){
  if (waitingElement != null) {
    IRenderer r=this.waitingElement;
    waitingElement=null;
    super.addChild(r);
  }
  super.close();
  if (TRIM_LAST_BLANK_PAGE) {
    PdfDocument pdfDocument=document.getPdfDocument();
    if (pdfDocument.getNumberOfPages() > 1) {
      PdfPage lastPage=pdfDocument.getLastPage();
      if (lastPage.getContentStreamCount() == 1 && lastPage.getContentStream(0).getOutputStream().getCurrentPos() <= 0) {
        pdfDocument.removePage(pdfDocument.getNumberOfPages());
      }
    }
  }
}
Program: 39469
Project: 39469
Buggy source:
@Test @Ignore("String_Node_Str") public void float55Test() throws IOException, InterruptedException {
  runTest("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void float55Test() throws IOException, InterruptedException {
  runTest("String_Node_Str","String_Node_Str");
}
Program: 39471
Project: 39471
Buggy source:
@Test public void float55Test() throws IOException, InterruptedException {
  runTest("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test @Ignore("String_Node_Str") public void float55Test() throws IOException, InterruptedException {
  runTest("String_Node_Str","String_Node_Str");
}
Program: 39472
Project: 39472
Buggy source:
@Test public void test() throws IOException, InterruptedException {
  String input="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  List<IElement> elements=HtmlConverter.convertToElements(input);
  Assert.assertEquals(3,elements.size());
  Assert.assertTrue(elements.get(1) instanceof Paragraph);
  Assert.assertEquals(1,((Paragraph)elements.get(1)).getChildren().size());
  IElement iElement=((Paragraph)elements.get(1)).getChildren().get(0);
  Assert.assertEquals("String_Node_Str",iElement.getProperty(Property.FONT));
}

Fixed version (ground truth):
@Test public void test() throws IOException, InterruptedException {
  String input="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  List<IElement> elements=HtmlConverter.convertToElements(input);
  Assert.assertEquals(3,elements.size());
  Assert.assertTrue(elements.get(1) instanceof Paragraph);
  Assert.assertEquals(1,((Paragraph)elements.get(1)).getChildren().size());
  IElement iElement=((Paragraph)elements.get(1)).getChildren().get(0);
  Assert.assertEquals("String_Node_Str",iElement.<String>getProperty(Property.FONT));
}
Program: 39473
Project: 39473
Buggy source:
/** 
 * Instantiates a new ConverterProperties instance based on another ConverterProperties instance (copy constructor).
 * @param other the other ConverterProperties instance
 */
public ConverterProperties(ConverterProperties other){
  this.mediaDeviceDescription=other.mediaDeviceDescription;
  this.fontProvider=other.fontProvider;
  this.tagWorkerFactory=other.tagWorkerFactory;
  this.cssApplierFactory=other.cssApplierFactory;
  this.baseUri=other.baseUri;
  this.createAcroForm=other.createAcroForm;
  this.outlineHandler=other.outlineHandler;
}

Fixed version (ground truth):
/** 
 * Instantiates a new   {@link ConverterProperties} instance based on another {@link ConverterProperties} instance(copy constructor).
 * @param other the other {@link ConverterProperties} instance
 */
public ConverterProperties(ConverterProperties other){
  this.mediaDeviceDescription=other.mediaDeviceDescription;
  this.fontProvider=other.fontProvider;
  this.tagWorkerFactory=other.tagWorkerFactory;
  this.cssApplierFactory=other.cssApplierFactory;
  this.baseUri=other.baseUri;
  this.createAcroForm=other.createAcroForm;
  this.outlineHandler=other.outlineHandler;
}
Program: 39476
Project: 39476
Buggy source:
/** 
 * Detects encoding of a specific <code>InputStream</code>.
 * @param in the <code>InputStream</code>
 * @return the encoding; currently always returns "UTF-8".
 */
private static String detectEncoding(final InputStream in){
  return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Detects encoding of a specific   {@link InputStream}.
 * @param in the {@link InputStream}
 * @return the encoding; currently always returns "UTF-8".
 */
private static String detectEncoding(final InputStream in){
  return "String_Node_Str";
}
Program: 39477
Project: 39477
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>.
 * @param htmlStream the <code>InputStream</code> with the source HTML
 * @param pdfDocument the <code>PdfDocument</code> instance
 * @param converterProperties a <code>ConverterProperties</code> instance
 * @throws IOException Signals that an I/O exception has occurred.
 */
public static void convertToPdf(InputStream htmlStream,PdfDocument pdfDocument,ConverterProperties converterProperties) throws IOException {
  Document document=convertToDocument(htmlStream,pdfDocument,converterProperties);
  document.close();
}

Fixed version (ground truth):
/** 
 * Converts HTML obtained from an   {@link InputStream} to objects thatwill be added to a  {@link PdfDocument}, using specific   {@link ConverterProperties}.
 * @param htmlStream the {@link InputStream} with the source HTML
 * @param pdfDocument the {@link PdfDocument} instance
 * @param converterProperties a {@link ConverterProperties} instance
 * @throws IOException Signals that an I/O exception has occurred.
 */
public static void convertToPdf(InputStream htmlStream,PdfDocument pdfDocument,ConverterProperties converterProperties) throws IOException {
  Document document=convertToDocument(htmlStream,pdfDocument,converterProperties);
  document.close();
}
Program: 39478
Project: 39478
Buggy source:
/** 
 * Instantiates a <code>PortUtil</code> instance.
 */
private PortUtil(){
}

Fixed version (ground truth):
/** 
 * Instantiates a   {@link PortUtil} instance.
 */
private PortUtil(){
}
Program: 39479
Project: 39479
Buggy source:
/** 
 * Wraps a <code>Reader</code> instance in a <code>BufferedReader</code>.
 * @param inputStreamReader the original reader
 * @return the buffered reader
 */
public static Reader wrapInBufferedReader(Reader inputStreamReader){
  return new BufferedReader(inputStreamReader);
}

Fixed version (ground truth):
/** 
 * Wraps a   {@link Reader} instance in a {@link BufferedReader}.
 * @param inputStreamReader the original reader
 * @return the buffered reader
 */
public static Reader wrapInBufferedReader(Reader inputStreamReader){
  return new BufferedReader(inputStreamReader);
}
Program: 39480
Project: 39480
Buggy source:
/** 
 * Instantiates a new <code>Attacher</code> instance.
 */
private Attacher(){
}

Fixed version (ground truth):
/** 
 * Instantiates a new   {@link Attacher} instance.
 */
private Attacher(){
}
Program: 39481
Project: 39481
Buggy source:
/** 
 * Attaches the HTML content stored in a document node to a list of <code>IElement</code> objects.
 * @param documentNode the document node with the HTML
 * @param converterProperties the <code>ConverterProperties</code> instance
 * @return the list of <code>IElement</code> objects
 */
public static List<com.itextpdf.layout.element.IElement> attach(IDocumentNode documentNode,ConverterProperties converterProperties){
  IHtmlProcessor processor=new DefaultHtmlProcessor(converterProperties);
  return processor.processElements(documentNode);
}

Fixed version (ground truth):
/** 
 * Attaches the HTML content stored in a document node to a list of   {@link IElement} objects.
 * @param documentNode the document node with the HTML
 * @param converterProperties the {@link ConverterProperties} instance
 * @return the list of {@link IElement} objects
 */
public static List<com.itextpdf.layout.element.IElement> attach(IDocumentNode documentNode,ConverterProperties converterProperties){
  IHtmlProcessor processor=new DefaultHtmlProcessor(converterProperties);
  return processor.processElements(documentNode);
}
Program: 39482
Project: 39482
Buggy source:
/** 
 * Parses HTML to add the content to a list of <code>IElement</code> objects.
 * @param root the root node of the HTML that needs to be parsed
 * @return the resulting list
 */
List<IElement> processElements(INode root);

Fixed version (ground truth):
/** 
 * Parses HTML to add the content to a list of   {@link IElement} objects.
 * @param root the root node of the HTML that needs to be parsed
 * @return the resulting list
 */
List<IElement> processElements(INode root);
Program: 39483
Project: 39483
Buggy source:
/** 
 * Parses HTML to add the content to a <code>PdfDocument</code>.
 * @param root the root node of the HTML that needs to be parsed
 * @param pdfDocument the <code>PdfDocument</code> instance
 * @return a <code>Document</code> instance
 */
Document processDocument(INode root,PdfDocument pdfDocument);

Fixed version (ground truth):
/** 
 * Parses HTML to add the content to a   {@link PdfDocument}.
 * @param root the root node of the HTML that needs to be parsed
 * @param pdfDocument the {@link PdfDocument} instance
 * @return a {@link Document} instance
 */
Document processDocument(INode root,PdfDocument pdfDocument);
Program: 39484
Project: 39484
Buggy source:
/** 
 * Gets a processed object if it can be expressed as an <code>IPropertyContainer</code> instance.
 * @return the same object on every call.Might return null either if result is not yet produced or if this particular tag worker doesn't produce result in a form of  {@link IPropertyContainer}.
 */
IPropertyContainer getElementResult();

Fixed version (ground truth):
/** 
 * Gets a processed object if it can be expressed as an   {@link IPropertyContainer} instance.
 * @return the same object on every call.Might return null either if result is not yet produced or if this particular tag worker doesn't produce result in a form of  {@link IPropertyContainer}.
 */
IPropertyContainer getElementResult();
Program: 39485
Project: 39485
Buggy source:
/** 
 * Returns a   {@link ITagWorker} instance constructed based on the passed parameters.
 */
ITagWorker getTagWorker(IElementNode tag,ProcessorContext context);

Fixed version (ground truth):
/** 
 * @param tag IElementNode
 * @param context ProcessorContext
 * @return a {@link ITagWorker} instance constructed based on the passed parameters.
 */
ITagWorker getTagWorker(IElementNode tag,ProcessorContext context);
Program: 39486
Project: 39486
Buggy source:
/** 
 * Instantiates a new <code>ProcessorContext</code> instance.
 * @param converterProperties a <code>ConverterProperties</code> instance
 */
public ProcessorContext(ConverterProperties converterProperties){
  if (converterProperties == null) {
    converterProperties=new ConverterProperties();
  }
  state=new State();
  deviceDescription=converterProperties.getMediaDeviceDescription();
  if (deviceDescription == null) {
    deviceDescription=MediaDeviceDescription.createDefault();
  }
  fontProvider=converterProperties.getFontProvider();
  if (fontProvider == null) {
    fontProvider=new DefaultFontProvider();
  }
  tagWorkerFactory=converterProperties.getTagWorkerFactory();
  if (tagWorkerFactory == null) {
    tagWorkerFactory=new DefaultTagWorkerFactory();
  }
  cssApplierFactory=converterProperties.getCssApplierFactory();
  if (cssApplierFactory == null) {
    cssApplierFactory=new DefaultCssApplierFactory();
  }
  baseUri=converterProperties.getBaseUri();
  if (baseUri == null) {
    baseUri="String_Node_Str";
  }
  outlineHandler=converterProperties.getOutlineHandler();
  if (outlineHandler == null) {
    outlineHandler=new OutlineHandler();
  }
  resourceResolver=new ResourceResolver(baseUri);
  cssContext=new CssContext();
  createAcroForm=converterProperties.isCreateAcroForm();
  formFieldNameResolver=new FormFieldNameResolver();
}

Fixed version (ground truth):
/** 
 * Instantiates a new   {@link ProcessorContext} instance.
 * @param converterProperties a {@link ConverterProperties} instance
 */
public ProcessorContext(ConverterProperties converterProperties){
  if (converterProperties == null) {
    converterProperties=new ConverterProperties();
  }
  state=new State();
  deviceDescription=converterProperties.getMediaDeviceDescription();
  if (deviceDescription == null) {
    deviceDescription=MediaDeviceDescription.createDefault();
  }
  fontProvider=converterProperties.getFontProvider();
  if (fontProvider == null) {
    fontProvider=new DefaultFontProvider();
  }
  tagWorkerFactory=converterProperties.getTagWorkerFactory();
  if (tagWorkerFactory == null) {
    tagWorkerFactory=new DefaultTagWorkerFactory();
  }
  cssApplierFactory=converterProperties.getCssApplierFactory();
  if (cssApplierFactory == null) {
    cssApplierFactory=new DefaultCssApplierFactory();
  }
  baseUri=converterProperties.getBaseUri();
  if (baseUri == null) {
    baseUri="String_Node_Str";
  }
  outlineHandler=converterProperties.getOutlineHandler();
  if (outlineHandler == null) {
    outlineHandler=new OutlineHandler();
  }
  resourceResolver=new ResourceResolver(baseUri);
  cssContext=new CssContext();
  createAcroForm=converterProperties.isCreateAcroForm();
  formFieldNameResolver=new FormFieldNameResolver();
}
Program: 39487
Project: 39487
Buggy source:
/** 
 * Instantiates a new <code>State</code> instance.
 */
public State(){
  stack=new Stack<>();
}

Fixed version (ground truth):
/** 
 * Instantiates a new   {@link State} instance.
 */
public State(){
  stack=new Stack<>();
}
Program: 39488
Project: 39488
Buggy source:
/** 
 * Instantiates a new <code>DefaultTagWorkerMapping</code> instance.
 */
private DefaultTagWorkerMapping(){
}

Fixed version (ground truth):
/** 
 * Instantiates a new   {@link DefaultTagWorkerMapping} instance.
 */
private DefaultTagWorkerMapping(){
}
Program: 39489
Project: 39489
Buggy source:
/** 
 * Instantiates a new <code>FontFaceSrc</code> insance.
 * @param src a source path
 * @param isLocal indicates if the font is local
 * @param format the font format (true type, open type, woff,...)
 */
private FontFaceSrc(String src,boolean isLocal,FontFormat format){
  this.format=format;
  this.src=src;
  this.isLocal=isLocal;
}

Fixed version (ground truth):
/** 
 * Instantiates a new   {@link FontFaceSrc} insance.
 * @param src a source path
 * @param isLocal indicates if the font is local
 * @param format the font format (true type, open type, woff,...)
 */
private FontFaceSrc(String src,boolean isLocal,FontFormat format){
  this.format=format;
  this.src=src;
  this.isLocal=isLocal;
}
Program: 39490
Project: 39490
Buggy source:
/** 
 * Parses a <code>String</code> to a font format.
 * @param formatStr a string
 * @return a font format
 */
static FontFormat parseFormat(String formatStr){
  if (formatStr != null && formatStr.length() > 0) {
switch (unquote(formatStr).toLowerCase()) {
case "String_Node_Str":
      return FontFormat.TrueType;
case "String_Node_Str":
    return FontFormat.OpenType;
case "String_Node_Str":
  return FontFormat.WOFF;
case "String_Node_Str":
return FontFormat.WOFF2;
case "String_Node_Str":
return FontFormat.EOT;
case "String_Node_Str":
return FontFormat.SVG;
}
}
return FontFormat.None;
}

Fixed version (ground truth):
/** 
 * Parses a   {@link String} to a font format.
 * @param formatStr a string
 * @return a font format
 */
static FontFormat parseFormat(String formatStr){
  if (formatStr != null && formatStr.length() > 0) {
switch (unquote(formatStr).toLowerCase()) {
case "String_Node_Str":
      return FontFormat.TrueType;
case "String_Node_Str":
    return FontFormat.OpenType;
case "String_Node_Str":
  return FontFormat.WOFF;
case "String_Node_Str":
return FontFormat.WOFF2;
case "String_Node_Str":
return FontFormat.EOT;
case "String_Node_Str":
return FontFormat.SVG;
}
}
return FontFormat.None;
}
Program: 39491
Project: 39491
Buggy source:
/** 
 * Creates a <code>FontFace</code> object by parsing a <code>String</code> trying to match patterns that reveal the font name, whether that font is local, and which format the font is in.
 * @param src a string containing information about a font
 * @return the font in the form of a <code>FontFace</code> object
 */
static FontFaceSrc create(String src){
  Matcher m=UrlPattern.matcher(src);
  if (!m.matches()) {
    return null;
  }
  return new FontFaceSrc(unquote(m.group(UrlGroup)),"String_Node_Str".equals(m.group(TypeGroup)),parseFormat(m.group(FormatGroup)));
}

Fixed version (ground truth):
/** 
 * Creates a   {@link FontFace} object by parsing a {@link String}trying to match patterns that reveal the font name, whether that font is local, and which format the font is in.
 * @param src a string containing information about a font
 * @return the font in the form of a {@link FontFace} object
 */
static FontFaceSrc create(String src){
  Matcher m=UrlPattern.matcher(src);
  if (!m.matches()) {
    return null;
  }
  return new FontFaceSrc(unquote(m.group(UrlGroup)),"String_Node_Str".equals(m.group(TypeGroup)),parseFormat(m.group(FormatGroup)));
}
Program: 39492
Project: 39492
Buggy source:
/** 
 * Removes single and double quotes at the start and the end of a <code>String</code>.
 * @param quotedString a <code>String</quote> that might be between quotes
 * @return the <code>String</code> without the quotes
 */
static String unquote(String quotedString){
  if (quotedString.charAt(0) == '\'' || quotedString.charAt(0) == '\"') {
    return quotedString.substring(1,quotedString.length() - 1);
  }
  return quotedString;
}

Fixed version (ground truth):
/** 
 * Removes single and double quotes at the start and the end of a   {@link String}.
 * @param quotedString a {@link String} that might be between quotes
 * @return the {@link String} without the quotes
 */
static String unquote(String quotedString){
  if (quotedString.charAt(0) == '\'' || quotedString.charAt(0) == '\"') {
    return quotedString.substring(1,quotedString.length() - 1);
  }
  return quotedString;
}
Program: 39493
Project: 39493
Buggy source:
/** 
 * Instantiates a new <code>HtmlDocumentRenderer</code> instance.
 * @param document an iText <code>Document</code> instance
 * @param immediateFlush the immediate flush indicator
 */
public HtmlDocumentRenderer(Document document,boolean immediateFlush){
  super(document,immediateFlush);
}

Fixed version (ground truth):
/** 
 * Instantiates a new   {@link HtmlDocumentRenderer} instance.
 * @param document an iText {@link Document} instance
 * @param immediateFlush the immediate flush indicator
 */
public HtmlDocumentRenderer(Document document,boolean immediateFlush){
  super(document,immediateFlush);
}
Program: 39495
Project: 39495
Buggy source:
/** 
 * Appends quoted content.
 * @param buffer the current buffer
 * @param source a source
 * @param start where to start in the source
 * @param endQuoteSymbol the end quote symbol
 * @return the new position in the source
 */
private static int appendQuoteContent(StringBuilder buffer,String source,int start,char endQuoteSymbol){
  int end=findNextUnescapedChar(source,endQuoteSymbol,start);
  if (end == -1) {
    end=source.length();
    LoggerFactory.getLogger(CssPropertyNormalizer.class).warn(MessageFormatUtil.format(LogMessageConstant.QUOTE_IS_NOT_CLOSED_IN_CSS_EXPRESSION,source));
  }
  buffer.append(source,start,end);
  return end;
}

Fixed version (ground truth):
/** 
 * Appends quoted content.
 * @param buffer the current buffer
 * @param source a source
 * @param start where to start in the source
 * @param endQuoteSymbol the end quote symbol
 * @return the new position in the source
 */
private static int appendQuoteContent(StringBuilder buffer,String source,int start,char endQuoteSymbol){
  int end=CssUtils.findNextUnescapedChar(source,endQuoteSymbol,start);
  if (end == -1) {
    end=source.length();
    LoggerFactory.getLogger(CssPropertyNormalizer.class).warn(MessageFormatUtil.format(LogMessageConstant.QUOTE_IS_NOT_CLOSED_IN_CSS_EXPRESSION,source));
  }
  buffer.append(source,start,end);
  return end;
}
Program: 39498
Project: 39498
Buggy source:
private boolean resolveNthChild(INode node,List<INode> children){
  if (arguments.matches("String_Node_Str")) {
    int a, b;
    boolean bIsPositive=true;
    if (arguments.matches("String_Node_Str")) {
      a=2;
      b=arguments.matches("String_Node_Str") ? 1 : 0;
    }
 else {
      int indexOfN=arguments.indexOf('n');
      if (indexOfN == -1) {
        a=children.size();
        b=Integer.valueOf(arguments);
      }
 else {
        a=Integer.valueOf(arguments.substring(0,indexOfN).trim());
        String[] bParticle=arguments.substring(indexOfN + 1).trim().split("String_Node_Str");
        bIsPositive=bParticle[0].equals("String_Node_Str") ? true : false;
        b=Integer.valueOf(bParticle[1]);
      }
    }
    if (bIsPositive)     return (children.indexOf(node) + 1) % a == b;
 else     return (children.indexOf(node) + 1) % a == a - b;
  }
 else   return false;
}

Fixed version (ground truth):
private boolean resolveNthChild(INode node,List<INode> children){
  if (!children.contains(node))   return false;
  if (this.nthChildA > 0) {
    int temp=children.indexOf(node) + 1 - this.nthChildB;
    return temp >= 0 ? temp % this.nthChildA == 0 : false;
  }
 else   if (this.nthChildA < 0) {
    int temp=children.indexOf(node) + 1 - this.nthChildA;
    return temp <= 0 ? temp % this.nthChildA == 0 : false;
  }
 else   return (children.indexOf(node) + 1) - this.nthChildB == 0;
}
Program: 39499
Project: 39499
Buggy source:
private List<INode> getAllChildren(INode child){
  INode parentElement=child.parentNode();
  List<INode> childrenUnmodifiable=parentElement.childNodes();
  List<INode> children=new ArrayList<INode>(childrenUnmodifiable.size());
  for (  INode iNode : childrenUnmodifiable) {
    if (iNode instanceof IElementNode)     children.add(iNode);
  }
  return children;
}

Fixed version (ground truth):
private List<INode> getAllChildren(INode child){
  INode parentElement=child.parentNode();
  if (parentElement != null) {
    List<INode> childrenUnmodifiable=parentElement.childNodes();
    List<INode> children=new ArrayList<INode>(childrenUnmodifiable.size());
    for (    INode iNode : childrenUnmodifiable) {
      if (iNode instanceof IElementNode)       children.add(iNode);
    }
    return children;
  }
  return new ArrayList<INode>();
}
Program: 39500
Project: 39500
Buggy source:
public CssPseudoClassSelectorItem(String pseudoClass){
  int indexOfParentheses=pseudoClass.indexOf('(');
  if (indexOfParentheses == -1) {
    this.pseudoClass=pseudoClass;
    this.arguments=null;
  }
 else {
    this.pseudoClass=pseudoClass.substring(0,indexOfParentheses);
    this.arguments=pseudoClass.substring(indexOfParentheses + 1,pseudoClass.length() - 1).toLowerCase();
  }
}

Fixed version (ground truth):
public CssPseudoClassSelectorItem(String pseudoClass){
  int indexOfParentheses=pseudoClass.indexOf('(');
  if (indexOfParentheses == -1) {
    this.pseudoClass=pseudoClass;
    this.arguments="String_Node_Str";
  }
 else {
    this.pseudoClass=pseudoClass.substring(0,indexOfParentheses);
    this.arguments=pseudoClass.substring(indexOfParentheses + 1,pseudoClass.length() - 1).trim();
    int[] nthChildArguments=getNthChildArguments();
    nthChildA=nthChildArguments[0];
    nthChildB=nthChildArguments[1];
  }
}
Program: 39501
Project: 39501
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + pseudoClass + (arguments != null ? new String("String_Node_Str" + arguments + "String_Node_Str") : "String_Node_Str");
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + pseudoClass + (!arguments.isEmpty() ? new String("String_Node_Str" + arguments + "String_Node_Str") : "String_Node_Str");
}
Program: 39502
Project: 39502
Buggy source:
private void setAltText(String altText){
  getAccessibilityProperties().setAlternateDescription(altText);
}

Fixed version (ground truth):
void setAltText(String altText){
  getAccessibilityProperties().setAlternateDescription(altText);
}
Program: 39503
Project: 39503
Buggy source:
public static List<CssDeclaration> parsePropertyDeclarations(String propertiesStr){
  List<CssDeclaration> declarations=new ArrayList<>();
  int pos=getSemicolonPosition(propertiesStr);
  while (pos != -1) {
    String[] propertySplit=splitCssProperty(propertiesStr.substring(0,pos));
    if (propertySplit != null) {
      declarations.add(new CssDeclaration(propertySplit[0],propertySplit[1]));
    }
    propertiesStr=propertiesStr.substring(pos + 1);
    pos=getSemicolonPosition(propertiesStr);
  }
  if (!propertiesStr.replaceAll("String_Node_Str","String_Node_Str").isEmpty()) {
    String[] propertySplit=splitCssProperty(propertiesStr);
    if (propertySplit != null) {
      declarations.add(new CssDeclaration(propertySplit[0],propertySplit[1]));
    }
    return declarations;
  }
  return declarations;
}

Fixed version (ground truth):
public static List<CssDeclaration> parsePropertyDeclarations(String propertiesStr){
  List<CssDeclaration> declarations=new ArrayList<>();
  int pos=getSemicolonPosition(propertiesStr,0);
  while (pos != -1) {
    String[] propertySplit=splitCssProperty(propertiesStr.substring(0,pos));
    if (propertySplit != null) {
      declarations.add(new CssDeclaration(propertySplit[0],propertySplit[1]));
    }
    propertiesStr=propertiesStr.substring(pos + 1);
    pos=getSemicolonPosition(propertiesStr,0);
  }
  if (!propertiesStr.replaceAll("String_Node_Str","String_Node_Str").isEmpty()) {
    String[] propertySplit=splitCssProperty(propertiesStr);
    if (propertySplit != null) {
      declarations.add(new CssDeclaration(propertySplit[0],propertySplit[1]));
    }
    return declarations;
  }
  return declarations;
}
Program: 39504
Project: 39504
Buggy source:
private static int getSemicolonPosition(String propertiesStr){
  int semiColonPos=propertiesStr.indexOf("String_Node_Str");
  int openedBracketPos=propertiesStr.indexOf("String_Node_Str");
  int closedBracketPos=propertiesStr.indexOf("String_Node_Str");
  if (semiColonPos != -1 && semiColonPos > openedBracketPos && semiColonPos < closedBracketPos) {
    int pos=getSemicolonPosition(propertiesStr.substring(semiColonPos + 1)) + 1;
    if (pos > 0) {
      semiColonPos+=getSemicolonPosition(propertiesStr.substring(semiColonPos + 1)) + 1;
    }
 else {
      semiColonPos=-1;
    }
  }
  return semiColonPos;
}

Fixed version (ground truth):
private static int getSemicolonPosition(String propertiesStr,int fromIndex){
  int semiColonPos=propertiesStr.indexOf("String_Node_Str",fromIndex);
  int closedBracketPos=propertiesStr.indexOf("String_Node_Str",semiColonPos + 1);
  int openedBracketPos=propertiesStr.indexOf("String_Node_Str",fromIndex);
  if (semiColonPos != -1 && openedBracketPos < semiColonPos && closedBracketPos > 0) {
    int nextOpenedBracketPos=openedBracketPos;
    do {
      openedBracketPos=nextOpenedBracketPos;
      nextOpenedBracketPos=propertiesStr.indexOf("String_Node_Str",openedBracketPos + 1);
    }
 while (nextOpenedBracketPos < closedBracketPos && nextOpenedBracketPos > 0);
  }
  if (semiColonPos != -1 && semiColonPos > openedBracketPos && semiColonPos < closedBracketPos) {
    return getSemicolonPosition(propertiesStr,closedBracketPos + 1);
  }
  return semiColonPos;
}
Program: 39505
Project: 39505
Buggy source:
private void addCellToTable(Cell cell,List<List<CellWrapper>> table,RowColHelper tableRowShift){
  int col=tableRowShift.moveToNextEmptyCol();
  tableRowShift.updateCurrentPosition(cell.getColspan(),cell.getRowspan());
  List<CellWrapper> currentRow=table.get(table.size() - 1);
  currentRow.add(new CellWrapper(col,cell));
  numberOfColumns=Math.max(numberOfColumns,currentRow.size());
}

Fixed version (ground truth):
private void addCellToTable(Cell cell,List<List<CellWrapper>> table,RowColHelper tableRowShift){
  int col=tableRowShift.moveToNextEmptyCol();
  tableRowShift.updateCurrentPosition(cell.getColspan(),cell.getRowspan());
  List<CellWrapper> currentRow=table.get(table.size() - 1);
  currentRow.add(new CellWrapper(col,cell));
  numberOfColumns=Math.max(numberOfColumns,col + cell.getColspan());
}
Program: 39506
Project: 39506
Buggy source:
private UnitValue[] getColWidths(WaitingColgroupsHelper colgroups){
  UnitValue[] colWidths=new UnitValue[numberOfColumns];
  if (colgroups == null) {
    for (int i=0; i < numberOfColumns; i++) {
      colWidths[i]=UnitValue.createPointValue(-1);
    }
  }
 else {
    for (int i=0; i < numberOfColumns; i++) {
      colWidths[i]=colgroups.getColWraper(i) != null ? colgroups.getColWraper(i).getWidth() : UnitValue.createPointValue(-1);
    }
  }
  return colWidths;
}

Fixed version (ground truth):
private UnitValue[] getColWidths(WaitingColgroupsHelper colgroups){
  UnitValue[] colWidths=new UnitValue[numberOfColumns];
  if (colgroups == null) {
    for (int i=0; i < numberOfColumns; i++) {
      colWidths[i]=null;
    }
  }
 else {
    for (int i=0; i < numberOfColumns; i++) {
      colWidths[i]=colgroups.getColWraper(i) != null ? colgroups.getColWraper(i).getWidth() : null;
    }
  }
  return colWidths;
}
Program: 39507
Project: 39507
Buggy source:
public CellWrapper(int col,Cell cell){
  this.col=col;
  this.cell=cell;
}

Fixed version (ground truth):
CellWrapper(int col,Cell cell){
  this.col=col;
  this.cell=cell;
}
Program: 39510
Project: 39510
Buggy source:
@Test public void validateMetricValue(){
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void validateMetricValue(){
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(true,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
  assertEquals(false,CssUtils.isMetricValue("String_Node_Str"));
}
Program: 39511
Project: 39511
Buggy source:
public void updateCurrentPosition(int colspan,int rowspan){
  ensureRowIsStarted();
  while (lastEmptyRow.size() < currCol) {
    lastEmptyRow.add((Integer)currRow);
  }
  Integer value=(Integer)currRow + rowspan;
  if (lastEmptyRow.size() == currCol) {
    lastEmptyRow.add(value);
  }
 else {
    lastEmptyRow.set(currCol,Math.max(value,lastEmptyRow.get(currCol)));
  }
  int size=lastEmptyRow.size();
  int end=currCol + colspan;
  while (lastEmptyRow.size() < end) {
    lastEmptyRow.add(value);
  }
  for (int i=currCol; i < size; ++i) {
    lastEmptyRow.set(i,Math.max(value,lastEmptyRow.get(i)));
  }
  currCol=end;
}

Fixed version (ground truth):
public void updateCurrentPosition(int colspan,int rowspan){
  ensureRowIsStarted();
  while (lastEmptyRow.size() < currCol) {
    lastEmptyRow.add(currRow);
  }
  int value=currRow + rowspan;
  int end=currCol + colspan;
  int middle=Math.min(lastEmptyRow.size(),end);
  for (int i=currCol; i < middle; ++i) {
    lastEmptyRow.set(i,Math.max(value,lastEmptyRow.get(i)));
  }
  while (lastEmptyRow.size() < end) {
    lastEmptyRow.add(value);
  }
  currCol=end;
}
Program: 39512
Project: 39512
Buggy source:
private void applyColStyles(INode node,RowColHelper rowColHelper){
  int col;
  IElementNode element;
  for (  INode child : node.childNodes()) {
    if (child instanceof IElementNode) {
      element=(IElementNode)child;
      if (element.name().equals(TagConstants.TR)) {
        applyColStyles(element,rowColHelper);
        rowColHelper.newRow();
      }
 else       if (element.name().equals(TagConstants.TH) || element.name().equals(TagConstants.TD)) {
        Integer colspan=CssUtils.parseInteger(element.getAttribute(AttributeConstants.COLSPAN));
        Integer rowspan=CssUtils.parseInteger(element.getAttribute(AttributeConstants.ROWSPAN));
        colspan=colspan != null ? colspan : 1;
        rowspan=rowspan != null ? rowspan : 1;
        col=rowColHelper.moveToNextEmptyCol();
        if (getColWraper(col) != null && getColWraper(col).getCellCssProps() != null) {
          element.addAdditionalStyles(getColWraper(col).getCellCssProps());
        }
        rowColHelper.updateCurrentPosition(colspan,rowspan);
      }
 else {
        applyColStyles(child,rowColHelper);
      }
    }
  }
}

Fixed version (ground truth):
private void applyColStyles(INode node,RowColHelper rowColHelper){
  int col;
  IElementNode element;
  for (  INode child : node.childNodes()) {
    if (child instanceof IElementNode) {
      element=(IElementNode)child;
      if (element.name().equals(TagConstants.TR)) {
        applyColStyles(element,rowColHelper);
        rowColHelper.newRow();
      }
 else       if (element.name().equals(TagConstants.TH) || element.name().equals(TagConstants.TD)) {
        Integer colspan=CssUtils.parseInteger(element.getAttribute(AttributeConstants.COLSPAN));
        Integer rowspan=CssUtils.parseInteger(element.getAttribute(AttributeConstants.ROWSPAN));
        colspan=colspan != null ? colspan : 1;
        rowspan=rowspan != null ? rowspan : 1;
        col=rowColHelper.moveToNextEmptyCol();
        if (getColWraper(col) != null && getColWraper(col).getCellCssProps() != null) {
          element.addAdditionalStyles(getColWraper(col).getCellCssProps());
        }
        rowColHelper.updateCurrentPosition((int)colspan,(int)rowspan);
      }
 else {
        applyColStyles(child,rowColHelper);
      }
    }
  }
}
Program: 39513
Project: 39513
Buggy source:
private void finalizeColgroups(){
  int shift=0;
  shiftCol=new int[colgroups.size()];
  for (int i=0; i < colgroups.size(); ++i) {
    shiftCol[i]=shift;
    shift+=colgroups.get(i).getSpan();
  }
  maxIndex=shift - 1;
  indexToColgroupMapping=new int[shift];
  for (int i=0; i < colgroups.size(); ++i) {
    for (int j=0; j < colgroups.get(i).getSpan(); ++j) {
      indexToColgroupMapping[j + shiftCol[i]]=i;
    }
  }
}

Fixed version (ground truth):
private void finalizeColgroups(){
  int shift=0;
  shiftCol=new int[colgroups.size()];
  for (int i=0; i < colgroups.size(); ++i) {
    shiftCol[i]=shift;
    shift+=colgroups.get(i).getSpan();
  }
  maxIndex=shift - 1;
  indexToColgroupMapping=new int[shift];
  for (int i=0; i < colgroups.size(); ++i) {
    for (int j=0; j < colgroups.get(i).getSpan(); ++j) {
      indexToColgroupMapping[j + shiftCol[i]]=i;
    }
  }
  colgroups.trimToSize();
}