Quantcast

Problem with BigDecimal in IE

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Problem with BigDecimal in IE

humpy125
I have the following code that runs without issue in Chrome & FireFox but IE throws an exception:
String bigDec = params.speedLimit.isBigDecimal() ? "yes. :)" : "no. :("
                log.debug "speedLimit ${params.speedLimit} is a BigDecimal? ${bigDec}"
                
                if (!params.speedLimit.isBigDecimal()){
                    
                    importLogInstance.errors.rejectValue('speedLimit',                                                 // Field in view to highlight using <g:hasErrors> tag
                                'importLog.speedLimit.notNumber') 
                }    
                if (importLogInstance.validate()){
                    if (!importLogInstance.hasErrors()){

                        if (params.speedLimit != null){
                            speedLimit = new BigDecimal(params.speedLimit) // line 595
                        }

The stacktrace is:
java.lang.NumberFormatException
	at java.math.BigDecimal.<init>(BigDecimal.java:534)
	at java.math.BigDecimal.<init>(BigDecimal.java:728)
	at TSM.TsmAnnualPublicationsController$_closure23.doCall(TsmAnnualPublicationsController.groovy:595)
	at TSM.TsmAnnualPublicationsController$_closure23.doCall(TsmAnnualPublicationsController.groovy)
	at java.lang.Thread.run(Thread.java:662)

Can anyone suggest a fix for this?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Problem with BigDecimal in IE

trondbert
This post has NOT been accepted by the mailing list yet.
This looks like server code.. How do specify speedLimit in your HTML form?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Problem with BigDecimal in IE

humpy125
It turned out to be a problem with how IE handles jQuery. I was using the $() shortcut syntax rather than jQuery().  When I changed the code in the AJAX call to use jQuery() then it worked.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Problem with BigDecimal in IE

trondbert
Good for you! Now answer my question on the forum if you can :) How to set up params for unit testing data binding with one-to-many associations?  by trondbert
 
vennlig hilsen
Trond


2012/4/4 humpy125 [via Grails] <[hidden email]>
It turned out to be a problem with how IE handles jQuery. I was using the $() shortcut syntax rather than jQuery().  When I changed the code in the AJAX call to use jQuery() then it worked.


If you reply to this email, your message will be added to the discussion below:
http://grails.1312388.n4.nabble.com/Problem-with-BigDecimal-in-IE-tp4527909p4530549.html
To unsubscribe from Problem with BigDecimal in IE, click here.
NAML

Loading...