nus-yam/ex-repair huggingface dataset:
Program: 24439
Project: 24439
Buggy source:
@Override public String toString(){
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str").append(mInterfaceName).append("String_Node_Str").append(mRunState).append(LS);
  sb.append(mWifiInfo).append(LS);
  sb.append(mDhcpInfo).append(LS);
  sb.append("String_Node_Str").append(mHaveIPAddress).append("String_Node_Str").append(mObtainingIPAddress).append("String_Node_Str").append(mIsScanModeActive).append(LS).append("String_Node_Str").append(mLastSignalLevel).append("String_Node_Str").append(mTornDownByConnMgr);
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuffer sb=new StringBuffer();
  sb.append("String_Node_Str").append(mInterfaceName);
  sb.append("String_Node_Str");
  if (mRunState >= 1 && mRunState <= mRunStateNames.length) {
    sb.append(mRunStateNames[mRunState - 1]);
  }
 else {
    sb.append(mRunState);
  }
  sb.append(LS).append(mWifiInfo).append(LS);
  sb.append(mDhcpInfo).append(LS);
  sb.append("String_Node_Str").append(mHaveIPAddress).append("String_Node_Str").append(mObtainingIPAddress).append("String_Node_Str").append(mIsScanModeActive).append(LS).append("String_Node_Str").append(mLastSignalLevel).append("String_Node_Str").append(mTornDownByConnMgr);
  return sb.toString();
}
Program: 24440
Project: 24440
Buggy source:
/** 
 * Called when the dependency changes.
 * @param dependency The Preference that this Preference depends on.
 * @param disableDependent Set true to disable this Preference.
 */
public void onDependencyChanged(Preference dependency,boolean disableDependent){
  setEnabled(!disableDependent);
}

Fixed version (ground truth):
/** 
 * Called when the dependency changes.
 * @param dependency The Preference that this Preference depends on.
 * @param disableDependent Set true to disable this Preference.
 */
public void onDependencyChanged(Preference dependency,boolean disableDependent){
  if (mDependencyMet == disableDependent) {
    mDependencyMet=!disableDependent;
    notifyDependencyChange(shouldDisableDependents());
    notifyChanged();
  }
}
Program: 24441
Project: 24441
Buggy source:
/** 
 * Checks whether this Preference should be enabled in the list.
 * @return True if this Preference is enabled, false otherwise.
 */
public boolean isEnabled(){
  return mEnabled;
}

Fixed version (ground truth):
/** 
 * Checks whether this Preference should be enabled in the list.
 * @return True if this Preference is enabled, false otherwise.
 */
public boolean isEnabled(){
  return mEnabled && mDependencyMet;
}
Program: 24443
Project: 24443
Buggy source:
public void dispatchKey(KeyEvent event){
  if (mSession != null && mSurface != null) {
    try {
      mSession.finishKey(mWindow);
    }
 catch (    RemoteException ex) {
    }
  }
}

Fixed version (ground truth):
public void dispatchKey(KeyEvent event){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (surfaceView.mSession != null && surfaceView.mSurface != null) {
      try {
        surfaceView.mSession.finishKey(surfaceView.mWindow);
      }
 catch (      RemoteException ex) {
      }
    }
  }
}
Program: 24444
Project: 24444
Buggy source:
public void dispatchGetNewSurface(){
  Message msg=mHandler.obtainMessage(GET_NEW_SURFACE_MSG);
  mHandler.sendMessage(msg);
}

