Results 1 to 6 of 6
- 02-21-2014, 05:23 PM #1
Member
- Join Date
- Jan 2014
- Posts
- 97
- Rep Power
- 0
Does this mean anything? Decifering Exceptions
I am struggling with my current Java assignment and can't figure out how to use the debugger to step though a GUI application to see what exactly is happening where.
When I populate all fields in my GUI and they are validated successfully, the end message does not appear. Instead, in the console window, I get the following exception pointing to my printInvoice() method indicating a NullPointerException.
As I said, everything has been filled out correctly and this program at least mostly-operated yesterday morning. Is there a way to find out where this is coming from using the message below? I suspect it is stemming from the date fields I added and will look into that but I am still curious. I would guess not but maybe someone out there can offer me some advice and/or tell me how (if) the debugger tool can be used.
Java Code:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at edu.witc.Ch_08_10ex2.controller.Hotel_Processor.printInvoice(Hotel_Processor.java:219) at edu.witc.Ch_08_10ex2.controller.Hotel_Processor$SubmitButtonListener.actionPerformed(Hotel_Processor.java:61) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)
Last edited by mallorz; 02-21-2014 at 05:26 PM.
- 02-21-2014, 05:41 PM #2
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Does this mean anything? Decifering Exceptions
to be honest, I find using a debugger to debug a Swing application pretty hairy because it involves multithreading. I'd try to find problems by sprinkling System.out statements first if I were you.
"Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
- 02-21-2014, 06:01 PM #3
Re: Does this mean anything? Decifering Exceptions
One other thing you can do, that is *if* you use a decent IDE like JetBrains IntelliJ IDEA, is to set Exception breakpoints. In IDEA you can set a breakpoint to stop your program on certain conditions, like the occurance of a NPE, AIOOBE and what have you.
"It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013
- 02-21-2014, 06:05 PM #4
Re: Does this mean anything? Decifering Exceptions
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at edu.witc.Ch_08_10ex2.controller.Hotel_Processor.pr intInvoice(Hotel_Processor.java:219)
If you can not tell which variable it is, add a println just before line 219 and print out the values of all the variables on that line.If you don't understand my response, don't ignore it, ask a question.
- 02-21-2014, 06:17 PM #5
Member
- Join Date
- Jan 2014
- Posts
- 97
- Rep Power
- 0
Re: Does this mean anything? Decifering Exceptions
I managed to get the debugger to work. The issue seems to lie in my customer class - everything was null. I was messing around yesterday and I guess I forgot to change a few things back there. Thanks guys.
I believe that ultimately leaves me with one more issue to overcome and then I can have this thing over with! :)Last edited by mallorz; 02-21-2014 at 06:19 PM.
- 02-21-2014, 10:09 PM #6
Just a guy
- Join Date
- Jun 2013
- Location
- Netherlands
- Posts
- 5,114
- Rep Power
- 13
Re: Does this mean anything? Decifering Exceptions
"Syntactic sugar causes cancer of the semicolon." -- Alan Perlis
Similar Threads
-
exceptions
By ii88xix88ii in forum JCreatorReplies: 6Last Post: 03-12-2013, 04:07 PM -
help with exceptions
By dawnMist in forum New To JavaReplies: 31Last Post: 11-15-2012, 11:09 AM -
Exceptions
By Nerijus in forum New To JavaReplies: 8Last Post: 05-18-2010, 02:44 PM -
Exceptions
By hedonist in forum New To JavaReplies: 10Last Post: 09-08-2009, 09:38 AM
Bookmarks