Program: 76134
Project: 76134
Buggy source:
private void drawText(String text,float textX,float textY,FontInfo fontInfo,float characterSpacing,float wordSpacing,Color color,CSSValue align,boolean isTotalPage){
  PdfContentByte currentContentByte=isTotalPage ? totalPageTemplate : contentByte;
  float containerHeight=isTotalPage ? totalPageTemplate.getHeight() : pageHeight;
  currentContentByte.saveState();
  currentContentByte.beginText();
  if (null != color) {
    currentContentByte.setColorFill(color);
    currentContentByte.setColorStroke(color);
  }
  BaseFont font=fontInfo.getBaseFont();
  float fontSize=fontInfo.getFontSize();
  currentContentByte.setFontAndSize(font,fontSize);
  currentContentByte.setCharacterSpacing(characterSpacing);
  currentContentByte.setWordSpacing(wordSpacing);
  placeText(currentContentByte,fontInfo,textX,transformY(textY,fontInfo.getBaseline(),containerHeight));
  if ((font.getFontType() == BaseFont.FONT_TYPE_TTUNI) && IStyle.JUSTIFY_VALUE.equals(align) && wordSpacing > 0) {
    int idx=text.indexOf(' ');
    if (idx >= 0) {
      float spaceCorrection=-wordSpacing * 1000 / fontSize;
      PdfTextArray textArray=new PdfTextArray(text.substring(0,idx));
      int lastIdx=idx;
      while ((idx=text.indexOf(' ',lastIdx + 1)) >= 0) {
        textArray.add(spaceCorrection);
        textArray.add(text.substring(lastIdx,idx));
        lastIdx=idx;
      }
      textArray.add(spaceCorrection);
      textArray.add(text.substring(lastIdx));
      currentContentByte.showText(textArray);
    }
 else {
      currentContentByte.showText(text);
    }
  }
 else {
    currentContentByte.showText(text);
  }
  currentContentByte.endText();
  currentContentByte.restoreState();
}

Fixed version (ground truth):
private void drawText(String text,float textX,float textY,FontInfo fontInfo,float characterSpacing,float wordSpacing,Color color,CSSValue align,boolean isTotalPage){
  PdfContentByte currentContentByte=isTotalPage ? totalPageTemplate : contentByte;
  float containerHeight=isTotalPage ? totalPageTemplate.getHeight() : pageHeight;
  currentContentByte.saveState();
  currentContentByte.beginText();
  if (null != color) {
    currentContentByte.setColorFill(color);
    currentContentByte.setColorStroke(color);
  }
  BaseFont font=fontInfo.getBaseFont();
  float fontSize=fontInfo.getFontSize();
  currentContentByte.setFontAndSize(font,fontSize);
  currentContentByte.setCharacterSpacing(characterSpacing);
  currentContentByte.setWordSpacing(wordSpacing);
  float baseline=convertToPoint(fontInfo.getBaseline());
  float transformedY=transformY(textY,baseline,containerHeight);
  placeText(currentContentByte,fontInfo,textX,transformedY);
  if ((font.getFontType() == BaseFont.FONT_TYPE_TTUNI) && IStyle.JUSTIFY_VALUE.equals(align) && wordSpacing > 0) {
    int idx=text.indexOf(' ');
    if (idx >= 0) {
      float spaceCorrection=-wordSpacing * 1000 / fontSize;
      PdfTextArray textArray=new PdfTextArray(text.substring(0,idx));
      int lastIdx=idx;
      while ((idx=text.indexOf(' ',lastIdx + 1)) >= 0) {
        textArray.add(spaceCorrection);
        textArray.add(text.substring(lastIdx,idx));
        lastIdx=idx;
      }
      textArray.add(spaceCorrection);
      textArray.add(text.substring(lastIdx));
      currentContentByte.showText(textArray);
    }
 else {
      currentContentByte.showText(text);
    }
  }
 else {
    currentContentByte.showText(text);
  }
  currentContentByte.endText();
  currentContentByte.restoreState();
}