java.lang.NullPointerException

Spring JIRA | Henry Szetu | 1 decade ago
  1. 0

    I got a NullPointerException from this method when I try to type in a value in a ComboBox on a form. When the form shows up, the domain object has that property equals to null, but the combo box shows its first item as its current selected item. When I type something in the combo box and tab out of the combo box, the NullPointer exception is thrown. The stack trace is below: [WARN,ValidatingFormModel,AWT-EventQueue-0] Null pointer exception occured setting value java.lang.NullPointerException at org.springframework.richclient.list.ComboBoxAutoCompletion.startsWithIgnoreCase(ComboBoxAutoCompletion.java:293) at org.springframework.richclient.list.ComboBoxAutoCompletion.lookupItem(ComboBoxAutoCompletion.java:235) at org.springframework.richclient.list.ComboBoxAutoCompletion.insertString(ComboBoxAutoCompletion.java:198) at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:668) at javax.swing.text.JTextComponent.setText(JTextComponent.java:1403) at javax.swing.plaf.basic.BasicComboBoxEditor.setItem(BasicComboBoxEditor.java:48) at javax.swing.JComboBox.configureEditor(JComboBox.java:1340) at javax.swing.plaf.basic.BasicComboBoxUI$ListDataHandler.contentsChanged(BasicComboBoxUI.java:537) at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100) at org.springframework.richclient.list.DynamicComboBoxListModel.access$100(DynamicComboBoxListModel.java:32) at org.springframework.richclient.list.DynamicComboBoxListModel$1.valueChanged(DynamicComboBoxListModel.java:73) at org.springframework.binding.value.support.AbstractValueModel.fireValueChanged(AbstractValueModel.java:70) at org.springframework.binding.value.support.AbstractValueModel.fireValueChanged(AbstractValueModel.java:102) at org.springframework.binding.value.support.BufferedValueModel.setValue(BufferedValueModel.java:145) at org.springframework.binding.form.support.ValidatingFormModel$ValueSetterConstraint.setValueSilently(ValidatingFormModel.java:376) at org.springframework.binding.form.support.ValidatingFormModel$ValueSetterConstraint.test(ValidatingFormModel.java:347) at org.springframework.binding.form.support.ValidatingFormModel$ValidatingFormValueModel.setValue(ValidatingFormModel.java:265) at org.springframework.richclient.list.DynamicComboBoxListModel.setSelectedItem(DynamicComboBoxListModel.java:115) at javax.swing.JComboBox.actionPerformed(JComboBox.java:1251) at javax.swing.plaf.basic.BasicComboBoxUI$EditorFocusListener.focusLost(BasicComboBoxUI.java:1557) at java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:172) at java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:171) at java.awt.Component.processFocusEvent(Component.java:5006) at java.awt.Component.processEvent(Component.java:4888) at java.awt.Container.processEvent(Container.java:1569) at java.awt.Component.dispatchEventImpl(Component.java:3615) at java.awt.Container.dispatchEventImpl(Container.java:1627) at java.awt.Component.dispatchEvent(Component.java:3477) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1713) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:777) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:497) at java.awt.Component.dispatchEventImpl(Component.java:3506) at java.awt.Container.dispatchEventImpl(Container.java:1627) at java.awt.Component.dispatchEvent(Component.java:3477) at java.awt.EventQueue.dispatchEvent(EventQueue.java:456) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) I took a look at the class ComboBoxAutoCompletion private boolean startsWithIgnoreCase(String str1, String str2) { return str1.toUpperCase().startsWith(str2.toUpperCase()); } Should it test for null conditions like below private boolean startsWithIgnoreCase(String str1, String str2) { if (null != str1 && null != str2) { return str1.toUpperCase().startsWith(str2.toUpperCase()); } else { return false; } }

    Spring JIRA | 1 decade ago | Henry Szetu
    java.lang.NullPointerException
  2. 0

    I got a NullPointerException from this method when I try to type in a value in a ComboBox on a form. When the form shows up, the domain object has that property equals to null, but the combo box shows its first item as its current selected item. When I type something in the combo box and tab out of the combo box, the NullPointer exception is thrown. The stack trace is below: [WARN,ValidatingFormModel,AWT-EventQueue-0] Null pointer exception occured setting value java.lang.NullPointerException at org.springframework.richclient.list.ComboBoxAutoCompletion.startsWithIgnoreCase(ComboBoxAutoCompletion.java:293) at org.springframework.richclient.list.ComboBoxAutoCompletion.lookupItem(ComboBoxAutoCompletion.java:235) at org.springframework.richclient.list.ComboBoxAutoCompletion.insertString(ComboBoxAutoCompletion.java:198) at javax.swing.text.AbstractDocument.replace(AbstractDocument.java:668) at javax.swing.text.JTextComponent.setText(JTextComponent.java:1403) at javax.swing.plaf.basic.BasicComboBoxEditor.setItem(BasicComboBoxEditor.java:48) at javax.swing.JComboBox.configureEditor(JComboBox.java:1340) at javax.swing.plaf.basic.BasicComboBoxUI$ListDataHandler.contentsChanged(BasicComboBoxUI.java:537) at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100) at org.springframework.richclient.list.DynamicComboBoxListModel.access$100(DynamicComboBoxListModel.java:32) at org.springframework.richclient.list.DynamicComboBoxListModel$1.valueChanged(DynamicComboBoxListModel.java:73) at org.springframework.binding.value.support.AbstractValueModel.fireValueChanged(AbstractValueModel.java:70) at org.springframework.binding.value.support.AbstractValueModel.fireValueChanged(AbstractValueModel.java:102) at org.springframework.binding.value.support.BufferedValueModel.setValue(BufferedValueModel.java:145) at org.springframework.binding.form.support.ValidatingFormModel$ValueSetterConstraint.setValueSilently(ValidatingFormModel.java:376) at org.springframework.binding.form.support.ValidatingFormModel$ValueSetterConstraint.test(ValidatingFormModel.java:347) at org.springframework.binding.form.support.ValidatingFormModel$ValidatingFormValueModel.setValue(ValidatingFormModel.java:265) at org.springframework.richclient.list.DynamicComboBoxListModel.setSelectedItem(DynamicComboBoxListModel.java:115) at javax.swing.JComboBox.actionPerformed(JComboBox.java:1251) at javax.swing.plaf.basic.BasicComboBoxUI$EditorFocusListener.focusLost(BasicComboBoxUI.java:1557) at java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:172) at java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:171) at java.awt.Component.processFocusEvent(Component.java:5006) at java.awt.Component.processEvent(Component.java:4888) at java.awt.Container.processEvent(Container.java:1569) at java.awt.Component.dispatchEventImpl(Component.java:3615) at java.awt.Container.dispatchEventImpl(Container.java:1627) at java.awt.Component.dispatchEvent(Component.java:3477) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1713) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:777) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:497) at java.awt.Component.dispatchEventImpl(Component.java:3506) at java.awt.Container.dispatchEventImpl(Container.java:1627) at java.awt.Component.dispatchEvent(Component.java:3477) at java.awt.EventQueue.dispatchEvent(EventQueue.java:456) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137) at java.awt.EventDispatchThread.run(EventDispatchThread.java:100) I took a look at the class ComboBoxAutoCompletion private boolean startsWithIgnoreCase(String str1, String str2) { return str1.toUpperCase().startsWith(str2.toUpperCase()); } Should it test for null conditions like below private boolean startsWithIgnoreCase(String str1, String str2) { if (null != str1 && null != str2) { return str1.toUpperCase().startsWith(str2.toUpperCase()); } else { return false; } }

    Spring JIRA | 1 decade ago | Henry Szetu
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.richclient.list.ComboBoxAutoCompletion.startsWithIgnoreCase()
    2. org.springframework.richclient
      ComboBoxAutoCompletion.insertString
      1. org.springframework.richclient.list.ComboBoxAutoCompletion.startsWithIgnoreCase(ComboBoxAutoCompletion.java:293)
      2. org.springframework.richclient.list.ComboBoxAutoCompletion.lookupItem(ComboBoxAutoCompletion.java:235)
      3. org.springframework.richclient.list.ComboBoxAutoCompletion.insertString(ComboBoxAutoCompletion.java:198)
      3 frames
    3. Java RT
      AbstractListModel.fireContentsChanged
      1. javax.swing.text.AbstractDocument.replace(AbstractDocument.java:668)
      2. javax.swing.text.JTextComponent.setText(JTextComponent.java:1403)
      3. javax.swing.plaf.basic.BasicComboBoxEditor.setItem(BasicComboBoxEditor.java:48)
      4. javax.swing.JComboBox.configureEditor(JComboBox.java:1340)
      5. javax.swing.plaf.basic.BasicComboBoxUI$ListDataHandler.contentsChanged(BasicComboBoxUI.java:537)
      6. javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
      6 frames
    4. org.springframework.richclient
      DynamicComboBoxListModel$1.valueChanged
      1. org.springframework.richclient.list.DynamicComboBoxListModel.access$100(DynamicComboBoxListModel.java:32)
      2. org.springframework.richclient.list.DynamicComboBoxListModel$1.valueChanged(DynamicComboBoxListModel.java:73)
      2 frames
    5. org.springframework.binding
      ValidatingFormModel$ValidatingFormValueModel.setValue
      1. org.springframework.binding.value.support.AbstractValueModel.fireValueChanged(AbstractValueModel.java:70)
      2. org.springframework.binding.value.support.AbstractValueModel.fireValueChanged(AbstractValueModel.java:102)
      3. org.springframework.binding.value.support.BufferedValueModel.setValue(BufferedValueModel.java:145)
      4. org.springframework.binding.form.support.ValidatingFormModel$ValueSetterConstraint.setValueSilently(ValidatingFormModel.java:376)
      5. org.springframework.binding.form.support.ValidatingFormModel$ValueSetterConstraint.test(ValidatingFormModel.java:347)
      6. org.springframework.binding.form.support.ValidatingFormModel$ValidatingFormValueModel.setValue(ValidatingFormModel.java:265)
      6 frames
    6. org.springframework.richclient
      DynamicComboBoxListModel.setSelectedItem
      1. org.springframework.richclient.list.DynamicComboBoxListModel.setSelectedItem(DynamicComboBoxListModel.java:115)
      1 frame
    7. Java RT
      EventDispatchThread.run
      1. javax.swing.JComboBox.actionPerformed(JComboBox.java:1251)
      2. javax.swing.plaf.basic.BasicComboBoxUI$EditorFocusListener.focusLost(BasicComboBoxUI.java:1557)
      3. java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:172)
      4. java.awt.AWTEventMulticaster.focusLost(AWTEventMulticaster.java:171)
      5. java.awt.Component.processFocusEvent(Component.java:5006)
      6. java.awt.Component.processEvent(Component.java:4888)
      7. java.awt.Container.processEvent(Container.java:1569)
      8. java.awt.Component.dispatchEventImpl(Component.java:3615)
      9. java.awt.Container.dispatchEventImpl(Container.java:1627)
      10. java.awt.Component.dispatchEvent(Component.java:3477)
      11. java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1713)
      12. java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:777)
      13. java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:497)
      14. java.awt.Component.dispatchEventImpl(Component.java:3506)
      15. java.awt.Container.dispatchEventImpl(Container.java:1627)
      16. java.awt.Component.dispatchEvent(Component.java:3477)
      17. java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
      18. java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
      19. java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
      20. java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
      21. java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
      22. java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
      22 frames