Grails export plugin strange behavior, errs only on PDF, others fine -
i using exporter plugin1.6 grails 2.3.8 , controller's list method:
def list () { println "*** list method called." println "*** params: " + params if(!params.max) params.max = 10 if(params?.exportformat && params.exportformat != "html"){ response.contenttype = grailsapplication.config.grails.mime.types[params.exportformat] response.setheader("content-disposition", "attachment; filename=chairs.${params.extension}") list fields = ["constructionmaterials"] map labels = ["constructionmaterials": "construction materials"] // formatter closure def uppercase = { domain, value -> return value.touppercase() } map formatters = [constructionmaterials: uppercase] map parameters = [constructionmaterials: "cool chairs", "column.widths": [0.2, 0.3, 0.5]] println "*** make here?" exportservice.export(params.exportformat, response.outputstream,chair.list(params), fields, labels, formatters, parameters) } [ chairinstancelist: chair.list( params ) ] }
it works fine when click on csv , xml when click on pdf error.
| error 2014-06-26 01:47:49,139 [http-bio-8080-exec-8] error [/demoapp].[default] - servlet.service() servlet [default] in context path [/demoapp] threw exception [org.springframework.web.util.nestedservletexception: request processing failed; nested exception groovy.lang.missingmethodexception: no signature of method: static java.lang.math.max() applicable argument types: (java.lang.integer, null) values: [4, null] possible solutions: max(int, int), max(double, double), max(float, float), max(long, long), min(int, int), wait()] root cause message: no signature of method: static java.lang.math.max() applicable argument types: (java.lang.integer, null) values: [4, null] possible solutions: max(int, int), max(double, double), max(float, float), max(long, long), min(int, int), wait() line | method ->> 251 | doappend in org.apache.log4j.appenderskeleton - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 66 | appendlooponappenders in org.apache.log4j.helpers.appenderattachableimpl | 206 | callappenders . . . . in org.apache.log4j.category | 391 | forcedlog in '' | 856 | log . . . . . . . . . in '' | 192 | logmessage in org.slf4j.impl.grailslog4jloggeradapter | 167 | error . . . . . . . . in '' | 213 | error in org.apache.commons.logging.impl.slf4jlog | 198 | dofilter . . . . . . in grails.plugin.cache.web.filter.pagefragmentcachingfilter | 63 | dofilter in grails.plugin.cache.web.filter.abstractfilter | 1145 | runworker . . . . . . in java.util.concurrent.threadpoolexecutor | 615 | run in java.util.concurrent.threadpoolexecutor$worker ^ 744 | run . . . . . . . . . in java.lang.thread
why export 2 formats fine err on pdf?
update: ok weird think pdf option works when have more 4 domain instances. not when number equal or below that. can explain? , when work this file get. , this equivalent xml file get.
Comments
Post a Comment