Buggy code:
private static final int COLUMN_PRICE = 2 ; private static final int COLUMN_COST = 3 ; private JPanel panel = new JPanel ( ) ; private JTextField textField_ProductNr ; private JTextField textField_Name ; private JTextField textField_Price ; private JTextField textField_Weight ; private JTextField textField_Cost ; private JTable table_Products ; private JTextField textField_SearchProduct ; private final ButtonGroup buttonGroup = new ButtonGroup ( ) ; private JTextArea textArea_Ingredients ; private DefaultTableModel tableModel_Product ; private JRadioButton radio_Active ; private JRadioButton radio_Inactive ; private String oldProductNbr = null ; @ Override public void initialize ( ) { panel . setLayout ( null ) ; JScrollPane scrollPane = new JScrollPane ( ) ; scrollPane . setBounds ( 458 , 57 , 559 , 340 ) ; panel . add ( scrollPane ) ; textField_ProductNr = new JTextField ( ) ; textField_ProductNr . setBounds ( 158 , 57 , TEXTFIELD_WIDTH , TEXTFIELD_HEIGHT ) ; panel . add ( textField_ProductNr ) ; textField_ProductNr . setColumns ( 10 ) ; textField_Name = new JTextField ( ) ; textField_Name . setBounds ( 158 , 86 , TEXTFIELD_WIDTH , TEXTFIELD_HEIGHT ) ; panel . add ( textField_Name ) ; textField_Name . setColumns ( 10 ) ; NumberFormat numberFormat = NumberFormat . getNumberInstance ( Locale . getDefault ( ) ) ; DecimalFormat decimalFormat = ( ( DecimalFormat ) ( numberFormat ) ) ; decimalFormat . setGroupingUsed ( false ) ; textField_Price = new JFormattedTextField ( decimalFormat ) ; textField_Price . setBounds ( 158 , 115 , TEXTFIELD_WIDTH , TEXTFIELD_HEIGHT ) ; panel . add ( textField_Price ) ; textField_Price . setColumns ( 10 ) ; textField_Weight = new JTextField ( ) ; textField_Weight . setBounds ( 158 , 144 , TEXTFIELD_WIDTH , TEXTFIELD_HEIGHT ) ; panel . add ( textField_Weight ) ; textField_Weight . setColumns ( 10 ) ; textField_Cost = new JTextField ( ) ; textField_Cost . setBounds ( 158 , 173 , TEXTFIELD_WIDTH , TEXTFIELD_HEIGHT ) ; panel . add ( textField_Cost ) ; textField_Cost . setColumns ( 10 ) ; textField_SearchProduct = new JTextField ( ) ; textField_SearchProduct . setBounds ( 599 , 24 , TEXTFIELD_WIDTH , TEXTFIELD_HEIGHT ) ; panel . add ( textField_SearchProduct ) ; textField_SearchProduct . setColumns ( 10 ) ; textField_SearchProduct . getDocument ( ) . addDocumentListener ( new DocumentListener ( ) { @ Override public void removeUpdate ( DocumentEvent e ) { populateTable ( ) ; } @ Override public void insertUpdate ( DocumentEvent e ) { populateTable ( ) ; } @ Override public void changedUpdate ( DocumentEvent e ) { populateTable ( ) ; } } ) ; radio_Active = new JRadioButton ( "Ja" ) ; radio_Active . setSelected ( true ) ; buttonGroup . add ( radio_Active ) ; radio_Active . setBounds ( 158 , 269 , 43 , 23 ) ; panel . add ( radio_Active ) ; radio_Inactive = new JRadioButton ( "Nej" ) ; buttonGroup . add ( radio_Inactive ) ; radio_Inactive . setBounds ( 203 , 269 , 61 , 23 ) ; panel . add ( radio_Inactive ) ; JButton btnAddProduct = new JButton ( "Lägg<seq2seq4repair_space>till" ) ; btnAddProduct . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { String name = textField_Name . getText ( ) ; String productNbr = textField_ProductNr . getText ( ) ; String priceString = textField_Price . getText ( ) ; String costString = textField_Cost . getText ( ) ; String weightString = textField_Weight . getText ( ) ; String ingredients = textArea_Ingredients . getText ( ) ; double price = 0 ; double weight = 0 ; double cost = 0 ; try { price = Double . parseDouble ( priceString ) ; weight = Double . parseDouble ( weightString ) ; cost = Double . parseDouble ( costString ) ; } catch ( NumberFormatException exception ) { return ; } oldProductNbr = null ; <START_BUG> if ( ! ( productNbr . equals ( controller . findProduct ( productNbr ) . getProductNbr ( ) ) ) ) { <END_BUG> controller . addProduct ( productNbr , name , price , ingredients , weight , cost ) ; } else { window . showNotificationError ( ( ( "Det<seq2seq4repair_space>finns<seq2seq4repair_space>redan<seq2seq4repair_space>en<seq2seq4repair_space>produkt<seq2seq4repair_space>med<seq2seq4repair_space>produktnummer<seq2seq4repair_space>" + productNbr ) + "." ) ) ; } } } ) ; btnAddProduct . setBounds ( 12 , 307 , BUTTON_WIDTH , BUTTON_HEIGHT ) ; panel . add ( btnAddProduct ) ; JButton btnChangeProduct = new JButton ( "Ãndra" ) ; btnChangeProduct . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent e ) { String productNbr = textField_ProductNr . getText ( ) ; String name = textField_Name . getText ( ) ; String costString = textField_Cost . getText ( ) ; String priceString = textField_Price . getText ( ) ; String weightString = textField_Weight . getText ( ) ; String ingredients = textArea_Ingredients . getText ( ) ; boolean active = radio_Active . isSelected ( ) ; double cost = 0 ; double price = 0 ; double weight = 0 ; try { price = Double . parseDouble ( priceString ) ; weight = Double . parseDouble ( weightString ) ; cost = Double . parseDouble ( costString ) ; } catch ( NumberFormatException exception ) { return ; } boolean success = controller . updateProduct ( oldProductNbr , productNbr , name , price , ingredients , weight , cost , active ) ; if ( success ) { populateTable ( ) ; } } } ) ; btnChangeProduct . setBounds ( 158 , 307 , BUTTON_WIDTH , BUTTON_HEIGHT ) ; panel . add ( btnChangeProduct ) ; JButton btnClearFields = new JButton ( "Töm<seq2seq4repair_space>fälten" ) ; btnClearFields . addActionListener ( new ActionListener ( ) { @ Override public void actionPerformed ( ActionEvent arg0 ) { textField_ProductNr . setText ( "" ) ; textField_Name . setText ( "" ) ; textField_Price . setText ( "" ) ; textArea_Ingredients . setText ( "" ) ; textField_Cost . setText ( "" ) ;

Fix:
if ( ( controller . findProduct ( productNbr ) ) == null ) {