Program: 68755
Project: 68755
Buggy source:
private void drawText(String text,float textX,float textY,FontInfo fontInfo,float characterSpacing,float wordSpacing,Color color,CSSValue align){
  PdfContentByte currentContentByte=isTotalPage ? pageDevice.getPDFTemplate() : contentByte;
  float containerHeight=isTotalPage ? pageDevice.getPDFTemplate().getHeight() : pageHeight;
  isTotalPage=false;
  currentContentByte.saveState();
  currentContentByte.beginText();
  if (null != color && !Color.BLACK.equals(color)) {
    currentContentByte.setColorFill(color);
    currentContentByte.setColorStroke(color);
  }
  BaseFont font=fontInfo.getBaseFont();
  float fontSize=fontInfo.getFontSize();
  currentContentByte.setFontAndSize(font,fontSize);
  if (characterSpacing != 0) {
    currentContentByte.setCharacterSpacing(characterSpacing);
  }
  if (wordSpacing != 0) {
    currentContentByte.setWordSpacing(wordSpacing);
  }
  setTextMatrix(currentContentByte,fontInfo,textX,transformY(textY,0,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){
  contentByte.saveState();
  contentByte.beginText();
  if (null != color && !Color.BLACK.equals(color)) {
    contentByte.setColorFill(color);
    contentByte.setColorStroke(color);
  }
  BaseFont font=fontInfo.getBaseFont();
  float fontSize=fontInfo.getFontSize();
  contentByte.setFontAndSize(font,fontSize);
  if (characterSpacing != 0) {
    contentByte.setCharacterSpacing(characterSpacing);
  }
  if (wordSpacing != 0) {
    contentByte.setWordSpacing(wordSpacing);
  }
  setTextMatrix(contentByte,fontInfo,textX,transformY(textY,0,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));
      contentByte.showText(textArray);
    }
 else {
      contentByte.showText(text);
    }
  }
 else {
    contentByte.showText(text);
  }
  contentByte.endText();
  contentByte.restoreState();
}