Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
V1C3M4N
Posts: 22
Registered: ‎10-18-2010
My Device: 8100 & 9550
My Carrier: Vodafone

Complex errors with primitive double and float

Okay for quite a few days now I have been struggling with a monumental problem. It seemed that whenever I had one of the classes I was using in an app, the blasted thing would not load onto the simulator, (still havent tried on a device, aiming for a 8100). What it would do is load and run the most previous working version of the app and no code changes were refected on the simulator. After much trail and error I managed (i hope) to track down the error to a couple of lines of code.

 

These lines were

 private double vLatitude = 0;

 

private double vLongitude = 0;

 

When I comment out both but not either of these two lines in a cut down version of the class, containing only the instance variables and the corresponding EditField declarations, it works and loads and runs correctly. Changing the code a few times over in the trail and error approach, the following DO NOT work.

private double vLatitude = 0; // Unmentioned error

private double vLongitude = 0;

private double vLatitude = 0.0; // Unmentioned error

private double vLongitude = 0.0;

private double vLatitude = 0.0d; // Verification error 2522

private double vLongitude = 0.0d;

private float vLatitude = 0; // Verification error 2522

private float vLongitude = 0;

private float vLatitude = 0.0f; // Verification error 2522

private float vLongitude = 0.0f;

However changing them both to String does work, and I'm sure I can build a workaround in the app because I dont need to do any math with them. Its a bit confusing that these lines of code would make the app act so strangely. I have a few int s in there aswell and they seem to work just dandy (so far).

Does anyone know further details about this problem and if there is a solution (not a workaround), is this some hidden and unexplained phenomenon of the Java language or supernatural.

Will update if I find anything else out.

8100 BB

Windows 7

JRE 4.5.0

Eclipse BB plugin

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Complex errors with primitive double and float

Do you think it would be possible to see some of your code? If you have other instance variables and these are simpily amoung them then I don't understand where the errors would come from. See where they are might make it easier.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Developer
YamilBracho
Posts: 713
Registered: ‎05-31-2010
My Device: 8520
My Carrier: Movistar

Re: Complex errors with primitive double and float

There is no need to initializate instance vars.. 

Please use plain text.
Contributor
V1C3M4N
Posts: 22
Registered: ‎10-18-2010
My Device: 8100 & 9550
My Carrier: Vodafone

Re: Complex errors with primitive double and float

Its been a while, didnt know anyone had responded to this.

 

Anyway I've come accross what I suspect is the same problem elsewhere in my application

 

double uploaded = 0;

double percent = 0;

 

Two primitive doubles initialised on declaration except this time these are local variables in a toString() method, so I think this should go straight to the top of Blackberry Developers food chain. Is there some kind of colossal feck up in the JVM MicroEdition version 4.5 Library that mucks up double declarations.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Complex errors with primitive double and float

I'm not following, so you have these variable as local variables (in toString) and class variables and... it doesn't preverify? Did I get that correct?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Contributor
V1C3M4N
Posts: 22
Registered: ‎10-18-2010
My Device: 8100 & 9550
My Carrier: Vodafone

Re: Complex errors with primitive double and float

The doubles that were instance variables are unrelated to the doubles that are local variables. Ive managed to overcome the problem by not having any doubles in my code, the problem i dont think is anything to do with my code AT ALL, if anyone else has had some spooky goings on with primitive doubles i wanted to see if i could see the pattern. but i doubt it, i am sure that it is an issue with the JVM - JRE. How to you elavate it to the attension of blackberry employees???

Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: Complex errors with primitive double and float

you can post bugs at the JIRA bugtracker:

https://www.blackberry.com/jira/secure/Dashboard.jspa

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
jinchang
Posts: 44
Registered: ‎06-07-2010
My Device: 9630
My Carrier: Verizon

Re: Complex errors with primitive double and float

Not sure if this article is related to issue you are facing, but interesting read nonetheless:

 

http://googlewaterloo.blogspot.com/2007/01/verification-errors-with-blackberry.html

 

You may also want to check to make sure the build target OS version and your Simulator's OS version don't clash.

 

- Jin

Please use plain text.
New Member
EngLucas
Posts: 1
Registered: ‎11-25-2010
My Device: TIM 8310

Re: Complex errors with primitive double and float

i'm having a similar problem, any time i put a double in my code it compiles but when i simulate or load it on my phone it doesnt works.

Please use plain text.