Fixed version (ground truth):
public void dispatchGetNewSurface(){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    Message msg=surfaceView.mHandler.obtainMessage(GET_NEW_SURFACE_MSG);
    surfaceView.mHandler.sendMessage(msg);
  }
}
Program: 24445
Project: 24445
Buggy source:
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw){
  if (localLOGV)   Log.v("String_Node_Str",SurfaceView.this + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
synchronized (this) {
    if (mCurWidth != w || mCurHeight != h) {
      mCurWidth=w;
      mCurHeight=h;
    }
    if (reportDraw) {
      try {
        mSession.finishDrawing(mWindow);
      }
 catch (      RemoteException e) {
      }
    }
  }
}

Fixed version (ground truth):
public void resized(int w,int h,Rect coveredInsets,Rect visibleInsets,boolean reportDraw){
  SurfaceView surfaceView=mSurfaceView.get();
  if (surfaceView != null) {
    if (localLOGV)     Log.v("String_Node_Str",surfaceView + "String_Node_Str" + w+ "String_Node_Str"+ h+ "String_Node_Str"+ mCurWidth+ "String_Node_Str"+ mCurHeight);
synchronized (this) {
      if (mCurWidth != w || mCurHeight != h) {
        mCurWidth=w;
        mCurHeight=h;
      }
      if (reportDraw) {
        try {
          surfaceView.mSession.finishDrawing(surfaceView.mWindow);
        }
 catch (        RemoteException e) {
        }
      }
    }
  }
}
Program: 24447
Project: 24447
Buggy source:
public static final CharSequence getDisplayLabel(Context context,int type,CharSequence label){
  CharSequence display="String_Node_Str";
  if (type != TYPE_CUSTOM) {
    CharSequence[] labels=context.getResources().getTextArray(com.android.internal.R.array.organizationTypes);
    try {
      display=labels[type - 1];
    }
 catch (    ArrayIndexOutOfBoundsException e) {
      display=labels[People.Phones.TYPE_HOME - 1];
    }
  }
 else {
    if (!TextUtils.isEmpty(label)) {
      display=label;
    }
  }
  return display;
}

Fixed version (ground truth):
public static final CharSequence getDisplayLabel(Context context,int type,CharSequence label){
  CharSequence display="String_Node_Str";
  if (type != TYPE_CUSTOM) {
    CharSequence[] labels=context.getResources().getTextArray(com.android.internal.R.array.organizationTypes);
    try {
      display=labels[type - 1];
    }
 catch (    ArrayIndexOutOfBoundsException e) {
      display=labels[Organizations.TYPE_WORK - 1];
    }
  }
 else {
    if (!TextUtils.isEmpty(label)) {
      display=label;
    }
  }
  return display;
}
Program: 24448
Project: 24448
Buggy source:
/** 
 * {@inheritDoc} 
 */
public void systemReady(){
  try {
    int menuState=mWindowManager.getKeycodeState(KeyEvent.KEYCODE_MENU);
    Log.i(TAG,"String_Node_Str" + menuState);
    if (menuState > 0) {
      ActivityManagerNative.getDefault().enterSafeMode();
    }
 else {
      mKeyguardMediator.onSystemReady();
      android.os.SystemProperties.set("String_Node_Str","String_Node_Str");
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc} 
 */
public void systemReady(){
  try {
    int menuState=mWindowManager.getKeycodeState(KeyEvent.KEYCODE_MENU);
    Log.i(TAG,"String_Node_Str" + menuState);
    if (menuState > 0) {
      ActivityManagerNative.getDefault().enterSafeMode();
    }
    mKeyguardMediator.onSystemReady();
    android.os.SystemProperties.set("String_Node_Str","String_Node_Str");
  }
 catch (  RemoteException e) {
  }
}
Program: 24449
Project: 24449
Buggy source:
private void addJarResource(File file) throws IOException {
  JarFile jarFile=new JarFile(file);
  addURL(file.toURL());
  Enumeration<JarEntry> jarEntries=jarFile.entries();
  while (jarEntries.hasMoreElements()) {
    JarEntry jarEntry=jarEntries.nextElement();
    if (!jarEntry.isDirectory() && isJar(jarEntry.getName())) {
      addJarResource(jarEntryAsFile(jarFile,jarEntry));
    }
  }
}

Fixed version (ground truth):
private void addJarResource(File file) throws IOException {
  JarFile jarFile=new JarFile(file);
  addURL(file.toURL());
  Enumeration<JarEntry> jarEntries=jarFile.entries();
  while (jarEntries.hasMoreElements()) {
    JarEntry jarEntry=jarEntries.nextElement();
    if (!jarEntry.isDirectory() && isServerJar(jarEntry.getName())) {
      addJarResource(jarEntryAsFile(jarFile,jarEntry));
    }
  }
}
Program: 24450
Project: 24450
Buggy source:
public static void main(String[] args){
  JarClassLoader jarClassLoader=createClassLoader();
  Thread.currentThread().setContextClassLoader(jarClassLoader);
  ProtectionDomain domain=Main.class.getProtectionDomain();
  URL location=domain.getCodeSource().getLocation();
  try {
    invokeClass("String_Node_Str",new String[]{location.toString()});
  }
 catch (  Throwable e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  JarClassLoader serverClassLoader=createClassLoader();
  Thread.currentThread().setContextClassLoader(serverClassLoader);
  ProtectionDomain domain=Main.class.getProtectionDomain();
  URL location=domain.getCodeSource().getLocation();
  try {
    invokeClass("String_Node_Str",new String[]{location.toString()});
  }
 catch (  Throwable e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 24451
Project: 24451
Buggy source:
public JarClassLoader(URL[] urls,ClassLoader parent){
  super(urls,parent);
  try {
    ProtectionDomain protectionDomain=getClass().getProtectionDomain();
    CodeSource codeSource=protectionDomain.getCodeSource();
    URL rootJarUrl=codeSource.getLocation();
    File warFile=new File(rootJarUrl.getPath());
    JarFile jarFile=new JarFile(warFile);
    Enumeration<JarEntry> jarEntries=jarFile.entries();
    while (jarEntries.hasMoreElements()) {
      JarEntry jarEntry=jarEntries.nextElement();
      if (!jarEntry.isDirectory() && isJar(jarEntry.getName())) {
        addJarResource(jarEntryAsFile(jarFile,jarEntry));
      }
    }
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public JarClassLoader(URL[] urls,ClassLoader parent){
  super(urls,parent);
  try {
    ProtectionDomain protectionDomain=getClass().getProtectionDomain();
    CodeSource codeSource=protectionDomain.getCodeSource();
    URL rootJarUrl=codeSource.getLocation();
    File warFile=new File(rootJarUrl.getPath());
    JarFile jarFile=new JarFile(warFile);
    Enumeration<JarEntry> jarEntries=jarFile.entries();
    while (jarEntries.hasMoreElements()) {
      JarEntry jarEntry=jarEntries.nextElement();
      if (!jarEntry.isDirectory() && isServerJar(jarEntry.getName())) {
        addJarResource(jarEntryAsFile(jarFile,jarEntry));
      }
    }
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 24453
Project: 24453
Buggy source:
public void mouseClicked(MouseEvent e){
  if (state == State.OVERALL) {
    if (currentBook != null) {
      state=State.DETAIL;
      this.paint(this.getGraphics());
    }
  }
 else {
    state=State.OVERALL;
    this.paint(this.getGraphics());
  }
}

Fixed version (ground truth):
public void mouseClicked(MouseEvent e){
  if (state == State.OVERALL) {
    if (currentBook != null) {
      state=State.DETAIL;
      this.paint(this.getGraphics());
    }
  }
 else {
    state=State.OVERALL;
    this.getGraphics().clearRect(0,0,width,height);
    this.paint(this.getGraphics());
  }
}
Program: 24455
Project: 24455
Buggy source:
@EventListener public void check(LoginEvent loginEvent){
  Date date=new Date(loginEvent.getTimestamp());
  Calendar calendar=Calendar.getInstance();
  calendar.setTime(date);
  if (calendar.get(Calendar.HOUR) < BEDTIME_FOR_NIGHTHAWK) {
    addAchievement(loginEvent);
  }
}

Fixed version (ground truth):
@EventListener public void check(LoginEvent loginEvent){
  Date date=new Date(loginEvent.getTimestamp());
  Calendar calendar=Calendar.getInstance();
  calendar.setTime(date);
  if (calendar.get(Calendar.HOUR_OF_DAY) < BEDTIME_FOR_NIGHTHAWK) {
    addAchievement(loginEvent);
  }
}
Program: 24456
Project: 24456
Buggy source:
@Override public void shutdown() throws RuntimeException {
  if (persistenceManagerFactory != null)   persistenceManagerFactory.close();
}

Fixed version (ground truth):
@Override public void shutdown() throws RuntimeException {
  if (persistenceManagerFactory != null)   try {
    persistenceManagerFactory.close();
  }
 catch (  Exception e) {
  }
}
Program: 24457
Project: 24457
Buggy source:
@Override protected void endOperation(PersistenceManager iManager){
  iManager.currentTransaction().commit();
}

Fixed version (ground truth):
@Override protected void endOperation(PersistenceManager iManager){
  iManager.currentTransaction().commit();
  closeManager(iManager);
}
Program: 24458
Project: 24458
Buggy source:
@Override public void undetachedFieldAccess(Object entity,String field){
  try {
    Roma.context().create();
    PersistenceAspect aspect=Roma.context().persistence();
    PersistenceManager manager=(PersistenceManager)aspect.getUnderlyingComponent();
    if (manager instanceof JDOPersistenceManager && entity instanceof PersistenceCapable) {
      ObjectManager objManager=((JDOPersistenceManager)manager).getObjectManager();
      ApiAdapter api=objManager.getApiAdapter();
      Object id=api.getIdForObject(entity);
      StateManager sm=(StateManager)ObjectProviderFactory.newForDetached(objManager,entity,id,api.getVersionForObject(entity));
      sm.retrieveDetachState(sm);
      AbstractClassMetaData acm=sm.getClassMetaData();
      try {
        int fieldPos=acm.getAbsolutePositionOfMember(field);
        sm.loadField(fieldPos);
        FetchPlanState fps=new FetchPlanState();
        FieldManager detachFieldManager=new DetachFieldManager(sm,acm.getSCOMutableMemberFlags(),objManager.getFetchPlan().manageFetchPlanForClass(acm),fps,false);
        detachFieldManager.fetchObjectField(fieldPos);
      }
  finally {
        ((Detachable)entity).jdoReplaceDetachedState();
        ((PersistenceCapable)entity).jdoReplaceStateManager(null);
      }
    }
  }
  finally {
    Roma.context().destroy();
  }
}

Fixed version (ground truth):
@Override public void undetachedFieldAccess(Object entity,String field){
  try {
    Roma.context().create();
    PersistenceAspect aspect=Roma.context().persistence();
    PersistenceManager manager=(PersistenceManager)aspect.getUnderlyingComponent();
    if (manager instanceof JDOPersistenceManager && entity instanceof PersistenceCapable) {
      ObjectManager objManager=((JDOPersistenceManager)manager).getObjectManager();
      ApiAdapter api=objManager.getApiAdapter();
      Object id=api.getIdForObject(entity);
      StateManager sm=(StateManager)ObjectProviderFactory.newForDetached(objManager,entity,id,api.getVersionForObject(entity));
      sm.retrieveDetachState(sm);
      AbstractClassMetaData acm=sm.getClassMetaData();
      try {
        int fieldPos=acm.getAbsolutePositionOfMember(field);
        sm.loadField(fieldPos);
        FetchPlanState fps=new FetchPlanState();
        FieldManager detachFieldManager=new DetachFieldManager(sm,acm.getSCOMutableMemberFlags(),objManager.getFetchPlan().manageFetchPlanForClass(acm),fps,false);
        detachFieldManager.fetchObjectField(fieldPos);
      }
  finally {
        ((Detachable)entity).jdoReplaceDetachedState();
        ((PersistenceCapable)entity).jdoReplaceStateManager(null);
        if (aspect == null || aspect instanceof JDOAtomicPersistenceAspect) {
          if (manager == null || manager.isClosed())           return;
          if (manager.currentTransaction().isActive())           manager.currentTransaction().rollback();
          manager.close();
          manager=null;
        }
      }
    }
  }
  finally {
    Roma.context().destroy();
  }
}
Program: 24460
Project: 24460
Buggy source:
protected QueryByFilter buildQueryByFilter(QueryByExample iQuery){
  QueryByFilter filter=new QueryByFilter(iQuery.getCandidateClass());
  filter.setRangeFrom(iQuery.getRangeFrom(),iQuery.getRangeTo());
  filter.setSubClasses(iQuery.isSubClasses());
  filter.setMode(iQuery.getMode());
  filter.setStrategy(iQuery.getStrategy());
  if (iQuery.getFilter() != null) {
    Iterator<SchemaField> sf=Roma.schema().getSchemaClass(iQuery.getCandidateClass()).getFieldIterator();
    Object fieldValue;
    QueryOperator operator=null;
    while (sf.hasNext()) {
      SchemaField field=sf.next();
      fieldValue=field.getValue(iQuery.getFilter());
      if (fieldValue != null) {
        if (fieldValue instanceof Collection<?> || fieldValue instanceof Map<?,?>)         continue;
        if (fieldValue instanceof String && ((String)fieldValue).length() == 0)         continue;
        if (String.class.equals(field.getLanguageType()))         operator=QueryByFilter.FIELD_LIKE;
 else         operator=QueryByFilter.FIELD_EQUALS;
        filter.addItem(field.getName(),operator,fieldValue);
      }
    }
  }
  QueryByFilter addFilter=iQuery.getAdditionalFilter();
  if (addFilter != null) {
    filter.setSubClasses(addFilter.isSubClasses());
    filter.merge(addFilter);
  }
  return filter;
}

Fixed version (ground truth):
protected QueryByFilter buildQueryByFilter(QueryByExample iQuery){
  QueryByFilter filter=new QueryByFilter(iQuery.getCandidateClass());
  filter.setRangeFrom(iQuery.getRangeFrom(),iQuery.getRangeTo());
  filter.setSubClasses(iQuery.isSubClasses());
  filter.setMode(iQuery.getMode());
  filter.setStrategy(iQuery.getStrategy());
  if (iQuery.getFilter() != null) {
    Iterator<SchemaField> sf=Roma.schema().getSchemaClass(iQuery.getCandidateClass()).getFieldIterator();
    Object fieldValue;
    QueryOperator operator=null;
    while (sf.hasNext()) {
      SchemaField field=sf.next();
      try {
        boolean found=false;
        Field[] fields=iQuery.getCandidateClass().getFields();
        for (        Field classField : fields) {
          if (classField.getName().equals(field.getName())) {
            found=true;
            break;
          }
        }
        if (!found)         continue;
      }
 catch (      SecurityException e) {
      }
      fieldValue=field.getValue(iQuery.getFilter());
      if (fieldValue != null) {
        if (fieldValue instanceof Collection<?> || fieldValue instanceof Map<?,?>)         continue;
        if (fieldValue instanceof String && ((String)fieldValue).length() == 0)         continue;
        if (String.class.equals(field.getLanguageType()))         operator=QueryByFilter.FIELD_LIKE;
 else         operator=QueryByFilter.FIELD_EQUALS;
        filter.addItem(field.getName(),operator,fieldValue);
      }
    }
  }
  QueryByFilter addFilter=iQuery.getAdditionalFilter();
  if (addFilter != null) {
    filter.setSubClasses(addFilter.isSubClasses());
    filter.merge(addFilter);
  }
  return filter;
}
Program: 24464
Project: 24464
Buggy source:
@Test public void testGenerateGroup(){
  JPQLQueryEngine qe=new JPQLQueryEngine();
  QueryByFilter qbf=new QueryByFilter(Roma.class);
  qbf.addItem("String_Node_Str",QueryOperator.EQUALS,true);
  QueryByFilterItemGroup group=qbf.addGroup(QueryByFilterItemGroup.PREDICATE_OR);
  group.addItem("String_Node_Str",QueryOperator.EQUALS,new Object());
  group.addItem("String_Node_Str",QueryOperator.EQUALS,new Object());
  StringBuilder query=new StringBuilder();
  Map<String,Object> params=new HashMap<String,Object>();
  List<String> project=new ArrayList<String>();
  qe.buildQuery(qbf,query,params,project);
  Assert.assertEquals(replaceSpaces("String_Node_Str"),replaceSpaces(query.toString()));
  Assert.assertEquals(params.size(),3);
}

Fixed version (ground truth):
@Test public void testGenerateGroup(){
  JPQLQueryEngine qe=new JPQLQueryEngine();
  QueryByFilter qbf=new QueryByFilter(Roma.class);
  qbf.addItem("String_Node_Str",QueryOperator.EQUALS,true);
  QueryByFilterItemGroup group=qbf.addGroup(QueryByFilterItemGroup.PREDICATE_OR);
  group.addItem("String_Node_Str",QueryOperator.EQUALS,new Object());
  group.addItem("String_Node_Str",QueryOperator.EQUALS,new Object());
  qbf.addItem(group);
  StringBuilder query=new StringBuilder();
  Map<String,Object> params=new HashMap<String,Object>();
  List<String> project=new ArrayList<String>();
  qe.buildQuery(qbf,query,params,project);
  Assert.assertEquals(replaceSpaces("String_Node_Str"),replaceSpaces(query.toString()));
  Assert.assertEquals(params.size(),3);
}
Program: 24465
Project: 24465
Buggy source:
@Override public void deleteSelection(){
  if (this.selectionRecord.numSelected() > 0) {
    commandStack.execute(new DeleteSelectionCommand(selectionRecord.getSubgraphSelection()));
    selectionRecord.clear();
    shapePane.updateView();
  }
}

Fixed version (ground truth):
@Override public void deleteSelection(){
  if (this.selectionRecord.numSelected() > 0) {
    commandStack.execute(new DeleteSelectionCommand(selectionRecord.getEdgeIncludedSelection()));
    selectionRecord.clear();
    shapePane.updateView();
  }
}
Program: 24466
Project: 24466
Buggy source:
private void deleteSelection(){
  this.commandStack.execute(new DeleteSelectionCommand(this.selectionRecord.getSubgraphSelection()));
}

Fixed version (ground truth):
private void deleteSelection(){
  this.commandStack.execute(new DeleteSelectionCommand(this.selectionRecord.getEdgeIncludedSelection()));
}
Program: 24467
Project: 24467
Buggy source:
private void deleteSelection(){
  this.commandStack.execute(new DeleteSelectionCommand(this.selectionRecord.getSubgraphSelection()));
}

Fixed version (ground truth):
private void deleteSelection(){
  this.commandStack.execute(new DeleteSelectionCommand(this.selectionRecord.getEdgeIncludedSelection()));
}
Program: 24468
Project: 24468
Buggy source:
@Override public void newDiagram(){
  String selection=(String)JOptionPane.showInputDialog(this.visualEditor,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,nsMap.keySet().toArray(),"String_Node_Str");
  INotationSubsystem selectedNs=nsMap.get(selection);
  this.canvasPersistenceManager.createNewModelStream(selectedNs,"String_Node_Str");
  this.currentFile=null;
  renderModel();
}

Fixed version (ground truth):
@Override public void newDiagram(){
  String selection=(String)JOptionPane.showInputDialog(this.visualEditor,"String_Node_Str","String_Node_Str",JOptionPane.PLAIN_MESSAGE,null,nsMap.keySet().toArray(),"String_Node_Str");
  if (selection != null) {
    INotationSubsystem selectedNs=nsMap.get(selection);
    this.canvasPersistenceManager.createNewModelStream(selectedNs,"String_Node_Str");
    this.currentFile=null;
    renderModel();
  }
}
Program: 24469
Project: 24469
Buggy source:
@Override public void drawString(String text,double x,double y,GraphicalTextAlignment align){
  this.setLineColour();
  this.setStroke();
  Font f=g.getFont();
  TextLayout layout=new TextLayout(text,f,g.getFontRenderContext());
  Rectangle2D textBounds=layout.getBounds();
  Point2D.Double p=getAlignedTextPosition(align,x,y,textBounds);
  p.setLocation(p.getX(),p.getY() + textBounds.getHeight());
  layout.draw(g,(float)p.getX(),(float)p.getY());
  if (logger.isDebugEnabled()) {
    logger.debug("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ text);
  }
}

Fixed version (ground truth):
@Override public void drawString(String text,double x,double y,GraphicalTextAlignment align){
  if (!text.isEmpty()) {
    this.setLineColour();
    this.setStroke();
    Font f=g.getFont();
    TextLayout layout=new TextLayout(text,f,g.getFontRenderContext());
    Rectangle2D textBounds=layout.getBounds();
    Point2D.Double p=getAlignedTextPosition(align,x,y,textBounds);
    p.setLocation(p.getX(),p.getY() + textBounds.getHeight());
    layout.draw(g,(float)p.getX(),(float)p.getY());
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ text);
    }
  }
}
Program: 24470
Project: 24470
Buggy source:
protected CommonLabelController(IViewControllerModel viewModel,ILabelNode node,int index){
  super(viewModel,index);
  this.domainNode=node;
  this.isActive=false;
  this.controller=createController(node.getAttribute());
  drawingNodePropertyChangeListener=new ICanvasAttributeChangeListener(){
    @Override public void propertyChange(    ICanvasAttributePropertyChangeEvent e){
      if (e.getPropertyChange().equals(CanvasAttributePropertyChange.BOUNDS)) {
        Envelope oldDrawnBounds=getFigureController().getConvexHull().getEnvelope();
        IDrawingNodeAttribute attribute=(IDrawingNodeAttribute)e.getAttribute();
        getFigureController().setRequestedEnvelope(attribute.getBounds());
        getFigureController().generateFigureDefinition();
        notifyDrawnBoundsChanged(oldDrawnBounds,getFigureController().getConvexHull().getEnvelope());
      }
    }
    @Override public void elementTranslated(    ICanvasAttributeTranslationEvent e){
    }
    @Override public void nodeResized(    ICanvasAttributeResizedEvent e){
    }
  }
;
  propertyValueChangeListener=new IAnnotationPropertyChangeListener(){
    @Override public void propertyChange(    IAnnotationPropertyChangeEvent e){
      getFigureController().setBindString(LABEL_TEXT,domainNode.getAttribute().getDisplayedContent());
      getFigureController().generateFigureDefinition();
    }
  }
;
}

Fixed version (ground truth):
protected CommonLabelController(IViewControllerModel viewModel,ILabelNode node,int index){
  super(viewModel,index);
  this.domainNode=node;
  this.isActive=false;
  this.controller=createController(node.getAttribute());
  drawingNodePropertyChangeListener=new ICanvasAttributeChangeListener(){
    @Override public void propertyChange(    ICanvasAttributePropertyChangeEvent e){
      if (e.getPropertyChange().equals(CanvasAttributePropertyChange.BOUNDS)) {
        Envelope oldDrawnBounds=getFigureController().getConvexHull().getEnvelope();
        IDrawingNodeAttribute attribute=(IDrawingNodeAttribute)e.getAttribute();
        getFigureController().setRequestedEnvelope(attribute.getBounds());
        getFigureController().generateFigureDefinition();
        notifyDrawnBoundsChanged(oldDrawnBounds,getFigureController().getConvexHull().getEnvelope());
      }
    }
    @Override public void elementTranslated(    ICanvasAttributeTranslationEvent e){
    }
    @Override public void nodeResized(    ICanvasAttributeResizedEvent e){
    }
  }
;
  propertyValueChangeListener=new IAnnotationPropertyChangeListener(){
    @Override public void propertyChange(    IAnnotationPropertyChangeEvent e){
      String text=domainNode.getAttribute().getDisplayedContent();
      getFigureController().setBindString(LABEL_TEXT,text);
      Dimension textExtent=MIN_LABEL_SIZE;
      if (!text.isEmpty()) {
        textExtent=handleGetTextBounds(text);
      }
      Envelope newBounds=adjustForDefaultTextLength(getConvexHull().getCentre(),textExtent);
      getFigureController().setRequestedEnvelope(newBounds);
      getFigureController().generateFigureDefinition();
    }
  }
;
}
Program: 24471
Project: 24471
Buggy source:
@Override public void propertyChange(IAnnotationPropertyChangeEvent e){
  getFigureController().setBindString(LABEL_TEXT,domainNode.getAttribute().getDisplayedContent());
  getFigureController().generateFigureDefinition();
}

Fixed version (ground truth):
@Override public void propertyChange(IAnnotationPropertyChangeEvent e){
  String text=domainNode.getAttribute().getDisplayedContent();
  getFigureController().setBindString(LABEL_TEXT,text);
  Dimension textExtent=MIN_LABEL_SIZE;
  if (!text.isEmpty()) {
    textExtent=handleGetTextBounds(text);
  }
  Envelope newBounds=adjustForDefaultTextLength(getConvexHull().getCentre(),textExtent);
  getFigureController().setRequestedEnvelope(newBounds);
  getFigureController().generateFigureDefinition();
}
Program: 24475
Project: 24475
Buggy source:
public void openFile(File file){
  try {
    INotationSubsystemPool subsystemPool=new NotationSubsystemPool();
    IXmlPersistenceManager canvasPersistenceManager=new FileXmlCanvasPersistenceManager(subsystemPool);
    InputStream in=new FileInputStream(file);
    canvasPersistenceManager.readCanvasFromStream(in);
    in.close();
    insp.renderModel(canvasPersistenceManager.getCurrentModel());
  }
 catch (  IOException ex) {
    System.err.println("String_Node_Str");
    System.err.println();
  }
}

Fixed version (ground truth):
public void openFile(File file){
  try {
    IXmlPersistenceManager canvasPersistenceManager=new FileXmlCanvasPersistenceManager(subsystemPool);
    InputStream in=new FileInputStream(file);
    canvasPersistenceManager.readCanvasFromStream(in);
    in.close();
    insp.renderModel(canvasPersistenceManager.getCurrentModel());
  }
 catch (  IOException ex) {
    System.err.println("String_Node_Str");
    System.err.println();
  }
}
Program: 24477
Project: 24477
Buggy source:
public VisualEditor(String title){
  super(title);
  this.setLayout(new BorderLayout());
  this.menuBar=new JMenuBar();
  initFileMenu();
  this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  this.addWindowListener(new WindowListener(){
    @Override public void windowActivated(    WindowEvent e){
    }
    @Override public void windowClosed(    WindowEvent e){
    }
    @Override public void windowClosing(    WindowEvent e){
      int reply=JOptionPane.showConfirmDialog(VisualEditor.this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
      if (reply == JOptionPane.YES_OPTION) {
        System.exit(0);
      }
    }
    @Override public void windowDeactivated(    WindowEvent e){
    }
    @Override public void windowDeiconified(    WindowEvent e){
    }
    @Override public void windowIconified(    WindowEvent e){
    }
    @Override public void windowOpened(    WindowEvent e){
    }
  }
);
  this.setJMenuBar(menuBar);
  this.insp=new PathwayEditor();
  this.insp.setPreferredSize(new Dimension(WIDTH,HEIGHT));
  this.add(this.insp,BorderLayout.CENTER);
  this.pack();
  this.setLocationByPlatform(true);
  this.setVisible(true);
}

Fixed version (ground truth):
public VisualEditor(String title){
  super(title);
  this.setLayout(new BorderLayout());
  this.menuBar=new JMenuBar();
  initFileMenu();
  this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
  this.addWindowListener(new WindowListener(){
    @Override public void windowActivated(    WindowEvent e){
    }
    @Override public void windowClosed(    WindowEvent e){
    }
    @Override public void windowClosing(    WindowEvent e){
      int reply=JOptionPane.showConfirmDialog(VisualEditor.this,"String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION);
      if (reply == JOptionPane.YES_OPTION) {
        System.exit(0);
      }
    }
    @Override public void windowDeactivated(    WindowEvent e){
    }
    @Override public void windowDeiconified(    WindowEvent e){
    }
    @Override public void windowIconified(    WindowEvent e){
    }
    @Override public void windowOpened(    WindowEvent e){
    }
  }
);
  this.setJMenuBar(menuBar);
  this.insp=new PathwayEditor();
  this.insp.setPreferredSize(new Dimension(WIDTH,HEIGHT));
  this.add(this.insp,BorderLayout.CENTER);
  this.pack();
  this.setLocationByPlatform(true);
  this.setVisible(true);
  subsystemPool=new NotationSubsystemPool();
  this.nsMap=new HashMap<String,INotationSubsystem>();
  Iterator<INotationSubsystem> notIter=subsystemPool.subsystemIterator();
  while (notIter.hasNext()) {
    INotationSubsystem ns=notIter.next();
    this.nsMap.put(ns.getNotation().getDisplayName(),ns);
  }
}
Program: 24478
Project: 24478
Buggy source:
@Override public void deactivate(){
  this.currentStateController.deactivate(shapePane);
  this.currentStateController.removeViewBehaviourStateHandlerChangeListener(this.viewBehaviourSelectionStateHandlerChangeListener);
  this.activated=false;
}

Fixed version (ground truth):
@Override public void deactivate(){
  this.shapeCreationStateController.removeViewBehaviourStateHandlerChangeListener(this.viewBehaviourShapeCreationStateHandlerChangeListener);
  this.linkCreationStateController.removeViewBehaviourStateHandlerChangeListener(this.viewBehaviourLinkCreationStateHandlerChangeListener);
  this.selectionStateController.removeViewBehaviourStateHandlerChangeListener(this.viewBehaviourSelectionStateHandlerChangeListener);
  this.currentStateController.deactivate(shapePane);
  this.activated=false;
}
Program: 24479
Project: 24479
Buggy source:
@Override public void activate(){
  this.setSelectionMode();
  this.shapeCreationStateController.addViewBehaviourStateHandlerChangeListener(this.viewBehaviourShapeCreationStateHandlerChangeListener);
  this.linkCreationStateController.addViewBehaviourStateHandlerChangeListener(this.viewBehaviourLinkCreationStateHandlerChangeListener);
  this.selectionStateController.addViewBehaviourStateHandlerChangeListener(this.viewBehaviourSelectionStateHandlerChangeListener);
  this.activated=true;
}

Fixed version (ground truth):
@Override public void activate(){
  this.currentStateController.activate(shapePane);
  this.shapeCreationStateController.addViewBehaviourStateHandlerChangeListener(this.viewBehaviourShapeCreationStateHandlerChangeListener);
  this.linkCreationStateController.addViewBehaviourStateHandlerChangeListener(this.viewBehaviourLinkCreationStateHandlerChangeListener);
  this.selectionStateController.addViewBehaviourStateHandlerChangeListener(this.viewBehaviourSelectionStateHandlerChangeListener);
  this.activated=true;
}
Program: 24480
Project: 24480
Buggy source:
@Override public void execute(){
  ICompoundGraph graph=this.srcShape.getGraphElement().getGraph();
  this.originalState=graph.getCurrentState();
  ILinkEdgeFactory fact=new LinkEdgeFactoryFacade(graph.edgeFactory());
  fact.setShapeNodePair(srcShape,tgtShape);
  fact.setObjectType(linkObjectType);
  ILinkEdge link=fact.createLinkEdge();
  ILinkAttribute linkAttribute=link.getAttribute();
  linkAttribute.getSourceTerminus().setLocation(linkPointDefinition.getSrcAnchorPosition());
  linkAttribute.getTargetTerminus().setLocation(linkPointDefinition.getTgtAnchorPosition());
  Iterator<Point> ptIter=linkPointDefinition.pointIterator();
  IBendPointContainer bpContainer=linkAttribute.getBendPointContainer();
  while (ptIter.hasNext()) {
    Point pt=ptIter.next();
    bpContainer.createNewBendPoint(pt);
  }
  this.createdState=graph.getCurrentState();
}

Fixed version (ground truth):
@Override public void execute(){
  ICompoundGraph graph=this.srcShape.getGraphElement().getGraph();
  this.originalState=graph.getCurrentState();
  ILinkEdgeFactory fact=new LinkEdgeFactoryFacade(graph.edgeFactory());
  fact.setShapeNodePair(srcShape,tgtShape);
  fact.setObjectType(linkObjectType);
  ILinkEdge link=fact.createLinkEdge();
  ILinkAttribute linkAttribute=link.getAttribute();
  linkAttribute.getSourceTerminus().setLocation(linkPointDefinition.getSrcAnchorPosition());
  linkAttribute.getTargetTerminus().setLocation(linkPointDefinition.getTgtAnchorPosition());
  Iterator<Point> ptIter=linkPointDefinition.bendPointIterator();
  IBendPointContainer bpContainer=linkAttribute.getBendPointContainer();
  while (ptIter.hasNext()) {
    Point pt=ptIter.next();
    bpContainer.createNewBendPoint(pt);
  }
  this.createdState=graph.getCurrentState();
}
Program: 24481
Project: 24481
Buggy source:
@Override public Envelope getCanvasBounds(){
  double minX=Double.MAX_VALUE;
  double maxX=Double.MIN_VALUE;
  double minY=Double.MAX_VALUE;
  double maxY=Double.MIN_VALUE;
  Iterator<INodeController> nodeIter=this.nodeControllerIterator();
  while (nodeIter.hasNext()) {
    INodeController nodeController=nodeIter.next();
    if (!(nodeController instanceof IRootController)) {
      Point nodeOrigin=nodeController.getConvexHull().getEnvelope().getOrigin();
      minX=Math.min(minX,nodeOrigin.getX());
      minY=Math.min(minY,nodeOrigin.getY());
      Point nodeDiagonal=nodeController.getConvexHull().getEnvelope().getDiagonalCorner();
      maxX=Math.max(maxX,nodeDiagonal.getX());
      maxY=Math.max(maxY,nodeDiagonal.getY());
    }
  }
  Iterator<ILinkController> edgeIter=this.linkControllerIterator();
  while (edgeIter.hasNext()) {
    ILinkController linkController=edgeIter.next();
    ILinkPointDefinition defn=linkController.getLinkDefinition();
    Iterator<Point> pointIter=defn.pointIterator();
    while (pointIter.hasNext()) {
      Point linkPoint=pointIter.next();
      minX=Math.min(minX,linkPoint.getX());
      minY=Math.min(minY,linkPoint.getY());
      maxX=Math.max(maxX,linkPoint.getX());
      maxY=Math.max(maxY,linkPoint.getY());
    }
  }
  return new Envelope(minX,minY,maxX - minX,maxY - minY);
}

Fixed version (ground truth):
@Override public Envelope getCanvasBounds(){
  Envelope retVal=DEFAULT_CANVAS_BOUNDS;
  double minX=Double.MAX_VALUE;
  double maxX=-Double.MAX_VALUE;
  double minY=Double.MAX_VALUE;
  double maxY=-Double.MAX_VALUE;
  Iterator<INodeController> nodeIter=this.nodeControllerIterator();
  boolean onlyRoot=true;
  while (nodeIter.hasNext()) {
    INodeController nodeController=nodeIter.next();
    if (!(nodeController instanceof IRootController)) {
      onlyRoot=false;
      Point nodeOrigin=nodeController.getConvexHull().getEnvelope().getOrigin();
      minX=Math.min(minX,nodeOrigin.getX());
      minY=Math.min(minY,nodeOrigin.getY());
      Point nodeDiagonal=nodeController.getConvexHull().getEnvelope().getDiagonalCorner();
      maxX=Math.max(maxX,nodeDiagonal.getX());
      maxY=Math.max(maxY,nodeDiagonal.getY());
    }
  }
  if (!onlyRoot) {
    Iterator<ILinkController> edgeIter=this.linkControllerIterator();
    while (edgeIter.hasNext()) {
      ILinkController linkController=edgeIter.next();
      ILinkPointDefinition defn=linkController.getLinkDefinition();
      Iterator<Point> pointIter=defn.pointIterator();
      while (pointIter.hasNext()) {
        Point linkPoint=pointIter.next();
        minX=Math.min(minX,linkPoint.getX());
        minY=Math.min(minY,linkPoint.getY());
        maxX=Math.max(maxX,linkPoint.getX());
        maxY=Math.max(maxY,linkPoint.getY());
      }
    }
    retVal=new Envelope(minX,minY,maxX - minX,maxY - minY);
  }
  return retVal;
}
Program: 24482
Project: 24482
Buggy source:
@Override public void updateView(Envelope refreshBounds){
  Envelope updateBounds=refreshBounds.deltaResize(-RESIZE_DIM,-RESIZE_DIM,2 * RESIZE_DIM,2 * RESIZE_DIM);
  Dimension prefSize=new Dimension();
  prefSize.setSize(canvasBounds.getDimension().getWidth() + 2 * PANE_BORDER,canvasBounds.getDimension().getHeight() + 2 * PANE_BORDER);
  this.setPreferredSize(prefSize);
  Rectangle bounds=getAdjustedBounds(updateBounds);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + updateBounds + "String_Node_Str"+ bounds);
  }
  revalidate();
  repaint();
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + this.isFocusable());
    logger.trace("String_Node_Str" + this.hasFocus());
  }
}

Fixed version (ground truth):
@Override public void updateView(Envelope refreshBounds){
  Dimension prefSize=new Dimension();
  prefSize.setSize(canvasBounds.getDimension().getWidth() + 2 * PANE_BORDER,canvasBounds.getDimension().getHeight() + 2 * PANE_BORDER);
  this.setPreferredSize(prefSize);
  revalidate();
  repaint();
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + this.isFocusable());
    logger.trace("String_Node_Str" + this.hasFocus());
  }
}
Program: 24483
Project: 24483
Buggy source:
@Override public void startCreationDrag(Point origin){
  this.canCreationSucceed=false;
  this.startLocation=origin;
  calculateBounds(origin);
  feedbackModel.clear();
  IFeedbackNode node=feedbackModel.getFeedbackNodeBuilder().createFromDrawingNodeObjectType(this.shapeObjectType,new Envelope(origin,new Dimension(0.1,0.1)));
  node.setLineColour(RGB.RED);
  node.setLineStyle(LineStyle.SOLID);
  node.setLineWidth(1.0);
  this.shapePane.updateView();
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + origin);
  }
}

Fixed version (ground truth):
@Override public void startCreationDrag(Point origin){
  this.canCreationSucceed=false;
  this.startLocation=origin;
  calculateBounds(origin);
  feedbackModel.clear();
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str" + origin);
  }
  IFeedbackNode node=feedbackModel.getFeedbackNodeBuilder().createFromDrawingNodeObjectType(this.shapeObjectType,new Envelope(origin,new Dimension(0.1,0.1)));
  node.setLineColour(RGB.RED);
  node.setLineStyle(LineStyle.SOLID);
  node.setLineWidth(1.0);
  this.shapePane.updateView();
}
Program: 24484
Project: 24484
Buggy source:
@Override public Envelope getBounds(){
  double minX=Double.MAX_VALUE;
  double maxX=Double.MIN_VALUE;
  double minY=Double.MAX_VALUE;
  double maxY=Double.MIN_VALUE;
  final double halfLineHeight=this.lineWidth + LINE_HIT_TOLERENCE;
  Iterator<Point> pointIter=this.pointList.iterator();
  while (pointIter.hasNext()) {
    Point p=pointIter.next();
    minX=Math.min(minX,p.getX() - halfLineHeight);
    maxX=Math.max(maxX,p.getX() + halfLineHeight);
    minY=Math.min(minY,p.getY() - halfLineHeight);
    maxY=Math.max(maxY,p.getY() + halfLineHeight);
  }
  return new Envelope(minX,minY,maxX - minX,maxY - minY);
}

Fixed version (ground truth):
@Override public Envelope getBounds(){
  double minX=Double.MAX_VALUE;
  double maxX=-Double.MAX_VALUE;
  double minY=Double.MAX_VALUE;
  double maxY=-Double.MAX_VALUE;
  final double halfLineHeight=this.lineWidth + LINE_HIT_TOLERENCE;
  Iterator<Point> pointIter=this.pointList.iterator();
  while (pointIter.hasNext()) {
    Point p=pointIter.next();
    minX=Math.min(minX,p.getX());
    maxX=Math.max(maxX,p.getX());
    minY=Math.min(minY,p.getY());
    maxY=Math.max(maxY,p.getY());
  }
  return new Envelope(minX - halfLineHeight,minY - halfLineHeight,maxX - minX + halfLineHeight,maxY - minY + halfLineHeight);
}
Program: 24485
Project: 24485
Buggy source:
@Override public boolean containsPoint(Point p){
  boolean retVal=false;
  Iterator<LineSegment> lineSegIter=this.lineSegIterator();
  while (lineSegIter.hasNext() && !retVal) {
    LineSegment seg=lineSegIter.next();
    retVal=seg.intersectsWithCircle(p,LINE_HIT_TOLERENCE);
    if (logger.isTraceEnabled() && retVal) {
      logger.trace("String_Node_Str" + p + "String_Node_Str"+ seg);
    }
  }
  return retVal;
}

Fixed version (ground truth):
@Override public boolean containsPoint(Point p){
  boolean retVal=false;
  Iterator<LineSegment> lineSegIter=this.lineSegIterator();
  while (lineSegIter.hasNext() && !retVal) {
    LineSegment seg=lineSegIter.next();
    retVal=seg.intersectsWithCircle(p,MOUSE_HOT_SPHERE_RADIUS);
    if (logger.isTraceEnabled() && retVal) {
      logger.trace("String_Node_Str" + p + "String_Node_Str"+ seg);
    }
  }
  return retVal;
}
Program: 24487
Project: 24487
Buggy source:
@Override public void inactivate(){
  this.linkAttribute.getAttribute().getSourceTerminus().removeLinkTerminusChangeListener(srcTermChangeListener);
  this.linkAttribute.getAttribute().getTargetTerminus().removeLinkTerminusChangeListener(tgtTermChangeListener);
  this.linkAttribute.getAttribute().getBendPointContainer().removeChangeListener(this.bpChangeListener);
  this.parentAttribute.removeChangeListener(parentDrawingElementPropertyChangeListener);
  this.isActive=false;
}

Fixed version (ground truth):
@Override public void inactivate(){
  this.linkAttribute.getAttribute().getSourceTerminus().removeLinkTerminusChangeListener(srcTermChangeListener);
  this.linkAttribute.getAttribute().getTargetTerminus().removeLinkTerminusChangeListener(tgtTermChangeListener);
  this.linkAttribute.getAttribute().getBendPointContainer().removeChangeListener(this.bpChangeListener);
  this.parentAttribute.removeChangeListener(parentDrawingElementPropertyChangeListener);
  this.linkAttribute.getAttribute().removeChangeListener(linkAttributePropertyChangeListener);
  ((IShapeAttribute)this.linkAttribute.getSourceShape().getAttribute()).removeChangeListener(srcNodeListener);
  ((IShapeAttribute)this.linkAttribute.getTargetShape().getAttribute()).removeChangeListener(tgtNodeListener);
  this.isActive=false;
}
Program: 24488
Project: 24488
Buggy source:
@Override public void elementTranslated(ICanvasAttributeTranslationEvent e){
  linkAttribute.getAttribute().translate(e.getTranslationDelta());
}

Fixed version (ground truth):
@Override public void elementTranslated(ICanvasAttributeTranslationEvent e){
}
Program: 24489
Project: 24489
Buggy source:
@Override public void activate(){
  this.parentAttribute.addChangeListener(parentDrawingElementPropertyChangeListener);
  this.linkAttribute.getAttribute().getSourceTerminus().addLinkTerminusChangeListener(srcTermChangeListener);
  this.linkAttribute.getAttribute().getTargetTerminus().addLinkTerminusChangeListener(tgtTermChangeListener);
  this.linkAttribute.getAttribute().getBendPointContainer().addChangeListener(this.bpChangeListener);
  this.isActive=true;
}

Fixed version (ground truth):
@Override public void activate(){
  this.parentAttribute.addChangeListener(parentDrawingElementPropertyChangeListener);
  this.linkAttribute.getAttribute().getSourceTerminus().addLinkTerminusChangeListener(srcTermChangeListener);
  this.linkAttribute.getAttribute().getTargetTerminus().addLinkTerminusChangeListener(tgtTermChangeListener);
  this.linkAttribute.getAttribute().getBendPointContainer().addChangeListener(this.bpChangeListener);
  this.linkAttribute.getAttribute().addChangeListener(linkAttributePropertyChangeListener);
  ((IShapeAttribute)this.linkAttribute.getSourceShape().getAttribute()).addChangeListener(srcNodeListener);
  ((IShapeAttribute)this.linkAttribute.getTargetShape().getAttribute()).addChangeListener(tgtNodeListener);
  this.isActive=true;
}
Program: 24490
Project: 24490
Buggy source:
@Override public void propertyChange(IBendPointChangeEvent e){
  Envelope originalDrawnBounds=getDrawnBounds();
  if (e.getChangeType().equals(BendPointChange.BEND_POINT_ADDED)) {
    int bpIdx=e.getNewIndexPos();
    Point bpPosn=e.getBendPoint();
    linkDefinition.addNewBendPoint(bpIdx,bpPosn);
    updateLinksToBendPoints(bpIdx,bpPosn);
  }
 else   if (e.getChangeType().equals(BendPointChange.BEND_POINT_REMOVED)) {
    int bpIdx=e.getOldIndexPos();
    linkDefinition.removeBendPoint(bpIdx);
    if (bpIdx < linkDefinition.numBendPoints()) {
      Point bpPosn=linkAttribute.getAttribute().getBendPointContainer().getBendPoint(bpIdx);
      updateLinksToBendPoints(bpIdx,bpPosn);
    }
 else     if (linkDefinition.numBendPoints() == 0) {
      updateAnchorPoints();
    }
 else {
      int lastBpIdx=linkDefinition.numBendPoints() - 1;
      Point bpPosn=linkAttribute.getAttribute().getBendPointContainer().getBendPoint(lastBpIdx);
      updateLinksToBendPoints(lastBpIdx,bpPosn);
    }
  }
  notifyDrawnBoundsChanged(originalDrawnBounds,getDrawnBounds());
}

Fixed version (ground truth):
@Override public void propertyChange(ICanvasAttributePropertyChangeEvent e){
  if (e.getPropertyChange().equals(CanvasAttributePropertyChange.BOUNDS)) {
    if (!e.getAttribute().equals(parentAttribute)) {
      updateAnchorPoints();
    }
  }
}
Program: 24492
Project: 24492
Buggy source:
private IFigureController createLabelController(ILabelAttribute attribute){
  IFigureController figureController=new FigureController(FigureCompilationCache.getInstance().lookup(LABEL_DEFINITION));
  figureController.setRequestedEnvelope(attribute.getBounds());
  figureController.setFillColour(attribute.getBackgroundColor());
  figureController.setLineColour(attribute.getForegroundColor());
  figureController.setLineStyle(attribute.getLineStyle());
  figureController.setLineWidth(attribute.getLineWidth());
  figureController.setBindDouble("String_Node_Str",10.0);
  figureController.setBindString("String_Node_Str",attribute.getProperty().getValue().toString());
  figureController.setBindBoolean("String_Node_Str",attribute.hasNoBorder());
  figureController.generateFigureDefinition();
  return figureController;
}

Fixed version (ground truth):
private IFigureController createLabelController(ILabelAttribute attribute){
  IFigureController figureController=new FigureController(FigureCompilationCache.getInstance().lookup(LABEL_DEFINITION));
  figureController.setRequestedEnvelope(attribute.getBounds());
  figureController.setFillColour(attribute.getBackgroundColor());
  figureController.setLineColour(attribute.getForegroundColor());
  figureController.setLineStyle(attribute.getLineStyle());
  figureController.setLineWidth(attribute.getLineWidth());
  figureController.setBindDouble("String_Node_Str",10.0);
  figureController.setBindString("String_Node_Str",attribute.getDisplayedContent());
  figureController.setBindBoolean("String_Node_Str",attribute.hasNoBorder());
  figureController.generateFigureDefinition();
  return figureController;
}