nus-yam/ex-repair huggingface dataset:
Program: 26336
Project: 26336
Buggy source:
@Override public long previousClearLong(long fromLongIndex){
  if (fromLongIndex >= longLength)   return NOT_FOUND;
  long l=~bytes.readVolatileLong(fromLongIndex << 3);
  if (l != 0)   return fromLongIndex;
  for (long i=fromLongIndex - 1; i >= 0; i--) {
    l=~bytes.readLong(i << 3);
    if (l != 0)     return i;
  }
  return NOT_FOUND;
}

Fixed version (ground truth):
@Override public long previousClearLong(long fromLongIndex){
  if (fromLongIndex < 0) {
    if (fromLongIndex == NOT_FOUND)     return NOT_FOUND;
    throw new IndexOutOfBoundsException();
  }
  if (fromLongIndex >= longLength)   fromLongIndex=longLength - 1;
  if (bytes.readVolatileLong(fromLongIndex << 3) != ~0)   return fromLongIndex;
  for (long i=fromLongIndex - 1; i >= 0; i--) {
    if (bytes.readLong(i << 3) != ~0)     return i;
  }
  return NOT_FOUND;
}
Program: 26337
Project: 26337
Buggy source:
@Override public DirectBitSet and(long index,long value){
  while (true) {
    long l=bytes.readVolatileLong(index << 3);
    long l2=l & value;
    if (l == l2 || bytes.compareAndSwapLong(index << 3,l,l2))     return this;
  }
}

Fixed version (ground truth):
@Override public DirectBitSet and(long longIndex,long value){
  while (true) {
    long l=bytes.readVolatileLong(longIndex << 3);
    long l2=l & value;
    if (l == l2 || bytes.compareAndSwapLong(longIndex << 3,l,l2))     return this;
  }
}
Program: 26338
Project: 26338
Buggy source:
@Override public boolean get(long bitIndex){
  long index64=bitIndex >> 6;
  int bit=(int)(bitIndex & 0x3F);
  if (bitIndex < 0 || index64 >= bytes.capacity())   throw new IllegalArgumentException();
  long l=bytes.readVolatileLong(index64 << 3);
  return (l >> bit) != 0;
}

Fixed version (ground truth):
@Override public boolean get(long bitIndex){
  long longIndex=bitIndex >> 6;
  if (bitIndex < 0 || longIndex >= longLength)   throw new IndexOutOfBoundsException();
  long l=bytes.readVolatileLong(longIndex << 3);
  return (l >> bitIndex) != 0;
}
Program: 26339
Project: 26339
Buggy source:
@Override public long nextClearLong(long fromLongIndex){
  if (fromLongIndex >= longLength)   return NOT_FOUND;
  long l=bytes.readVolatileLong(fromLongIndex << 3);
  if (l != ~0)   return fromLongIndex;
  for (long i=fromLongIndex + 1; i < longLength; i++) {
    l=bytes.readLong(i << 3);
    if (l != ~0)     return i;
  }
  return NOT_FOUND;
}

Fixed version (ground truth):
@Override public long nextClearLong(long fromLongIndex){
  if (fromLongIndex < 0)   throw new IndexOutOfBoundsException();
  if (fromLongIndex >= longLength)   return NOT_FOUND;
  if (bytes.readVolatileLong(fromLongIndex << 3) != ~0)   return fromLongIndex;
  for (long i=fromLongIndex + 1; i < longLength; i++) {
    if (bytes.readLong(i << 3) != ~0)     return i;
  }
  return NOT_FOUND;
}
Program: 26340
Project: 26340
Buggy source:
@Override public DirectBitSet xor(long index,long value){
  while (true) {
    long l=bytes.readVolatileLong(index << 3);
    long l2=l ^ value;
    if (bytes.compareAndSwapLong(index << 3,l,l2))     return this;
  }
}

Fixed version (ground truth):
@Override public DirectBitSet xor(long longIndex,long value){
  while (true) {
    long l=bytes.readVolatileLong(longIndex << 3);
    long l2=l ^ value;
    if (bytes.compareAndSwapLong(longIndex << 3,l,l2))     return this;
  }
}
Program: 26341
Project: 26341
Buggy source:
@Override public DirectBitSet andNot(long index,long value){
  throw new UnsupportedOperationException();
}

