Buggy code:
@ Component public class PurchasePaymentPaymentAdjustmentsTableModel extends AbstractTableModel { private static final String [ ] columnNames = new String [ ] { "Adjustment<seq2seq4repair_space>Type" , "Reference<seq2seq4repair_space>No." , "Amount" } ; @ Autowired private PurchasePaymentService purchasePaymentService ; @ Autowired private PurchasePaymentAdjustmentService purchasePaymentAdjustmentService ; @ Autowired private PurchasePaymentAdjustmentTypeService purchasePaymentAdjustmentTypeService ; @ Autowired private PurchaseReturnService purchaseReturnService ; @ Autowired private PurchaseReturnBadStockService purchaseReturnBadStockService ; private List < PurchasePaymentAdjustmentRowItem > rowItems = new ArrayList < > ( ) ; private PurchasePayment payment ; @ Override public int getColumnCount ( ) { } @ Override public int getRowCount ( ) { } @ Override public Object getValueAt ( int rowIndex , int columnIndex ) { } @ Override public String getColumnName ( int columnIndex ) { } public void setPurchasePayment ( PurchasePayment purchasePayment ) { } @ Override public void setValueAt ( Object value , int rowIndex , int columnIndex ) { PurchasePaymentAdjustmentRowItem rowItem = rowItems . get ( rowIndex ) ; String val = ( ( String ) ( value ) ) ; switch ( columnIndex ) { case PurchasePaymentPaymentAdjustmentsTable . ADJUSTMENT_TYPE_COLUMN_INDEX : PurchasePaymentAdjustmentType adjustmentType = purchasePaymentAdjustmentTypeService . findAdjustmentTypeByCode ( val ) ; <START_BUG> if ( ( val != null ) && ( val . equals ( rowItem . getAdjustmentType ( ) . getCode ( ) ) ) ) { <END_BUG> fireTableCellUpdated ( rowIndex , columnIndex ) ; return ; } rowItem . setAdjustmentType ( adjustmentType ) ; rowItem . setReferenceNumber ( null ) ; rowItem . setAmount ( null ) ; break ; case PurchasePaymentPaymentAdjustmentsTable . REFERENCE_NUMBER_COLUMN_INDEX : columnIndex = PaymentPaymentAdjustmentsTable . AMOUNT_COLUMN_INDEX ; if ( val . equals ( rowItem . getReferenceNumber ( ) ) ) { return ; } rowItem . setReferenceNumber ( val ) ; switch ( rowItem . getAdjustmentType ( ) . getCode ( ) ) { case PurchasePaymentAdjustmentType . PURCHASE_RETURN_GOOD_STOCK_CODE : PurchaseReturn purchaseReturn = purchaseReturnService . findPurchaseReturnByPurchaseReturnNumber ( Long . parseLong ( val ) ) ; rowItem . setAmount ( purchaseReturn . getTotalAmount ( ) ) ; break ; case PurchasePaymentAdjustmentType . PURCHASE_RETURN_BAD_STOCK_CODE : PurchaseReturnBadStock purchaseReturnBadStock = purchaseReturnBadStockService . findPurchaseReturnBadStockByPurchaseReturnBadStockNumber ( Long . parseLong ( val ) ) ; rowItem . setAmount ( purchaseReturnBadStock . getTotalAmount ( ) ) ; break ; default : PurchasePaymentAdjustment paymentAdjustment = purchasePaymentAdjustmentService . findPurchasePaymentAdjustmentByPurchasePaymentAdjustmentNumber ( Long . parseLong ( val ) ) ; rowItem . setAmount ( paymentAdjustment . getAmount ( ) ) ; break ; } break ; case PurchasePaymentPaymentAdjustmentsTable . AMOUNT_COLUMN_INDEX : String amount = ( ( String ) ( value ) ) ; if ( NumberUtil . toBigDecimal ( amount ) . equals ( rowItem . getAmount ( ) ) ) { return ; } rowItem . setAmount ( NumberUtil . toBigDecimal ( amount ) ) ; break ; } if ( rowItem . isValid ( ) ) { PurchasePaymentPaymentAdjustment adjustment = rowItem . getPaymentAdjustment ( ) ; adjustment . setAdjustmentType ( rowItem . getAdjustmentType ( ) ) ; adjustment . setReferenceNumber ( rowItem . getReferenceNumber ( ) ) ; adjustment . setAmount ( rowItem . getAmount ( ) ) ; boolean newAdjustment = ( adjustment . getId ( ) ) == null ; purchasePaymentService . save ( adjustment ) ; if ( newAdjustment ) { adjustment . getParent ( ) . getPaymentAdjustments ( ) . add ( adjustment ) ; } } fireTableCellUpdated ( rowIndex , columnIndex ) ; } @ Override public boolean isCellEditable ( int rowIndex , int columnIndex ) { } @ Override public Class < ? > getColumnClass ( int columnIndex ) { } public void addItem ( PurchasePaymentPaymentAdjustment adjustment ) { } public void reset ( int row ) { } public PurchasePaymentAdjustmentRowItem getRowItem ( int row ) { } public void removeItem ( int row ) { } public boolean hasItems ( ) { } No newline ; at end ; of file ; }

Fix:
if ( ( ( rowItem . getAdjustmentType ( ) ) != null ) && ( rowItem . getAdjustmentType ( ) . getCode ( ) . equals ( val ) ) ) {