Results 1 to 7 of 7
Like Tree2Likes
  • 1 Post By SurfMan
  • 1 Post By DarrylBurke

Thread: exceptions

  1. #1
    ii88xix88ii is offline Member
    Join Date
    Jan 2013
    Location
    Philippines
    Posts
    14
    Rep Power
    0

    Default exceptions

    Hi, need help in displaying this exception to JOptionPane.. :(
    I am a newbie in JCreator Pro and im really having a hard time identifying Exceptions.. sorry.. :(

    Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String
    at sun.misc.FloatingDecimal.readJavaFormatString(Floa tingDecimal.java:1011)
    at java.lang.Double.parseDouble(Double.java:540)
    at jTimer$event1.actionPerformed(jTimer.java:68)
    at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:2018)
    at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2341)
    at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.jav a:6505)
    at javax.swing.JComponent.processMouseEvent(JComponen t.java:3321)
    at java.awt.Component.processEvent(Component.java:627 0)
    at java.awt.Container.processEvent(Container.java:222 9)
    at java.awt.Component.dispatchEventImpl(Component.jav a:4861)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2287)
    at java.awt.Component.dispatchEvent(Component.java:46 87)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4832)
    at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:4492)
    at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:4422)
    at java.awt.Container.dispatchEventImpl(Container.jav a:2273)
    at java.awt.Window.dispatchEventImpl(Window.java:2719 )
    at java.awt.Component.dispatchEvent(Component.java:46 87)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.j ava:703)
    at java.awt.EventQueue.access$000(EventQueue.java:102 )
    at java.awt.EventQueue$3.run(EventQueue.java:662)
    at java.awt.EventQueue$3.run(EventQueue.java:660)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:87)
    at java.awt.EventQueue$4.run(EventQueue.java:676)
    at java.awt.EventQueue$4.run(EventQueue.java:674)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java: 673)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:244)
    at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:163)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:147)
    at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:139)
    at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:97)

  2. #2
    ii88xix88ii is offline Member
    Join Date
    Jan 2013
    Location
    Philippines
    Posts
    14
    Rep Power
    0

    Default Re: exceptions

    what i know is, this is an input error.. can i catch that? and display the error message in JOptionPane?

  3. #3
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    931
    Rep Power
    2

    Default Re: exceptions

    The exception says: java.lang.NumberFormatException: empty String.
    Find a NumberFormat.parse() or NumberFormat.format() that receives an empty String as parameter. Start looking in file jTimer.java, line 68 (because the rest are all Sun classes).
    DarrylBurke likes this.

  4. #4
    ii88xix88ii is offline Member
    Join Date
    Jan 2013
    Location
    Philippines
    Posts
    14
    Rep Power
    0

    Default Re: exceptions

    okay.. thanks :)

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: exceptions

    Quote Originally Posted by SurfMan View Post
    (because the rest are all Sun classes).
    JDK classes :)

    db
    SurfMan likes this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: exceptions

    Quote Originally Posted by ii88xix88ii View Post
    at jTimer$event1.actionPerformed(jTimer.java:68)
    Learn to follow Java coding conventions. Class names should start with an uppercase letter.
    Code Conventions for the Java Programming Language: Contents

    Also, I don't think JTimer is a very good choice of name. A class should be named for what it is, and if you're parsing a double from an empty String, it doesn't look like your class is any kind of Timer.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    SurfMan's Avatar
    SurfMan is online now Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    931
    Rep Power
    2

    Default Re: exceptions

    Quote Originally Posted by DarrylBurke View Post
    JDK classes :)

    db
    Indeed. That was very old school :)

Similar Threads

  1. help with exceptions
    By dawnMist in forum New To Java
    Replies: 31
    Last Post: 11-15-2012, 10:09 AM
  2. Exceptions?
    By linc186 in forum New To Java
    Replies: 3
    Last Post: 03-07-2011, 08:03 AM
  3. Exceptions & More
    By besweeet in forum New To Java
    Replies: 12
    Last Post: 04-29-2010, 09:06 PM
  4. Exceptions
    By hedonist in forum New To Java
    Replies: 10
    Last Post: 09-08-2009, 08:38 AM
  5. Need Help With Exceptions
    By maggie_2 in forum New To Java
    Replies: 5
    Last Post: 12-15-2008, 07:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •