Program: 143705
Project: 143705
Buggy source:
/** 
 * @see javax.swing.event.TableModelListener#tableChanged(javax.swing.event.TableModelEvent)
 */
public void tableChanged(TableModelEvent e){
  if (e.getType() == TableModelEvent.UPDATE && e.getFirstRow() == e.getLastRow()) {
    Component component=table.get(Integer.toString(e.getFirstRow()));
    if (component instanceof ListItem) {
      ((ListItem)component).visitChildren(IProviderStylePropertyChanges.class,new IVisitor<Component>(){
        public Object component(        Component comp){
          ((IProviderStylePropertyChanges)comp).getStylePropertyChanges().setChanged();
          return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
        }
      }
);
      IModel<IRecordInternal> newModel=table.getListItemModel(table.getModel(),e.getFirstRow());
      IModel oldModel=((ListItem)component).getModel();
      if (newModel != null && oldModel != null && newModel.getObject() != null && !newModel.getObject().equals(oldModel.getObject())) {
        ((ListItem)component).setModel(newModel);
      }
    }
  }
 else {
    if (!isScrollMode())     getStylePropertyChanges().setChanged();
  }
  if (currentData != null && e.getColumn() == TableModelEvent.ALL_COLUMNS && e.getFirstRow() == 0 && elementToColumnHeader.size() > 0) {
    List<SortColumn> sortCols=currentData.getSortColumns();
    if (sortCols != null && sortCols.size() > 0) {
      Map<String,Boolean> sortMap=new HashMap<String,Boolean>();
      for (      IPersist persist : elementToColumnHeader.keySet()) {
        SortableCellViewHeader sortableCellViewHeader=(SortableCellViewHeader)elementToColumnHeader.get(persist);
        sortableCellViewHeader.setResizeImage(R_ARROW_OFF);
      }
      for (      SortColumn sc : sortCols) {
        for (        IPersist persist : elementToColumnHeader.keySet()) {
          Component comp=elementToColumnIdentifierComponent.get(persist);
          SortableCellViewHeader sortableCellViewHeader=(SortableCellViewHeader)elementToColumnHeader.get(persist);
          if (comp instanceof IDisplayData) {
            IDisplayData dispComp=(IDisplayData)comp;
            if (sc.getDataProviderID().equals(dispComp.getDataProviderID())) {
              boolean descending=sc.getSortOrder() == SortColumn.DESCENDING;
              sortableCellViewHeader.setResizeImage(descending ? R_ARROW_UP : R_ARROW_DOWN);
              sortMap.put(comp.getMarkupId(),Boolean.valueOf(!descending));
            }
          }
        }
      }
      headers.recordSort(sortMap);
    }
  }
}

Fixed version (ground truth):
/** 
 * @see javax.swing.event.TableModelListener#tableChanged(javax.swing.event.TableModelEvent)
 */
public void tableChanged(TableModelEvent e){
  if (e.getType() == TableModelEvent.UPDATE && e.getFirstRow() == e.getLastRow()) {
    Component component=table.get(Integer.toString(e.getFirstRow()));
    if (component instanceof ListItem) {
      ((ListItem)component).visitChildren(IProviderStylePropertyChanges.class,new IVisitor<Component>(){
        public Object component(        Component comp){
          ((IProviderStylePropertyChanges)comp).getStylePropertyChanges().setChanged();
          return CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
        }
      }
);
      IModel<IRecordInternal> newModel=table.getListItemModel(table.getModel(),e.getFirstRow());
      IModel oldModel=((ListItem)component).getModel();
      if (newModel != null && oldModel != null && newModel.getObject() != null && !newModel.getObject().equals(oldModel.getObject())) {
        ((ListItem)component).setModel(newModel);
      }
    }
  }
 else {
    if (!isScrollMode() || !(scrollBehavior != null && scrollBehavior.isGettingRows()))     getStylePropertyChanges().setChanged();
  }
  if (currentData != null && e.getColumn() == TableModelEvent.ALL_COLUMNS && e.getFirstRow() == 0 && elementToColumnHeader.size() > 0) {
    List<SortColumn> sortCols=currentData.getSortColumns();
    if (sortCols != null && sortCols.size() > 0) {
      Map<String,Boolean> sortMap=new HashMap<String,Boolean>();
      for (      IPersist persist : elementToColumnHeader.keySet()) {
        SortableCellViewHeader sortableCellViewHeader=(SortableCellViewHeader)elementToColumnHeader.get(persist);
        sortableCellViewHeader.setResizeImage(R_ARROW_OFF);
      }
      for (      SortColumn sc : sortCols) {
        for (        IPersist persist : elementToColumnHeader.keySet()) {
          Component comp=elementToColumnIdentifierComponent.get(persist);
          SortableCellViewHeader sortableCellViewHeader=(SortableCellViewHeader)elementToColumnHeader.get(persist);
          if (comp instanceof IDisplayData) {
            IDisplayData dispComp=(IDisplayData)comp;
            if (sc.getDataProviderID().equals(dispComp.getDataProviderID())) {
              boolean descending=sc.getSortOrder() == SortColumn.DESCENDING;
              sortableCellViewHeader.setResizeImage(descending ? R_ARROW_UP : R_ARROW_DOWN);
              sortMap.put(comp.getMarkupId(),Boolean.valueOf(!descending));
            }
          }
        }
      }
      headers.recordSort(sortMap);
    }
  }
}