cbmarcum / mybusiness

A Grails 4 plugin for online product e-commerce
Apache License 2.0
5 stars 1 forks source link

google reviews view is throwing a number a number format exception #95

Closed cbmarcum closed 2 years ago

cbmarcum commented 3 years ago

in dev mode sometimes gapi/index is throwing a number format exception due to an empty string being passed in the body to the faReviewStars tag. hasn't shown up in production yet. possible solution is to test before tag and replace with not available or no info.

def faReviewStars = { attr, body -> 17: 18: Double rating = Double.parseDouble(body().toString()) 19: def hasDecimal = true 20: def emptyStars = attr.totalStars.toInteger()

Line | Method
->> 473 createGroovyPageException in /home/carl/dev-git/crossroads-coins-client/grails-app/views/gapi/index.gsp
Caused by GrailsTagException: [views/gapi/index.gsp:57] Error executing tag : [views/gapi/_googleReviews.gsp:6] Error executing tag : empty String ->> 57 throwRootCause in views/gapi/index.gsp
Caused by GrailsTagException: [views/gapi/_googleReviews.gsp:6] Error executing tag : empty String ->> 6 throwRootCause in views/gapi/_googleReviews.gsp

Caused by NumberFormatException: empty String ->> 538 | parseDouble in java.lang.Double

tag faReview stars is in MyBusiness code: grails-app/taglib/net/codebuilders/mybusiness/ReviewTagLib.groovy