Program: 118256
Project: 118256
Buggy source:
/** 
 * DOC nrousseau Comment method "formatCode". from SourceViewer.doOperation for FORMAT.
 * @param processCode
 * @return
 */
@SuppressWarnings({"String_Node_Str"}) private String formatCode(String processCode){
  if (CommonsPlugin.isHeadless()) {
    return processCode;
  }
  final IDocument document=new Document(processCode);
  JavaTextTools tools=JavaPlugin.getDefault().getJavaTextTools();
  tools.setupJavaDocumentPartitioner(document,IJavaPartitions.JAVA_PARTITIONING);
  IFormattingContext context=null;
  DocumentRewriteSession rewriteSession=null;
  if (document instanceof IDocumentExtension4) {
    rewriteSession=((IDocumentExtension4)document).startRewriteSession(DocumentRewriteSessionType.SEQUENTIAL);
  }
  try {
    final String rememberedContents=document.get();
    try {
      final MultiPassContentFormatter formatter=new MultiPassContentFormatter(IJavaPartitions.JAVA_PARTITIONING,IDocument.DEFAULT_CONTENT_TYPE);
      formatter.setMasterStrategy(new JavaFormattingStrategy());
      context=new FormattingContext();
      context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT,Boolean.TRUE);
      Map<String,String> preferences;
      if (this.getTalendJavaProject() == null) {
        preferences=new HashMap<String,String>(JavaCore.getOptions());
      }
 else {
        preferences=new HashMap<String,String>(this.getTalendJavaProject().getJavaProject().getOptions(true));
      }
      context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES,preferences);
      formatter.format(document,context);
    }
 catch (    RuntimeException x) {
      document.set(rememberedContents);
      throw x;
    }
  }
  finally {
    if (rewriteSession != null && document instanceof IDocumentExtension4) {
      ((IDocumentExtension4)document).stopRewriteSession(rewriteSession);
    }
    if (context != null) {
      context.dispose();
    }
  }
  return document.get();
}

Fixed version (ground truth):
/** 
 * DOC nrousseau Comment method "formatCode". from SourceViewer.doOperation for FORMAT.
 * @param processCode
 * @return
 */
@SuppressWarnings({"String_Node_Str"}) private String formatCode(String processCode){
  if (ProcessorUtilities.isExportConfig() || CommonsPlugin.isHeadless()) {
    return processCode;
  }
  final IDocument document=new Document(processCode);
  JavaTextTools tools=JavaPlugin.getDefault().getJavaTextTools();
  tools.setupJavaDocumentPartitioner(document,IJavaPartitions.JAVA_PARTITIONING);
  IFormattingContext context=null;
  DocumentRewriteSession rewriteSession=null;
  if (document instanceof IDocumentExtension4) {
    rewriteSession=((IDocumentExtension4)document).startRewriteSession(DocumentRewriteSessionType.SEQUENTIAL);
  }
  try {
    final String rememberedContents=document.get();
    try {
      final MultiPassContentFormatter formatter=new MultiPassContentFormatter(IJavaPartitions.JAVA_PARTITIONING,IDocument.DEFAULT_CONTENT_TYPE);
      formatter.setMasterStrategy(new JavaFormattingStrategy());
      context=new FormattingContext();
      context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT,Boolean.TRUE);
      Map<String,String> preferences;
      if (this.getTalendJavaProject() == null) {
        preferences=new HashMap<String,String>(JavaCore.getOptions());
      }
 else {
        preferences=new HashMap<String,String>(this.getTalendJavaProject().getJavaProject().getOptions(true));
      }
      context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES,preferences);
      formatter.format(document,context);
    }
 catch (    RuntimeException x) {
      document.set(rememberedContents);
      throw x;
    }
  }
  finally {
    if (rewriteSession != null && document instanceof IDocumentExtension4) {
      ((IDocumentExtension4)document).stopRewriteSession(rewriteSession);
    }
    if (context != null) {
      context.dispose();
    }
  }
  return document.get();
}