Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-11432

ViewGeneric.groovy throws an error when the primary key of an entity is of type integer

    XMLWordPrintableJSON

Details

    Description

      When an entity definition has a primary key defined based on a field with type definition = integer, the 'viewgeneric function throws following error:

      2020-03-02 14:33:50,322 |jsse-nio-8443-exec-3 |ControlServlet                |E| Error in request handler: 
      java.lang.IllegalArgumentException: Error running script at location [component://webtools/groovyScripts/entity/ViewGeneric.groovy]: java.lang.ClassCastException: Cannot cast java.lang.String to java.lang.Integer
      	at org.apache.ofbiz.base.util.ScriptUtil.executeScript(ScriptUtil.java:326) ~[main/:?]
      	at org.apache.ofbiz.base.util.ScriptUtil.executeScript(ScriptUtil.java:302) ~[main/:?]
      	at org.apache.ofbiz.widget.model.AbstractModelAction$Script.runAction(AbstractModelAction.java:634) ~[main/:?]
      	at org.apache.ofbiz.widget.model.AbstractModelAction.runSubActions(AbstractModelAction.java:143) ~[main/:?]
      	at org.apache.ofbiz.widget.model.ModelScreenWidget$Section.renderWidgetString(ModelScreenWidget.java:278) ~[main/:?]
      	at org.apache.ofbiz.widget.model.ModelScreen.renderScreenString(ModelScreen.java:133) ~[main/:?]
      	at org.apache.ofbiz.widget.renderer.ScreenRenderer.render(ScreenRenderer.java:140) ~[main/:?]
      	at org.apache.ofbiz.widget.renderer.ScreenRenderer.render(ScreenRenderer.java:102) ~[main/:?]
      	at org.apache.ofbiz.widget.renderer.macro.MacroScreenViewHandler.render(MacroScreenViewHandler.java:115) ~[main/:?]
      	at org.apache.ofbiz.webapp.control.RequestHandler.renderView(RequestHandler.java:976) ~[main/:?]
      	at org.apache.ofbiz.webapp.control.RequestHandler.doRequest(RequestHandler.java:671) ~[main/:?]
      	at org.apache.ofbiz.webapp.control.ControlServlet.handle(ControlServlet.java:232) [main/:?]
      	at org.apache.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:96) [main/:?]
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) [tomcat-servlet-api-9.0.31.jar:?]
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) [tomcat-servlet-api-9.0.31.jar:?]
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.27.jar:9.0.27]
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:187) [main/:?]
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.ofbiz.webapp.control.ControlFilter.doFilter(ControlFilter.java:156) [main/:?]
      	at javax.servlet.http.HttpFilter.doFilter(HttpFilter.java:52) [tomcat-servlet-api-9.0.31.jar:?]
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71) [log4j-web-2.11.2.jar:2.11.2]
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-catalina-9.0.31.jar:9.0.31]
      	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367) [tomcat-coyote-9.0.31.jar:9.0.31]
      	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-coyote-9.0.31.jar:9.0.31]
      	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-coyote-9.0.31.jar:9.0.31]
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639) [tomcat-coyote-9.0.31.jar:9.0.31]
      	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote-9.0.31.jar:9.0.31]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_131]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_131]
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util-9.0.31.jar:9.0.31]
      	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
      Caused by: java.lang.ClassCastException: Cannot cast java.lang.String to java.lang.Integer
      	at java.lang.Class.cast(Class.java:3369) ~[?:1.8.0_131]
      	at org.apache.ofbiz.entity.jdbc.SqlJdbcUtil.setValue(SqlJdbcUtil.java:846) ~[main/:?]
      	at org.apache.ofbiz.entity.datasource.GenericDAO.selectListIteratorByCondition(GenericDAO.java:721) ~[main/:?]
      	at org.apache.ofbiz.entity.datasource.GenericHelperDAO.findListIteratorByCondition(GenericHelperDAO.java:148) ~[main/:?]
      	at org.apache.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1541) ~[main/:?]
      	at org.apache.ofbiz.entity.GenericDelegator.findList(GenericDelegator.java:1575) ~[main/:?]
      	at org.apache.ofbiz.entity.util.EntityQuery.query(EntityQuery.java:451) ~[main/:?]
      	at org.apache.ofbiz.entity.util.EntityQuery.queryList(EntityQuery.java:381) ~[main/:?]
      	at org.apache.ofbiz.entity.util.EntityQuery.queryOne(EntityQuery.java:423) ~[main/:?]
      	at org.apache.ofbiz.entity.util.EntityQuery$queryOne$4.call(Unknown Source) ~[?:?]
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47) ~[groovy-2.5.8.jar:2.5.8]
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115) ~[groovy-2.5.8.jar:2.5.8]
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119) ~[groovy-2.5.8.jar:2.5.8]
      	at ViewGeneric.run(ViewGeneric.groovy:77) ~[?:?]
      	at org.apache.ofbiz.base.util.GroovyUtil.runScriptAtLocation(GroovyUtil.java:214) ~[main/:?]
      	at org.apache.ofbiz.base.util.ScriptUtil.executeScript(ScriptUtil.java:320) ~[main/:?]
      	... 46 more
      

      Attachments

        Issue Links

          Activity

            People

              nmalin Nicolas Malin
              pierresmits Pierre Smits
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: