Program: 16993
Project: 16993
Buggy source:
private void smartIndentAfterNewLine(IDocument d,DocumentCommand c){
  int indexOf=c.text.indexOf('\t');
  if (indexOf != -1) {
    c.text=c.text.substring(0,indexOf);
  }
  indexOf=c.text.indexOf(' ');
  if (indexOf != -1) {
    c.text=c.text.substring(0,indexOf);
  }
  JavaHeuristicScanner scanner=new JavaHeuristicScanner(d);
  VjoIndenter indenter=new VjoIndenter(d,scanner,fProject);
  StringBuffer indent=indenter.computeIndentation(c.offset);
  if (indent == null)   indent=new StringBuffer();
  int docLength=d.getLength();
  if (c.offset == -1 || docLength == 0)   return;
  try {
    int p=(c.offset == docLength ? c.offset - 1 : c.offset);
    int line=d.getLineOfOffset(p);
    StringBuffer buf=new StringBuffer(c.text + indent);
    IRegion reg=d.getLineInformation(line);
    int lineEnd=reg.getOffset() + reg.getLength();
    int contentStart=findEndOfWhiteSpace(d,c.offset,lineEnd);
    c.length=Math.max(contentStart - c.offset,0);
    int start=reg.getOffset();
    ITypedRegion region=TextUtilities.getPartition(d,fPartitioning,start,true);
    if (IJavaScriptPartitions.JS_DOC.equals(region.getType()))     start=d.getLineInformationOfOffset(region.getOffset()).getOffset();
    if (closeBrace() && !isBlockBalanced(d) && (isAfterOpenBrace(d,c.offset) || !isClosedBrace(d,c.offset))) {
      c.caretOffset=c.offset + buf.length();
      c.shiftsCaret=false;
      copyContent(d,c,buf,lineEnd,contentStart);
      appendReference(d,c,indenter,buf,lineEnd,start);
      buf.append('}');
    }
 else     if (c.offset > start && contentStart < lineEnd && d.getChar(contentStart) == '}') {
      int firstCharPos=scanner.findNonWhitespaceBackward(c.offset - 1,start);
      if (firstCharPos != JavaHeuristicScanner.NOT_FOUND && d.getChar(firstCharPos) == '{') {
        c.caretOffset=c.offset + buf.length();
        c.shiftsCaret=false;
        appendReference(d,c,indenter,buf,lineEnd,start);
      }
    }
    c.text=buf.toString();
  }
 catch (  BadLocationException e) {
    DLTKUIPlugin.log(e);
  }
}

Fixed version (ground truth):
private void smartIndentAfterNewLine(IDocument d,DocumentCommand c){
  int indexOf=c.text.indexOf('\t');
  if (indexOf != -1) {
    c.text=c.text.substring(0,indexOf);
  }
  indexOf=c.text.indexOf(' ');
  if (indexOf != -1) {
    c.text=c.text.substring(0,indexOf);
  }
  JavaHeuristicScanner scanner=new JavaHeuristicScanner(d);
  VjoIndenter indenter=new VjoIndenter(d,scanner,fProject);
  StringBuffer indent=indenter.computeIndentation(c.offset);
  if (indent == null)   indent=new StringBuffer();
  int docLength=d.getLength();
  if (c.offset == -1 || docLength == 0)   return;
  try {
    int p=(c.offset == docLength ? c.offset - 1 : c.offset);
    int line=d.getLineOfOffset(p);
    StringBuffer buf=new StringBuffer(c.text + indent);
    IRegion reg=d.getLineInformation(line);
    int lineEnd=reg.getOffset() + reg.getLength();
    int contentStart=findEndOfWhiteSpace(d,c.offset,lineEnd);
    c.length=Math.max(contentStart - c.offset,0);
    int start=reg.getOffset();
    ITypedRegion region=TextUtilities.getPartition(d,fPartitioning,start,true);
    if (IJavaScriptPartitions.JS_DOC.equals(region.getType()))     start=d.getLineInformationOfOffset(region.getOffset()).getOffset();
    if (closeBrace() && !isBlockBalanced(d) && (isAfterOpenBrace(d,c.offset) || !isClosedBrace(d,c.offset))) {
      c.caretOffset=c.offset + buf.length();
      c.shiftsCaret=false;
      buf.append('}');
      copyContent(d,c,buf,lineEnd,contentStart);
      appendReference(d,c,indenter,buf,lineEnd,start);
    }
 else     if (c.offset > start && contentStart < lineEnd && d.getChar(contentStart) == '}') {
      int firstCharPos=scanner.findNonWhitespaceBackward(c.offset - 1,start);
      if (firstCharPos != JavaHeuristicScanner.NOT_FOUND && d.getChar(firstCharPos) == '{') {
        c.caretOffset=c.offset + buf.length();
        c.shiftsCaret=false;
        appendReference(d,c,indenter,buf,lineEnd,start);
      }
    }
    c.text=buf.toString();
  }
 catch (  BadLocationException e) {
    DLTKUIPlugin.log(e);
  }
}