Fixed version (ground truth):
@Override public DirectBitSet andNot(long longIndex,long value){
  throw new UnsupportedOperationException();
}
Program: 26342
Project: 26342
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public <E>void writeEnum(@Nullable E e){
  Class aClass;
  if (e == null)   aClass=String.class;
 else   aClass=(Class)e.getClass();
  BytesMarshaller<E> em=bytesMarshallerFactory().acquireMarshaller(aClass,true);
  em.write(this,e);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public <E>void writeEnum(@Nullable E e){
  Class aClass;
  if (e == null || e instanceof CharSequence)   aClass=String.class;
 else   aClass=(Class)e.getClass();
  BytesMarshaller<E> em=bytesMarshallerFactory().acquireMarshaller(aClass,true);
  em.write(this,e);
}
Program: 26343
Project: 26343
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void writeObject(@Nullable Object obj){
  if (obj == null) {
    writeByte(NULL);
    return;
  }
  Class<?> clazz=obj.getClass();
  boolean create=obj instanceof Comparable || obj instanceof Externalizable;
  BytesMarshaller em=bytesMarshallerFactory.acquireMarshaller(clazz,create);
  if (em != null) {
    writeByte(ENUMED);
    writeEnum(clazz);
    em.write(this,obj);
    return;
  }
  writeByte(SERIALIZED);
  try {
    ObjectOutputStream oos=new ObjectOutputStream(this.outputStream());
    oos.writeObject(obj);
  }
 catch (  IOException e) {
    throw new IllegalStateException(e);
  }
  checkEndOfBuffer();
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void writeObject(@Nullable Object obj){
  if (obj == null) {
    writeByte(NULL);
    return;
  }
  Class<?> clazz=obj.getClass();
  BytesMarshaller em=bytesMarshallerFactory.acquireMarshaller(clazz,false);
  if (em == null && autoGenerateMarshaller(obj))   em=bytesMarshallerFactory.acquireMarshaller(clazz,true);
  if (em != null) {
    writeByte(ENUMED);
    writeEnum(clazz);
    em.write(this,obj);
    return;
  }
  writeByte(SERIALIZED);
  try {
    ObjectOutputStream oos=new ObjectOutputStream(this.outputStream());
    oos.writeObject(obj);
  }
 catch (  IOException e) {
    throw new IllegalStateException(e);
  }
  checkEndOfBuffer();
}
Program: 26345
Project: 26345
Buggy source:
private void testAppendDouble0(double d,int precision){
  bytes.position(0);
  bytes.append(d,precision).append(' ');
  Thread.yield();
  bytes.position(0);
  String text=bytes.parseUTF(SPACE_STOP);
  bytes.position(0);
  assertEquals(0,bytes.position());
  double d2=bytes.parseDouble();
  double d3=(double)Math.round(d * Maths.power10(precision)) / Maths.power10(precision);
  assertEquals("String_Node_Str" + text + "String_Node_Str"+ precision,d3,d2,0);
}

Fixed version (ground truth):
private void testAppendDouble0(double d,int precision){
  bytes.position(0);
  bytes.append(d,precision).append(' ');
  bytes.position(0);
  String text=bytes.parseUTF(SPACE_STOP);
  bytes.position(0);
  assertEquals(0,bytes.position());
  double d2=bytes.parseDouble();
  double d3=(double)Math.round(d * Maths.power10(precision)) / Maths.power10(precision);
  assertEquals("String_Node_Str" + text + "String_Node_Str"+ precision,d3,d2,0);
}
Program: 26346
Project: 26346
Buggy source:
private void testAppendDouble0(double d,int precision){
  bytes.position(0);
  bytes.append(d,precision).append(' ');
  Thread.yield();
  bytes.position(0);
  String text=bytes.parseUTF(SPACE_STOP);
  bytes.position(0);
  assertEquals(0,bytes.position());
  double d2=bytes.parseDouble();
  double d3=(double)Math.round(d * Maths.power10(precision)) / Maths.power10(precision);
  assertEquals("String_Node_Str" + text + "String_Node_Str"+ precision,d3,d2,0);
}

Fixed version (ground truth):
private void testAppendDouble0(double d,int precision){
  bytes.position(0);
  bytes.append(d,precision).append(' ');
  bytes.position(0);
  String text=bytes.parseUTF(SPACE_STOP);
  bytes.position(0);
  assertEquals(0,bytes.position());
  double d2=bytes.parseDouble();
  double d3=(double)Math.round(d * Maths.power10(precision)) / Maths.power10(precision);
  assertEquals("String_Node_Str" + text + "String_Node_Str"+ precision,d3,d2,0);
}
Program: 26347
Project: 26347
Buggy source:
private void testAppendDouble0(double d,int precision){
  bytes.position(0);
  bytes.append(d,precision).append(' ');
  Thread.yield();
  bytes.position(0);
  String text=bytes.parseUTF(SPACE_STOP);
  bytes.position(0);
  assertEquals(0,bytes.position());
  double d2=bytes.parseDouble();
  double d3=(double)Math.round(d * Maths.power10(precision)) / Maths.power10(precision);
  assertEquals("String_Node_Str" + text + "String_Node_Str"+ precision,d3,d2,0);
}

Fixed version (ground truth):
private void testAppendDouble0(double d,int precision){
  bytes.position(0);
  bytes.append(d,precision).append(' ');
  bytes.position(0);
  String text=bytes.parseUTF(SPACE_STOP);
  bytes.position(0);
  assertEquals(0,bytes.position());
  double d2=bytes.parseDouble();
  double d3=(double)Math.round(d * Maths.power10(precision)) / Maths.power10(precision);
  assertEquals("String_Node_Str" + text + "String_Node_Str"+ precision,d3,d2,0);
}
Program: 26349
Project: 26349
Buggy source:
@Override public ITernServer create(IIDETernProject project) throws Exception {
  J2V8TernServer server=new J2V8TernServer(project);
  return server;
}

Fixed version (ground truth):
@Override public ITernServer create(ITernProject project) throws Exception {
  J2V8TernServer server=new J2V8TernServer(project);
  return server;
}
Program: 26350
Project: 26350
Buggy source:
@Override protected void start(ILaunchConfigurationWorkingCopy workingCopy) throws Exception {
  workingCopy.setAttribute(IExternalToolConstants.ATTR_LOCATION,getNodeInstallPath());
  workingCopy.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY,getWorkingDir());
  String args=getArgs();
  workingCopy.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS,args);
  notifyCreateProcess(Collections.<String>emptyList(),projectDir);
  final ILaunchManager manager=DebugPlugin.getDefault().getLaunchManager();
  manager.addLaunchListener(new ILaunchesListener2(){
    @Override public void launchesRemoved(    ILaunch[] launches){
    }
    @Override public void launchesChanged(    ILaunch[] launches){
    }
    @Override public void launchesAdded(    ILaunch[] launches){
    }
    @Override public void launchesTerminated(    ILaunch[] launches){
      for (      ILaunch lc : launches) {
        if (lc.equals(launch)) {
          manager.removeLaunchListener(this);
          notifyStopProcess();
        }
      }
    }
  }
);
  launch=workingCopy.launch(super.getMode(),null);
  for (  IProcess process : launch.getProcesses()) {
    if (process instanceof RuntimeProcess) {
      new StdOut(process.getStreamsProxy().getOutputStreamMonitor());
      new StdErr(process.getStreamsProxy().getErrorStreamMonitor());
    }
  }
}

Fixed version (ground truth):
@Override protected void start(ILaunchConfigurationWorkingCopy workingCopy) throws Exception {
  workingCopy.setAttribute(IExternalToolConstants.ATTR_LOCATION,getNodeInstallPath());
  workingCopy.setAttribute(IExternalToolConstants.ATTR_WORKING_DIRECTORY,getWorkingDir());
  String args=getArgs();
  workingCopy.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS,args);
  notifyCreateProcess(Collections.<String>emptyList(),projectDir);
  final ILaunchManager manager=DebugPlugin.getDefault().getLaunchManager();
  manager.addLaunchListener(new ILaunchesListener2(){
    @Override public void launchesRemoved(    ILaunch[] launches){
    }
    @Override public void launchesChanged(    ILaunch[] launches){
    }
    @Override public void launchesAdded(    ILaunch[] launches){
    }
    @Override public void launchesTerminated(    ILaunch[] launches){
      for (      ILaunch lc : launches) {
        if (lc.equals(launch)) {
          manager.removeLaunchListener(this);
          notifyStopProcess();
        }
      }
    }
  }
);
  launch=workingCopy.launch("String_Node_Str",null);
  for (  IProcess process : launch.getProcesses()) {
    if (process instanceof RuntimeProcess) {
      new StdOut(process.getStreamsProxy().getOutputStreamMonitor());
      new StdErr(process.getStreamsProxy().getErrorStreamMonitor());
    }
  }
}
Program: 26351
Project: 26351
Buggy source:
public static IFile getFileForLocation(String path){
  if (path == null) {
    return null;
  }
  IPath filePath=new Path(path);
  IFile file=null;
  IFile[] files=ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(filePath);
  if (files.length > 0) {
    return files[0];
  }
  return null;
}

