stackoverflow error

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Aug 2009
Posts: 5
Reputation: cesarnz is an unknown quantity at this point 
Solved Threads: 0
cesarnz cesarnz is offline Offline
Newbie Poster

stackoverflow error

 
0
  #1
Aug 3rd, 2009
hi all,
does anyone know much about the FESI interpreter ??? i am getting an error while using this third party product (GTX) which is written in java and i cant work out whats wrong. FESI is built into this product which i am using so i dont know the details of how it interprets the script which i write.

error that gets thrown is :


[8/07/09 10:36:23:755 NZST] 133e76d ExceptionUtil E CNTR0020E: Non-application exception occurred while processing method "onInput" on bean "BeanId(GTX_Test#GTXEJB.jar#GTProcessEngineEJB , 1225754b587)". Exception data: java.lang.StackOverflowError
at com.gtnet.pk.ecmas.extensions.GTDecimalPrototype.g etDefaultValue(GTDecimalPrototype.java:287)
at FESI.Data.ESObject.getDefaultValue(ESObject.java:4 99)
at FESI.Data.ESObject.toESPrimitive(ESObject.java:667 )
at FESI.Interpreter.EcmaScriptEvaluateVisitor.equal(E cmaScriptEvaluateVisitor.java:310)
at FESI.Interpreter.EcmaScriptEvaluateVisitor.equal(E cmaScriptEvaluateVisitor.java:310)


this error gets thrown when i try and reference a field from a user defined object e.g if( dbObject.ID == 0)

but it works fine when :
var tmpID = dbObject.ID + 0 ;

if(tmpID == 0) ......


any help to understand how/why the above works would be much appreciated.

ta.
Last edited by cesarnz; Aug 3rd, 2009 at 9:18 pm.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,629
Reputation: BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold BestJewSinceJC is a splendid one to behold 
Solved Threads: 206
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso

Re: stackoverflow error

 
0
  #2
Aug 4th, 2009
I'm not sure of your level of experience so I'll post this just in case you don't know stack issues, which you may:

http://en.wikipedia.org/wiki/Stack_overflow
Out.
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 5
Reputation: cesarnz is an unknown quantity at this point 
Solved Threads: 0
cesarnz cesarnz is offline Offline
Newbie Poster

Re: stackoverflow error

 
0
  #3
Aug 4th, 2009
Originally Posted by BestJewSinceJC View Post
I'm not sure of your level of experience so I'll post this just in case you don't know stack issues, which you may:

http://en.wikipedia.org/wiki/Stack_overflow


hey thanks for the reply. I know about the logic behind stackoverflow error but what i cant understand is why does it throw this error on that particular line of code ?? its not even in a loop of any sort so i dont see a large stack of memory being built.

and why does it work if i declare a local variable and assign it the same value as before ??

once again thanks for your reply.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 48
Reputation: sneaker is an unknown quantity at this point 
Solved Threads: 7
sneaker sneaker is offline Offline
Light Poster

Re: stackoverflow error

 
0
  #4
Aug 5th, 2009
[QUOTE=cesarnz;939193
...and why does it work if i declare a local variable and assign it the same value as before ??
.[/QUOTE]
Hi

When you assign a local variable the value of the object and ask for a comparison to 0 whit the operator == the two values are compared.
When you ask for the same thing to be done whit the object, and uses the operator == what you compare is not the value of the object but the objects referents (address) compared to 0.
If you want the value in the object to be compared to 0 then you have to use the method equals() instead of the == operator.

Hope this will give some help.
Good luck =)
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 5
Reputation: cesarnz is an unknown quantity at this point 
Solved Threads: 0
cesarnz cesarnz is offline Offline
Newbie Poster

Re: stackoverflow error

 
0
  #5
Aug 5th, 2009
Originally Posted by sneaker View Post
Hi

When you assign a local variable the value of the object and ask for a comparison to 0 whit the operator == the two values are compared.
When you ask for the same thing to be done whit the object, and uses the operator == what you compare is not the value of the object but the objects referents (address) compared to 0.
If you want the value in the object to be compared to 0 then you have to use the method equals() instead of the == operator.

Hope this will give some help.
Good luck =)


hi,
this makes sense but (theres always a but ) why would it compare address of the object when i have used the dot operator to reference the attribute of the object i.e ID ??

so the object is 'dbObject' which holds an "attribute" named 'ID'. if i want to get the value of ID it is common in java to use the dot operator like dbObject.ID which gives you the value of the ID rather than the address.

Please correct me if i am wrong.

however its all happy when i declare a local variable and assign this variable the same value as above with a '+ 0' i.e

var tmpID = dbObject.ID + 0;

Even if it was comparing address of the object why would it cause stack overflow error ?

i cant make sense of this so need you good people to help.
Last edited by cesarnz; Aug 5th, 2009 at 6:17 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,648
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 474
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: stackoverflow error

 
0
  #6
Aug 7th, 2009
>any help to understand how/why the above works would be much
>appreciated.

The problem you are facing could be very well because of a broken library implementation.

From what I can make out of the stacktrace, the implementation blows up when trying to convert the value of your object field i.e. ID to a primitive. Also given that it *works* when you add a zero to the ID field, I guess that there is some kind of implicit coercion taking place which makes the entire comparison *work* somehow.

Again, this is all guesswork and would be best answered on the forum for that given third party library. You can try printing out the value of "tmpID" in the second case; what does it give? NaN? Does printing out the value "dbObject.ID" cause the same stackoverflow issue?
I don't accept change; I don't deserve to live.

Jo Tujhe Jagaaye, Nindein Teri Udaaye Khwaab Hai Sachcha Wahi.
Nindon Mein Jo Aaye Jise To Bhul Jaaye Khawab Woh Sachcha Nahi.
Khwaab Ko Raag De, Nind Ko Aag De
Reply With Quote Quick reply to this message  
Join Date: Aug 2009
Posts: 5
Reputation: cesarnz is an unknown quantity at this point 
Solved Threads: 0
cesarnz cesarnz is offline Offline
Newbie Poster

Re: stackoverflow error

 
0
  #7
Aug 9th, 2009
Originally Posted by ~s.o.s~ View Post
>any help to understand how/why the above works would be much
>appreciated.

The problem you are facing could be very well because of a broken library implementation.

From what I can make out of the stacktrace, the implementation blows up when trying to convert the value of your object field i.e. ID to a primitive. Also given that it *works* when you add a zero to the ID field, I guess that there is some kind of implicit coercion taking place which makes the entire comparison *work* somehow.

Again, this is all guesswork and would be best answered on the forum for that given third party library. You can try printing out the value of "tmpID" in the second case; what does it give? NaN? Does printing out the value "dbObject.ID" cause the same stackoverflow issue?
thanks for the reply. Printing the value of 'dbObject.ID' causes stackoverflow error as well. unfortunately going back to the 3rd party would mean paying them lots and lots of $$$.

Anyway i think you are right that there is some casting error behind the scenes in the libraries which is causing this error. Just cant figure out where.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC