Program: 74671
Project: 74671
Buggy source:
private void drawText(String text,float textX,float textY,FontInfo fontInfo,float characterSpacing,float wordSpacing,Color color,CSSValue align){
  PdfContentByte currentContentByte=isTotalPage ? totalPageTemplate : contentByte;
  float containerHeight=isTotalPage ? totalPageTemplate.getHeight() : pageHeight;
  isTotalPage=false;
  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,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){
  PdfContentByte currentContentByte=isTotalPage ? pageDevice.getPDFTemplate() : contentByte;
  float containerHeight=isTotalPage ? pageDevice.getPDFTemplate().getHeight() : pageHeight;
  isTotalPage=false;
  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,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();
}