Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange Exception and Outcome

Status
Not open for further replies.

aryajur

Programmer
Jul 2, 2003
45
US
I have a MIDlet running on the Sun´s Wireless Toolkit 2.0.
The MIDlet has 2 threads running simultaneously. One thread is changing some variables while the other one is simply reading them.
My problem is that SOMETIMES (not always, thats the irritating part) the Wireless Toolkit ´s KToolbar window shows this:
Uncaught Exception java/lang/ArithmeticException

and after this the 1st thread that was changing all the variables stops !! rest of the program is running fine !

Can anybody please give me a hint what is going wrong??
 
From the sun docs :
"Thrown when an exceptional arithmetic condition has occurred. For example, an integer "divide by zero" throws an instance of this class. "

First make sure that your code is not breaking it !
Second catch this exception, and put in some debug to see what it is doing.
Third, check the sun site for logged bugs of this nature.
 
Are the threads supposed to be synchronized? Did you implement them as synchronized?
 
Hello guys,
thanks a lot for ur help. Well I found the problem. It was a divide by zero error. I had taken into account the occurance of 0 but even if 1 was passed by the thread to the variable processing routine there was a divide by zero error. SO I have put a check for that.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top