Program: 26394
Project: 26394
Buggy source:
public List computeCompletionProposals(ContentAssistInvocationContext context,IProgressMonitor monitor){
  if (context instanceof JavaContentAssistInvocationContext) {
    JavaContentAssistInvocationContext javaContext=(JavaContentAssistInvocationContext)context;
    IProject project=javaContext.getProject().getProject();
    if (IDETernProject.hasTernNature(project)) {
      IDocument document=javaContext.getDocument();
      IResource resource=javaContext.getCompilationUnit().getResource();
      if (resource.getType() == IResource.FILE) {
        IFile scriptFile=(IFile)resource;
        try {
          final List<ICompletionProposal> proposals=new ArrayList<ICompletionProposal>();
          IDETernProject ternProject=IDETernProject.getTernProject(project);
          ITernServer ternServer=ternProject.getTernServer();
          TernCompletionsQuery query=new TernCompletionsQuery("String_Node_Str",context.getInvocationOffset());
          query.setTypes(true);
          query.setDocs(true);
          query.setUrls(true);
          query.setLineCharPositions(true);
          TernDoc doc=new TernDoc(query);
          if (scriptFile != null && scriptFile.exists()) {
            String name=scriptFile.getName();
            String text=document.get();
            doc.addFile(name,text,null);
            query.setFile("String_Node_Str");
          }
          final int startOffset=context.getInvocationOffset();
          ternServer.request(doc,new ITernCompletionCollector(){
            @Override public void addProposal(            String name,            String type,            String origin,            Object doc,            int pos,            Object completion){
              proposals.add(new TernCompletionProposal(name,type,origin,doc,pos,startOffset));
            }
          }
);
          return proposals;
        }
 catch (        Exception e) {
          Trace.trace(Trace.SEVERE,"String_Node_Str",e);
        }
      }
    }
  }
  return Collections.EMPTY_LIST;
}

Fixed version (ground truth):
public List computeCompletionProposals(ContentAssistInvocationContext context,IProgressMonitor monitor){
  if (context instanceof JavaContentAssistInvocationContext) {
    JavaContentAssistInvocationContext javaContext=(JavaContentAssistInvocationContext)context;
    IProject project=javaContext.getProject().getProject();
    if (IDETernProject.hasTernNature(project)) {
      IDocument document=javaContext.getDocument();
      IResource resource=javaContext.getCompilationUnit().getResource();
      if (resource.getType() == IResource.FILE) {
        IFile scriptFile=(IFile)resource;
        try {
          final List<ICompletionProposal> proposals=new ArrayList<ICompletionProposal>();
          IDETernProject ternProject=IDETernProject.getTernProject(project);
          ITernServer ternServer=ternProject.getTernServer();
          TernCompletionsQuery query=new TernCompletionsQuery("String_Node_Str",context.getInvocationOffset());
          query.setTypes(true);
          query.setDocs(true);
          query.setUrls(true);
          query.setCaseInsensitive(true);
          query.setLineCharPositions(true);
          query.setExpandWordForward(false);
          TernDoc doc=new TernDoc(query);
          if (scriptFile != null && scriptFile.exists()) {
            String name=scriptFile.getName();
            String text=document.get();
            doc.addFile(name,text,null);
            query.setFile("String_Node_Str");
          }
          final int startOffset=context.getInvocationOffset();
          ternServer.request(doc,new ITernCompletionCollector(){
            @Override public void addProposal(            String name,            String type,            String origin,            Object doc,            int pos,            Object completion){
              proposals.add(new TernCompletionProposal(name,type,origin,doc,pos,startOffset));
            }
          }
);
          return proposals;
        }
 catch (        Exception e) {
          Trace.trace(Trace.SEVERE,"String_Node_Str",e);
        }
      }
    }
  }
  return Collections.EMPTY_LIST;
}