aspose file tools
The moose likes Beginning Java and the fly likes Number Format Exceptions in java classes Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Number Format Exceptions in java classes" Watch "Number Format Exceptions in java classes" New topic
Author

Number Format Exceptions in java classes

Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
I'm programming a web application and when I debug it and I'm stepping through it my debugger jumps into the core numeric classes with a lot of number format exceptions. I was wondering if I'm not defining something properly or if this is normal behavior? I get no adverse results, no compiler warnings, no compiler errors, but the debugger seems to go on a rampage and jumps out of the code that I've written and off into these core numeric classes. I don't exactly know how to keep the debugger from going into them.

I'm programming in WDSC 7.0. Any thoughts? Are any of these exceptions seen by the debugger slowing down my application? Is there any way to stop them?
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
You have a runtime error caused by the attempted conversion of an improperly-formatted String to a numeric type. The point where the debugger jumped into the standard Java library should indicate where the problem lies.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
what do you mean by improperly formatted? How do you improperly format a string? Its a string....

Why don't I get any runtime error message? Shouldn't I see something in my console that would indicate this?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8259

Originally posted by Bryce Martin:
How do you improperly format a string? Its a string....


Roger means that the string is improperly formatted to be converted into a number. "blah" is improperly formatted. "100" is properly formatted.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
But this stuff happens on my first page that I call Selection.jsp

I don't do any of that, its only HTML and JavaScript. There is no java associated with the page, yet when its loading it goes off on a tangent.

Any thoughts?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8259

.jsp files get turned into java servlets, so yes, there's java associated with that page.
Do you have this same problem when you load the page without the debugger?
Can you cut and paste the stack trace so we can see what you are seeing?
Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
When I load without the debugger I get no messages, no warnings, no errors. The page loads flawlessly and everything is fine. I just noticed this phenomenon when I was debugging one of my classes last week.

I understand that jsp's are java. And I'm using servlets to interact with my JSPs. There is no servlet interacting with my Selection.jsp until I submit the form. So do you think that its nothing? Should I not really worry about it since there are no ill affects? Its just a curiosity I had. I didn't know if there was something I could do to help the JVM create the container without these exceptions. I'll try to debug it tomorrow and screenshot what I'm seeing or give some stack traces from my debugger.

Thanks for your time.
Bryce
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18670
Can you see a stack trace anywhere for this exception? Can you reprint it here? Or perhaps your debugger shows a list of the frames you're in when the exception is thrown. That would be useful to see.


"I'm not back." - Bill Harding, Twister
Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
While poking around my debugger I noticed that it is set to break on NullPointer Exception caught/uncaught, NumberFormat Exceptions caught/uncaught, and SQL Exceptions caught/uncaught. Now I'm guessing that the wonderful people who programmed these classes realize that in certain situations for whatever reasons there may be certain exceptions occurring. So they caught and handled as many as they could. It seems that its the container that is producing these caught exceptions and causing the debugger to break its action.



Here is what my first stack looks like when I run my Selection.jsp in debug mode. This happens during the building of the container it seems... if I step into it then it goes into java's NullPointerException class and then into the RuntimeException class.

It seems to be happening within the method ClauseTable.get(Int):line 55.

This is in the Container thread so I'm guessing its nothing that I'm doing, that its the way my JVM is handling things.

It seems that the container is having some problems handling a DNS name to IP address lookup. Its giving a caught NumberFormatException...Here is the stack...



The values its taking in are arg0: "csas400, arg1: 10. Its supposed to be taking a string as arg0 and an int as arg1 so I don't know what the problem is. I'm certain its just the container and not anything that I'm doing. So if things run ok I don't think I'm going to worry about it. I would probably have to call IBM and talk to their JVM programmers about it and I don't really feel like getting into this stuff with them right now.

Thanks for any suggestions and taking the time to look at this for me.

Bryce
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Number Format Exceptions in java classes
 
Similar Threads
Data File Format and reading header information
NULL in db-file.
I have a slightly unusual exception handling style, do you think it's good design?
NX: Bodgitt and Scarper: what to do with the db-2*3.db file? write a parser? and...
Issue w/ accesing file from a Servlet