Fixed version (ground truth):
public static IFile getFileForLocation(String path){
  if (path == null) {
    return null;
  }
  IPath filePath=new Path(path);
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  IFile file=root.getFile(filePath);
  if (file.exists()) {
    return file;
  }
  IFile[] files=ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(filePath);
  if (files.length > 0) {
    return files[0];
  }
  return null;
}
Program: 26352
Project: 26352
Buggy source:
private IJSNode findSimilarChild(IJSNode newParentNode,IJSNode originChildNode){
  IJSNode matchingNode=null;
  if (originChildNode.getName() != null) {
    for (    IJSNode child : newParentNode.getChildren()) {
      if (child.getName() != null && child.getName().equals(originChildNode.getName())) {
        matchingNode=child;
      }
    }
  }
  if (matchingNode == null) {
    int index=originChildNode.getParent().getChildren().indexOf(originChildNode);
    if (newParentNode.getChildren().size() > index) {
      matchingNode=newParentNode.getChildren().get(index);
    }
  }
  return matchingNode;
}

Fixed version (ground truth):
private IJSNode findSimilarChild(IJSNode newParentNode,IJSNode originChildNode){
  IJSNode matchingNode=null;
  if (originChildNode.getName() != null) {
    for (    IJSNode child : newParentNode.getChildren()) {
      if (child.getName() != null && child.getName().equals(originChildNode.getName())) {
        matchingNode=child;
      }
    }
  }
  if (matchingNode == null) {
    int index=originChildNode.getParent().getChildren().indexOf(originChildNode);
    if (index >= 0 && newParentNode.getChildren().size() > index) {
      matchingNode=newParentNode.getChildren().get(index);
    }
  }
  return matchingNode;
}
Program: 26353
Project: 26353
Buggy source:
private IJSNode findSimilarChild(IJSNode newParentNode,IJSNode originChildNode){
  IJSNode matchingNode=null;
  if (originChildNode.getName() != null) {
    for (    IJSNode child : newParentNode.getChildren()) {
      if (child.getName() != null && child.getName().equals(originChildNode.getName())) {
        matchingNode=child;
      }
    }
  }
  if (matchingNode == null) {
    matchingNode=newParentNode.getChildren().get(originChildNode.getParent().getChildren().indexOf(originChildNode));
  }
  return matchingNode;
}

Fixed version (ground truth):
private IJSNode findSimilarChild(IJSNode newParentNode,IJSNode originChildNode){
  IJSNode matchingNode=null;
  if (originChildNode.getName() != null) {
    for (    IJSNode child : newParentNode.getChildren()) {
      if (child.getName() != null && child.getName().equals(originChildNode.getName())) {
        matchingNode=child;
      }
    }
  }
  if (matchingNode == null) {
    int index=originChildNode.getParent().getChildren().indexOf(originChildNode);
    if (newParentNode.getChildren().size() > index) {
      matchingNode=newParentNode.getChildren().get(index);
    }
  }
  return matchingNode;
}
Program: 26354
Project: 26354
Buggy source:
private void setCurrentPart(IWorkbenchPart part){
  if (this.textEditor != null) {
    uninstall(this.textEditor.getSelectionProvider());
  }
  if (part instanceof ITextEditor) {
    this.textEditor=(ITextEditor)part;
    ISelectionProvider provider=this.textEditor.getSelectionProvider();
    selectInTreeview(provider.getSelection());
    install(provider);
  }
 else {
    this.textEditor=null;
  }
}

Fixed version (ground truth):
private void setCurrentPart(IWorkbenchPart part){
  if (part instanceof ITextEditor) {
    this.textEditor=(ITextEditor)part;
  }
 else {
    this.textEditor=null;
  }
  updateSelectionJob.setCurrentPart(part);
}
Program: 26355
Project: 26355
Buggy source:
public void openInEditor(IJSNode node,boolean force){
  AbstractTernContentOutlinePage page=getCurrentTernPage();
  if (page == null) {
    return;
  }
  if (!force && (!isLinkingEnabled() || ignoreSelectionChanged)) {
    return;
  }
  this.currentNodeToOpen=node;
  activateEditorJob.schedule(LINK_HELPER_DELAY);
}

Fixed version (ground truth):
public void openInEditor(IJSNode node,boolean force){
  activateEditorJob.openInEditor(node,force);
}
Program: 26356
Project: 26356
Buggy source:
public CommonViewer getCurrentViewer(){
  AbstractTernContentOutlinePage page=getCurrentTernPage();
  return page != null ? page.getViewer() : null;
}

Fixed version (ground truth):
/** 
 * Returns the viewer of the current tern outline page and null otherwise.
 * @return the viewer of the current tern outline page and null otherwise.
 */
CommonViewer getCurrentViewer(){
  AbstractTernContentOutlinePage page=getCurrentTernPage();
  return page != null ? page.getViewer() : null;
}
Program: 26357
Project: 26357
Buggy source:
/** 
 * Refresh the outline tree in a job.
 */
public void refreshOutline(){
  if (refreshJob.getState() != Job.NONE) {
    refreshJob.cancel();
  }
  refreshJob.schedule(UPDATE_DELAY);
}

Fixed version (ground truth):
/** 
 * Refresh the outline tree in a job.
 */
public void refreshOutline(){
  refreshJob.refreshOutline();
}
Program: 26358
Project: 26358
Buggy source:
public AbstractTernContentOutlinePage getCurrentTernPage(){
  IPage p=getCurrentPage();
  if (p == null || !(p instanceof AbstractTernContentOutlinePage)) {
    return null;
  }
  AbstractTernContentOutlinePage page=(AbstractTernContentOutlinePage)p;
  return page;
}

Fixed version (ground truth):
/** 
 * Returns the current tern outline page and null otherwise.
 * @return the current tern outline page and null otherwise.
 */
AbstractTernContentOutlinePage getCurrentTernPage(){
  IPage p=getCurrentPage();
  if (p == null || !(p instanceof AbstractTernContentOutlinePage)) {
    return null;
  }
  AbstractTernContentOutlinePage page=(AbstractTernContentOutlinePage)p;
  return page;
}
Program: 26359
Project: 26359
Buggy source:
@Override public void dispose(){
  super.dispose();
  if (this.textEditor != null) {
    uninstall(this.textEditor.getSelectionProvider());
  }
  activateEditorJob.cancel();
  updateSelectionJob.cancel();
  refreshJob.cancel();
}

Fixed version (ground truth):
@Override public void dispose(){
  super.dispose();
  activateEditorJob.cancel();
  updateSelectionJob.dispose();
  refreshJob.cancel();
}
Program: 26360
Project: 26360
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public Iterable<Object> getList(Object jsonObj,String name){
  return (Iterable<Object>)((NativeObject)jsonObj).get("String_Node_Str",(NativeObject)jsonObj);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Iterable<Object> getList(Object jsonObj,String name){
  Object result=((NativeObject)jsonObj).get(name,(NativeObject)jsonObj);
  return (result instanceof Iterable<?>) ? (Iterable<Object>)result : null;
}
Program: 26361
Project: 26361
Buggy source:
@Override public ITernServer create(ITernProject project) throws Exception {
  NodejsTernServer server;
  if (isRemoteAccess()) {
    server=new NodejsTernServer(project,getRemotePort());
  }
 else {
    INodejsDebugger debugger=NodejsDebuggersManager.getDebugger(getDebugger());
    File installPath=getInstallPath();
    IFile ternServerFile=getTernServerDebugFile();
    if (debugger != null && debugger.isInstalled() && ternServerFile != null && ternServerFile.exists() && !ternServerFile.getProject().equals(project.getAdapter(IProject.class))) {
      server=new NodejsTernServer(project,debugger.createProcess(project.getProjectDir(),installPath,ternServerFile));
    }
 else {
      File ternFile=project.getRepository().getTernBaseDir();
      server=new NodejsTernServer(project,installPath,ternFile);
    }
  }
  server.setTimeout(getTimeout());
  server.setTestNumber(getTestNumber());
  server.setPersistent(isPersistent());
  return server;
}

Fixed version (ground truth):
@Override public ITernServer create(ITernProject project) throws Exception {
  NodejsTernServer server;
  if (isRemoteAccess()) {
    server=new NodejsTernServer(project,getRemotePort());
  }
 else {
    INodejsDebugger debugger=NodejsDebuggersManager.getDebugger(getDebugger());
    File installPath=getInstallPath();
    IFile ternServerFile=getTernServerDebugFile();
    if (debugger != null && debugger.isInstalled() && ternServerFile != null && ternServerFile.exists() && !ternServerFile.getProject().equals(project.getAdapter(IProject.class))) {
      server=new NodejsTernServer(project,debugger.createProcess(project.getProjectDir(),installPath,ternServerFile));
    }
 else {
      File ternBaseDir=project.getRepository().getTernBaseDir();
      server=new NodejsTernServer(project,installPath,ternBaseDir);
    }
  }
  server.setTimeout(getTimeout());
  server.setTestNumber(getTestNumber());
  server.setPersistent(isPersistent());
  return server;
}
Program: 26362
Project: 26362
Buggy source:
private void updateEnabled(boolean isRemote){
  Composite parent=getFieldEditorParent();
  remotePortField.setEnabled(isRemote,parent);
  timeoutField.setEnabled(!isRemote,parent);
  testNumberField.setEnabled(!isRemote,parent);
  persistentField.setEnabled(!isRemote,parent);
  debuggerField.setEnabled(!isRemote,parent);
  ternRepositoryField.setEnabled(!isRemote,parent);
  nodeJSInstallField.setEnabled(!isRemote,parent);
  nodePathTitle.setEnabled(!isRemote);
  nativeNodePath.setEnabled(!isRemote,parent);
  nodePath.setEnabled(!isRemote);
}

Fixed version (ground truth):
private void updateEnabled(boolean isRemote){
  Composite parent=getFieldEditorParent();
  remotePortField.setEnabled(isRemote,parent);
  timeoutField.setEnabled(!isRemote,parent);
  testNumberField.setEnabled(!isRemote,parent);
  persistentField.setEnabled(!isRemote,parent);
  debuggerField.setEnabled(!isRemote,parent);
  ternRepositoryField.setEnabled(debuggerField.isCheckboxSelected(),parent);
  nodeJSInstallField.setEnabled(!isRemote,parent);
  nodePathTitle.setEnabled(!isRemote);
  nativeNodePath.setEnabled(!isRemote,parent);
  nodePath.setEnabled(!isRemote);
}
Program: 26363
Project: 26363
Buggy source:
@Override protected void doFillIntoGrid(Composite parent,int numColumns){
  super.doFillIntoGrid(parent,numColumns - 1);
  importButton=getImportButtonControl(parent);
  GridData gd=new GridData();
  gd.horizontalAlignment=GridData.FILL;
  int widthHint=convertHorizontalDLUsToPixels(importButton,IDialogConstants.BUTTON_WIDTH);
  gd.widthHint=Math.max(widthHint,importButton.computeSize(SWT.DEFAULT,SWT.DEFAULT,true).x);
  importButton.setLayoutData(gd);
  addButton=getAddButtonControl(parent);
  gd=new GridData();
  gd.horizontalAlignment=GridData.FILL;
  widthHint=convertHorizontalDLUsToPixels(addButton,IDialogConstants.BUTTON_WIDTH);
  gd.widthHint=Math.max(widthHint,addButton.computeSize(SWT.DEFAULT,SWT.DEFAULT,true).x);
  addButton.setLayoutData(gd);
}

Fixed version (ground truth):
@Override protected void doFillIntoGrid(Composite parent,int numColumns){
  super.doFillIntoGrid(parent,numColumns - 1);
  importButton=getImportButtonControl(parent);
  GridData gd=new GridData();
  gd.horizontalAlignment=GridData.FILL;
  int widthHint=convertHorizontalDLUsToPixels(importButton,IDialogConstants.BUTTON_WIDTH);
  gd.widthHint=Math.max(widthHint,importButton.computeSize(SWT.DEFAULT,SWT.DEFAULT,true).x);
  importButton.setLayoutData(gd);
}
Program: 26364
Project: 26364
Buggy source:
@Override protected void adjustForNumColumns(int numColumns){
  super.adjustForNumColumns(numColumns - 2);
}

Fixed version (ground truth):
@Override protected void adjustForNumColumns(int numColumns){
  super.adjustForNumColumns(numColumns - NB_BUTTONS);
}
Program: 26365
Project: 26365
Buggy source:
@Override protected Object getValueFromPreference(String preferenceValue){
  if (StringUtils.isEmpty(preferenceValue)) {
    return null;
  }
  return TernCorePlugin.getTernRepositoryManager().getRepository(preferenceValue);
}

Fixed version (ground truth):
@Override protected Object getValueFromPreference(String preferenceValue){
  if (StringUtils.isEmpty(preferenceValue)) {
    return TernUIMessages.TernRepositoryFieldEditor_ternRepository_none;
  }
  return TernCorePlugin.getTernRepositoryManager().getRepository(preferenceValue);
}
Program: 26366
Project: 26366
Buggy source:
@Override public int getNumberOfControls(){
  return super.getNumberOfControls() + 2;
}

Fixed version (ground truth):
@Override public int getNumberOfControls(){
  return super.getNumberOfControls() + NB_BUTTONS;
}
Program: 26367
Project: 26367
Buggy source:
public boolean validate(IDocument document,int offset,DocumentEvent event){
  try {
    String content=document.get(fReplacementPosition.getOffset(),offset - fReplacementPosition.getOffset());
    if (fReplacementString.startsWith(content))     return true;
  }
 catch (  BadLocationException e) {
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean validate(IDocument document,int offset,DocumentEvent event){
  try {
    String content=document.get(fReplacementPosition.getOffset(),offset - fReplacementPosition.getOffset());
    if (fReplacementString.startsWith(content)) {
      return true;
    }
 else     if (fReplacementString.length() > 0) {
      char c=fReplacementString.charAt(0);
      if ((c == '"' || c == '\'') && fReplacementString.startsWith(c + content)) {
        return true;
      }
    }
  }
 catch (  BadLocationException e) {
  }
  return false;
}
Program: 26368
Project: 26368
Buggy source:
private ConfigureJob(IJavaScriptProject jsProject){
  super("String_Node_Str");
}

Fixed version (ground truth):
private ConfigureJob(IJavaScriptProject jsProject){
  super("String_Node_Str");
  this.jsProject=jsProject;
}
Program: 26369
Project: 26369
Buggy source:
@Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
  if (monitor.isCanceled()) {
    return Status.CANCEL_STATUS;
  }
  monitor.beginTask("String_Node_Str",1);
  if (fJsProject != null) {
    IProject project=fJsProject.getProject();
    if (TernCorePlugin.hasTernNature(project)) {
      try {
        IIDETernProject ternProject=TernCorePlugin.getTernProject(project);
        synchTernScriptPaths(fJsProject,ternProject);
      }
 catch (      Exception e) {
        Trace.trace(Trace.SEVERE,"String_Node_Str",e);
      }
    }
  }
  monitor.worked(1);
  monitor.done();
  return Status.OK_STATUS;
}

Fixed version (ground truth):
@Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
  if (monitor.isCanceled()) {
    return Status.CANCEL_STATUS;
  }
  monitor.beginTask("String_Node_Str",1);
  if (jsProject != null) {
    IProject project=jsProject.getProject();
    if (TernCorePlugin.hasTernNature(project)) {
      try {
        IIDETernProject ternProject=TernCorePlugin.getTernProject(project);
        synchTernScriptPaths(jsProject,ternProject);
      }
 catch (      Exception e) {
        Trace.trace(Trace.SEVERE,"String_Node_Str",e);
      }
    }
  }
  monitor.worked(1);
  monitor.done();
  return Status.OK_STATUS;
}
Program: 26370
Project: 26370
Buggy source:
/** 
 * Update JSON options of the tern linter plugin.
 * @throws TernException
 */
public void updateOptions() throws TernException {
  ITernLinterConfig config=(ITernLinterConfig)treeViewer.getInput();
  JsonObject jsonOptions=new JsonObject();
  JsonObject jsonConfig=new JsonObject();
  jsonOptions.add("String_Node_Str",jsonConfig);
  toJSON(config.getOptions(),jsonConfig);
  ITernModuleConfigurable module=(ITernModuleConfigurable)workingCopy.getTernModule(linterId);
  module.setOptions(jsonOptions);
}

Fixed version (ground truth):
/** 
 * Update JSON options of the tern linter plugin.
 * @throws TernException
 */
public void updateOptions() throws TernException {
  ITernLinterConfig config=(ITernLinterConfig)treeViewer.getInput();
  JsonObject jsonOptions=new JsonObject();
  JsonObject jsonConfig=new JsonObject();
  jsonOptions.add("String_Node_Str",jsonConfig);
  updateJSONOptions(config.getOptions(),jsonConfig);
  ITernModuleConfigurable module=(ITernModuleConfigurable)workingCopy.getTernModule(linterId);
  module.setOptions(jsonOptions);
}
Program: 26371
Project: 26371
Buggy source:
public void setLinterConfig(ITernLinterConfig config){
  treeViewer.setInput(config);
  treeViewer.expandAll();
}

Fixed version (ground truth):
public void setLinterConfig(ITernLinterConfig config) throws TernException {
  if (workingCopy.hasCheckedTernModule(linterId)) {
    ITernModuleConfigurable module=(ITernModuleConfigurable)workingCopy.getTernModule(linterId);
    JsonObject jsonOptions=module.getOptions();
    if (jsonOptions != null && jsonOptions.get("String_Node_Str") != null) {
      updateConfig((JsonObject)jsonOptions.get("String_Node_Str"),config.getOptions());
    }
  }
  treeViewer.setInput(config);
  treeViewer.expandAll();
}
Program: 26372
Project: 26372
Buggy source:
@Override public boolean performOk(){
  linterConfigBlock.saveColumnSettings();
  try {
    linterConfigBlock.updateOptions();
    saveWorkingCopy();
  }
 catch (  Exception e) {
    Trace.trace(Trace.SEVERE,"String_Node_Str",e);
  }
  return super.performOk();
}

Fixed version (ground truth):
@Override public boolean performOk(){
  linterConfigBlock.saveColumnSettings();
  try {
    IWorkingCopy workingCopy=getWorkingCopy();
    if (workingCopy.hasCheckedTernModule(linterId)) {
      linterConfigBlock.updateOptions();
      saveWorkingCopy();
    }
  }
 catch (  Exception e) {
    Trace.trace(Trace.SEVERE,"String_Node_Str",e);
  }
  return super.performOk();
}
Program: 26373
Project: 26373
Buggy source:
/** 
 * Load linter config.
 */
private void loadLinterConfig(){
  try {
    IIDETernProject ternProject=getTernProject();
    ITernLinterConfig config=TernLinterCorePlugin.getDefault().getTernLinterConfigurationsManager().createLinterConfig(linterId);
    linterConfigBlock.setLinterConfig(config);
  }
 catch (  Throwable e) {
    Trace.trace(Trace.SEVERE,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Load linter config.
 */
private void loadLinterConfig(){
  try {
    ITernLinterConfig config=TernLinterCorePlugin.getDefault().getTernLinterConfigurationsManager().createLinterConfig(linterId);
    linterConfigBlock.setLinterConfig(config);
  }
 catch (  Throwable e) {
    Trace.trace(Trace.SEVERE,"String_Node_Str",e);
  }
}
Program: 26374
Project: 26374
Buggy source:
public void refreshModules(){
  try {
    IWorkingCopy workingCopy=getWorkingCopy();
    workingCopy.addWorkingCopyListener(this);
    modulesBlock.refresh(getTernProject().getAllModules(),workingCopy.getCheckedModules());
  }
 catch (  Throwable e) {
    Trace.trace(Trace.SEVERE,"String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void refreshModules(){
  try {
    IWorkingCopy workingCopy=getWorkingCopy();
    workingCopy.addWorkingCopyListener(this);
    modulesBlock.refresh(workingCopy.getAllModules(),workingCopy.getCheckedModules());
  }
 catch (  Throwable e) {
    Trace.trace(Trace.SEVERE,"String_Node_Str",e);
  }
}
Program: 26375
Project: 26375
Buggy source:
@Override public String getHoverInfo(ITextViewer textViewer,IRegion hoverRegion){
  IPath path;
  IAnnotationModel model;
  if (textViewer instanceof ISourceViewer) {
    path=null;
    model=((ISourceViewer)textViewer).getAnnotationModel();
  }
 else {
    path=getEditorInputPath();
    model=getAnnotationModel(path);
  }
  if (model == null)   return null;
  try {
    Iterator e=model.getAnnotationIterator();
    int layer=-1;
    String message=null;
    while (e.hasNext()) {
      Annotation a=(Annotation)e.next();
      if (!("String_Node_Str".equals(a.getType()))) {
        continue;
      }
      AnnotationPreference preference=getAnnotationPreference(a);
      Position p=model.getPosition(a);
      int l=fAnnotationAccess.getLayer(a);
      if (l > layer && p != null && p.overlapsWith(hoverRegion.getOffset(),hoverRegion.getLength())) {
        String msg=a.getText();
        if (msg != null && msg.trim().length() > 0) {
          message=msg;
          layer=l;
        }
      }
    }
    if (layer > -1) {
      return formatMessage(message);
    }
  }
  finally {
    try {
      if (path != null) {
        ITextFileBufferManager manager=FileBuffers.getTextFileBufferManager();
        manager.disconnect(path,LocationKind.NORMALIZE,null);
      }
    }
 catch (    CoreException ex) {
      Trace.trace(Trace.SEVERE,"String_Node_Str",ex);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override public String getHoverInfo(ITextViewer textViewer,IRegion hoverRegion){
  IPath path;
  IAnnotationModel model;
  if (textViewer instanceof ISourceViewer) {
    path=null;
    model=((ISourceViewer)textViewer).getAnnotationModel();
  }
 else {
    path=getEditorInputPath();
    model=getAnnotationModel(path);
  }
  if (model == null)   return null;
  try {
    Iterator e=model.getAnnotationIterator();
    int layer=-1;
    String message=null;
    while (e.hasNext()) {
      Annotation a=(Annotation)e.next();
      if (!isTernAnnotation(a)) {
        continue;
      }
      AnnotationPreference preference=getAnnotationPreference(a);
      Position p=model.getPosition(a);
      int l=fAnnotationAccess.getLayer(a);
      if (l > layer && p != null && p.overlapsWith(hoverRegion.getOffset(),hoverRegion.getLength())) {
        String msg=a.getText();
        if (msg != null && msg.trim().length() > 0) {
          message=msg;
          layer=l;
        }
      }
    }
    if (layer > -1) {
      return formatMessage(message);
    }
  }
  finally {
    try {
      if (path != null) {
        ITextFileBufferManager manager=FileBuffers.getTextFileBufferManager();
        manager.disconnect(path,LocationKind.NORMALIZE,null);
      }
    }
 catch (    CoreException ex) {
      Trace.trace(Trace.SEVERE,"String_Node_Str",ex);
    }
  }
  return null;
}
Program: 26376
Project: 26376
Buggy source:
@Override public void request(final TernDoc doc){
  final ITernServer server=project.getTernServer();
  if (server != null && !server.isDisposed()) {
    server.request(doc,new IResponseHandler(){
      @Override public void onSuccess(      Object data,      String dataAsJsonString){
      }
      @Override public void onError(      String error,      Throwable t){
        project.handleException(new TernException(error,t));
      }
      @Override public boolean isDataAsJsonString(){
        return false;
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void request(final TernDoc doc){
  final ITernServer server=project.getTernServer();
  if (server != null && !server.isDisposed()) {
    server.request(doc,new IResponseHandler(){
      @Override public void onSuccess(      Object data,      String dataAsJsonString){
      }
      @Override public void onError(      String error,      Throwable t){
        project.handleException(new TernException(error,t));
        project.getFileSynchronizer().uploadFailed(doc);
      }
      @Override public boolean isDataAsJsonString(){
        return false;
      }
    }
);
  }
}
Program: 26377
Project: 26377
Buggy source:
@Override public void onError(String error,Throwable t){
  project.handleException(new TernException(error,t));
}

Fixed version (ground truth):
@Override public void onError(String error,Throwable t){
  project.handleException(new TernException(error,t));
  project.getFileSynchronizer().uploadFailed(doc);
}
Program: 26379
Project: 26379
Buggy source:
public BasicTernPlugin(String name){
  this.name=name;
  int index=getVersionIndex(name);
  if (index != -1) {
    this.type=name.substring(0,index);
    this.version=name.substring(index + 1,name.length());
  }
 else {
    this.type=null;
    this.version=null;
  }
}

Fixed version (ground truth):
public BasicTernPlugin(String name){
  this.name=name;
  int index=getVersionIndex(name);
  if (index != -1) {
    this.type=name.substring(0,index);
    this.version=name.substring(index + 1,name.length());
  }
 else {
    this.type=name;
    this.version=null;
  }
}
Program: 26380
Project: 26380
Buggy source:
protected void setTernModules(ITernModule[] vms){
  ternModules.clear();
  for (  ITernModule element : vms) {
    ternModules.add(element);
  }
  tableViewer.setInput(ternModules);
}

Fixed version (ground truth):
protected void setTernModules(ITernModule[] vms){
  ternModules.clear();
  for (  ITernModule module : vms) {
    ternModules.put(module.getName(),module);
  }
  tableViewer.setInput(ternModules.values());
}
Program: 26382
Project: 26382
Buggy source:
@Override public void checkStateChanged(CheckStateChangedEvent e){
  if (checkUpdating) {
    return;
  }
  try {
    checkUpdating=true;
    if (e.getChecked() && isSelectDependencies()) {
      ITernModule module=((ITernModule)e.getElement());
      TernModuleMetadata metadata=module.getMetadata();
      if (metadata != null) {
        ITernModule dependencyModule=null;
        for (        String moduleName : metadata.getDependencies()) {
          dependencyModule=TernCorePlugin.getTernServerTypeManager().findTernModule(moduleName);
          if (dependencyModule != null) {
            if (!tableViewer.getChecked(dependencyModule)) {
              tableViewer.setChecked(dependencyModule,true);
            }
          }
        }
      }
    }
  }
  finally {
    checkUpdating=false;
  }
}

Fixed version (ground truth):
@Override public void checkStateChanged(CheckStateChangedEvent e){
  if (checkUpdating) {
    return;
  }
  try {
    checkUpdating=true;
    if (e.getChecked() && isSelectDependencies()) {
      ITernModule module=((ITernModule)e.getElement());
      TernModuleMetadata metadata=module.getMetadata();
      if (metadata != null) {
        ITernModule dependencyModule=null;
        for (        String moduleName : metadata.getDependencies()) {
          dependencyModule=ternModules.get(moduleName);
          if (dependencyModule != null) {
            if (!tableViewer.getChecked(dependencyModule)) {
              tableViewer.setChecked(dependencyModule,true);
            }
          }
        }
      }
    }
  }
  finally {
    checkUpdating=false;
  }
}
Program: 26383
Project: 26383
Buggy source:
public void stop(BundleContext context) throws Exception {
  plugin=null;
  super.stop(context);
  getTernDescriptorManager().destroy();
}

Fixed version (ground truth):
public void stop(BundleContext context) throws Exception {
  getTernDescriptorManager().destroy();
  plugin=null;
  super.stop(context);
}
Program: 26384
Project: 26384
Buggy source:
/** 
 * Load the tern project describers.
 */
private synchronized void addTernNatureAdapters(IConfigurationElement[] cf,Map<ITernNatureCapability,List<DefaultModule>> map){
  for (  IConfigurationElement ce : cf) {
    String id=ce.getAttribute("String_Node_Str");
    String className=ce.getAttribute("String_Node_Str");
    try {
      if (className != null) {
        map.put((ITernNatureCapability)ce.createExecutableExtension("String_Node_Str"),getDefaultModules(ce));
      }
 else       if (id != null) {
        map.put(new DefaultTernNatureAdapter(id),getDefaultModules(ce));
      }
      Trace.trace(Trace.EXTENSION_POINT,"String_Node_Str" + id != null ? id : className != null ? className : "String_Node_Str");
    }
 catch (    Throwable t) {
      Trace.trace(Trace.SEVERE,"String_Node_Str" + id != null ? id : className != null ? className : "String_Node_Str",t);
    }
  }
}

Fixed version (ground truth):
/** 
 * Load the tern project describers.
 */
private synchronized void addTernNatureAdapters(IConfigurationElement[] cf,Map<ITernNatureCapability,List<DefaultModule>> map){
  for (  IConfigurationElement ce : cf) {
    String id=ce.getAttribute("String_Node_Str");
    String className=ce.getAttribute("String_Node_Str");
    try {
      if (!StringUtils.isEmpty(className)) {
        map.put((ITernNatureCapability)ce.createExecutableExtension("String_Node_Str"),getDefaultModules(ce));
      }
 else       if (!StringUtils.isEmpty(id)) {
        map.put(new DefaultTernNatureAdapter(id),getDefaultModules(ce));
      }
      Trace.trace(Trace.EXTENSION_POINT,"String_Node_Str" + id != null ? id : className != null ? className : "String_Node_Str");
    }
 catch (    Throwable t) {
      Trace.trace(Trace.SEVERE,"String_Node_Str" + id != null ? id : className != null ? className : "String_Node_Str",t);
    }
  }
}
Program: 26385
Project: 26385
Buggy source:
private IFile getFile(String filename){
  if (StringUtils.isEmpty(filename)) {
    return null;
  }
  return ternProject.getProject().getFile(filename);
}

Fixed version (ground truth):
private IFile getFile(String filename){
  if (StringUtils.isEmpty(filename)) {
    return null;
  }
  return ternProject.getFileManager().getFile(filename);
}
Program: 26386
Project: 26386
Buggy source:
public ITernConsole getConsole(IDETernProject project){
  TernConsole console=consoles.get(project);
  if (console == null) {
    console=new TernConsole(project);
    consoles.put(project.getProject(),console);
  }
  TernConsoleHelper.showConsole(console);
  return console;
}

Fixed version (ground truth):
public ITernConsole getConsole(IDETernProject project){
  TernConsole console=consoles.get(project.getProject());
  if (console == null) {
    console=new TernConsole(project);
    consoles.put(project.getProject(),console);
  }
  TernConsoleHelper.showConsole(console);
  return console;
}
Program: 26387
Project: 26387
Buggy source:
/** 
 * Add Tern plugin.
 * @param plugin the tern plugin to add.
 * @param options plugin options.
 * @return true if plugin to add, replace an existing plugin and falseotherwise.
 */
public boolean addPlugin(ITernPlugin plugin,JsonObject options){
  boolean exists=hasPlugin(plugin);
  getPlugins().add(plugin.getName(),options);
  return exists;
}

Fixed version (ground truth):
/** 
 * Add Tern plugin.
 * @param plugin the tern plugin to add.
 * @param options plugin options.
 * @return true if plugin to add, replace an existing plugin and falseotherwise.
 */
public boolean addPlugin(ITernPlugin plugin,JsonObject options){
  boolean exists=hasPlugin(plugin);
  getPlugins().add(plugin.getName(),options != null ? options : EMPTY_OPTIONS);
  return exists;
}
Program: 26388
Project: 26388
Buggy source:
public static String getTernURL(String path) throws IOException {
  if (context == null) {
    throw new IOException("String_Node_Str" + path + "String_Node_Str");
  }
  return FileLocator.toFileURL(Platform.getBundle("String_Node_Str").getEntry("String_Node_Str" + path)).toExternalForm();
}

Fixed version (ground truth):
public static String getTernURL(String path) throws IOException {
  if (context == null) {
    throw new IOException("String_Node_Str" + path + "String_Node_Str");
  }
  return FileLocator.toFileURL(Platform.getBundle(Activator.PLUGIN_ID).getEntry("String_Node_Str" + path)).toExternalForm();
}
Program: 26389
Project: 26389
Buggy source:
/** 
 * Add Tern plugin.
 * @param plugin the tern plugin to add.
 * @param options plugin options.
 * @return true if plugin to add, replace an existing plugin and falseotherwise.
 */
public boolean addPlugin(ITernPlugin plugin,JsonObject options){
  boolean exists=hasPlugin(plugin);
  getPlugins().add(plugin.getName(),options != null ? options : EMPTY_OPTIONS);
  return exists;
}

Fixed version (ground truth):
/** 
 * Add Tern plugin.
 * @param plugin the tern plugin to add.
 * @param options plugin options.
 * @return true if plugin to add, replace an existing plugin and falseotherwise.
 */
public boolean addPlugin(ITernPlugin plugin,JsonObject options){
  boolean exists=hasPlugin(plugin);
  getPlugins().add(plugin.getName(),options != null ? options : new JsonObject());
  return exists;
}
Program: 26390
Project: 26390
Buggy source:
/** 
 * Load the tern project from the .tern-project of the project base dir.
 * @throws IOException
 */
public void load() throws IOException {
  File file=new File(projectDir,TERN_PROJECT);
  if (file.exists()) {
    try {
      super.readFrom(new FileReader(file));
    }
 catch (    ParseException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
/** 
 * Load the tern project from the .tern-project of the project base dir.
 * @throws IOException
 */
public void load() throws IOException {
  File file=new File(projectDir,TERN_PROJECT);
  if (file.exists()) {
    try {
      JsonHelper.readFrom(new FileReader(file),this);
    }
 catch (    ParseException e) {
      e.printStackTrace();
    }
  }
}
Program: 26391
Project: 26391
Buggy source:
/** 
 * Load defs from tern project.
 */
public void loadDefs(IProject project){
  List<ITernDef> allDefs=new ArrayList<ITernDef>();
  ITernDef[] defaultDefs=TernCorePlugin.getTernServerTypeManager().getTernDefs();
  for (  ITernDef defaultDef : defaultDefs) {
    allDefs.add(defaultDef);
  }
  this.setTernDefs(allDefs.toArray(ITernDef.EMPTY_DEF));
  if (project != null) {
    try {
      IDETernProject ternProject=IDETernProject.getTernProject(project);
      JsonArray defs=ternProject.getLibs();
      List<ITernDef> initialDefs=new ArrayList<ITernDef>();
      for (      Object name : defs) {
        ITernDef def=TernCorePlugin.getTernServerTypeManager().findTernDef(name.toString());
        if (def != null) {
          initialDefs.add(def);
        }
      }
      this.setCheckedDefs(initialDefs.toArray());
    }
 catch (    CoreException e) {
      Trace.trace(Trace.SEVERE,"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Load defs from tern project.
 */
public void loadDefs(IProject project){
  List<ITernDef> allDefs=new ArrayList<ITernDef>();
  ITernDef[] defaultDefs=TernCorePlugin.getTernServerTypeManager().getTernDefs();
  for (  ITernDef defaultDef : defaultDefs) {
    allDefs.add(defaultDef);
  }
  this.setTernDefs(allDefs.toArray(ITernDef.EMPTY_DEF));
  if (project != null) {
    try {
      IDETernProject ternProject=IDETernProject.getTernProject(project);
      JsonArray defs=ternProject.getLibs();
      List<ITernDef> initialDefs=new ArrayList<ITernDef>();
      for (      JsonValue name : defs) {
        ITernDef def=TernCorePlugin.getTernServerTypeManager().findTernDef(name.asString());
        if (def != null) {
          initialDefs.add(def);
        }
      }
      this.setCheckedDefs(initialDefs.toArray());
    }
 catch (    CoreException e) {
      Trace.trace(Trace.SEVERE,"String_Node_Str",e);
    }
  }
}
Program: 26393
Project: 26393
Buggy source:
/** 
 * Load defs from tern project.
 */
private void loadDefs(){
  List<ITernDef> allDefs=new ArrayList<ITernDef>();
  ITernDef[] defaultDefs=TernCorePlugin.getTernServerTypeManager().getTernDefs();
  for (  ITernDef defaultDef : defaultDefs) {
    allDefs.add(defaultDef);
  }
  try {
    IDETernProject ternProject=getTernProject();
    List defs=ternProject.getLibs();
    initialDefs=new ArrayList<ITernDef>();
    for (    Object name : defs) {
      ITernDef def=TernCorePlugin.getTernServerTypeManager().findTernDef(name.toString());
      if (def != null) {
        initialDefs.add(def);
      }
    }
    defsBlock.setCheckedDefs(initialDefs.toArray());
  }
 catch (  CoreException e) {
    Trace.trace(Trace.SEVERE,"String_Node_Str",e);
  }
  defsBlock.setTernDefs(allDefs.toArray(EMPTY_DEF));
}

Fixed version (ground truth):
/** 
 * Load defs from tern project.
 */
private void loadDefs(){
  List<ITernDef> allDefs=new ArrayList<ITernDef>();
  ITernDef[] defaultDefs=TernCorePlugin.getTernServerTypeManager().getTernDefs();
  for (  ITernDef defaultDef : defaultDefs) {
    allDefs.add(defaultDef);
  }
  defsBlock.setTernDefs(allDefs.toArray(EMPTY_DEF));
  try {
    IDETernProject ternProject=getTernProject();
    List defs=ternProject.getLibs();
    initialDefs=new ArrayList<ITernDef>();
    for (    Object name : defs) {
      ITernDef def=TernCorePlugin.getTernServerTypeManager().findTernDef(name.toString());
      if (def != null) {
        initialDefs.add(def);
      }
    }
    defsBlock.setCheckedDefs(initialDefs.toArray());
  }
 catch (  CoreException e) {
    Trace.trace(Trace.SEVERE,"String_Node_Str",e);
  }
}