Gson error after Grails update

I am upgrading a grails project from 3.2.6 to 3.2.8 and I am getting the following error when I make a GET request:

StringIndexOutOfBoundsException occurred when processing request: [GET] /api/fornecedores
String index out of range: -1. Stacktrace follows:

java.lang.reflect.InvocationTargetException: null
        at org.grails.core.DefaultGrailsControllerClass$ReflectionInvoker.invoke(DefaultGrailsControllerClass.java:211)
        at org.grails.core.DefaultGrailsControllerClass.invoke(DefaultGrailsControllerClass.java:188)
        at org.grails.web.mapping.mvc.UrlMappingsInfoHandlerAdapter.handle(UrlMappingsInfoHandlerAdapter.groovy:90)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
        at grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:143)
        at grails.plugin.springsecurity.rest.RestLogoutFilter.doFilter(RestLogoutFilter.groovy:80)
        at grails.plugin.springsecurity.rest.RestTokenValidationFilter.processFilterChain(RestTokenValidationFilter.groovy:118)
        at grails.plugin.springsecurity.rest.RestTokenValidationFilter.doFilter(RestTokenValidationFilter.groovy:84)
        at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
        at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
        at grails.plugin.springsecurity.rest.RestTokenValidationFilter.processFilterChain(RestTokenValidationFilter.groovy:118)
        at grails.plugin.springsecurity.rest.RestTokenValidationFilter.doFilter(RestTokenValidationFilter.groovy:84)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
        at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
        at grails.plugin.springsecurity.rest.RestAuthenticationFilter.doFilter(RestAuthenticationFilter.groovy:143)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
        at grails.plugin.springsecurity.web.authentication.logout.MutableLogoutFilter.doFilter(MutableLogoutFilter.groovy:62)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
        at grails.plugin.springsecurity.web.SecurityRequestHolderFilter.doFilter(SecurityRequestHolderFilter.groovy:58)
        at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
        at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
        at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
        at org.grails.web.servlet.mvc.GrailsWebRequestFilter.doFilterInternal(GrailsWebRequestFilter.java:77)
        at org.grails.web.filters.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:67)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Caused by: grails.views.ViewRenderException: Error rendering view: String index out of range: -1
        at grails.views.AbstractWritableScript.writeTo(AbstractWritableScript.groovy:43)
        at grails.views.mvc.GenericGroovyTemplateView.renderMergedOutputModel(GenericGroovyTemplateView.groovy:73)
        at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
        at grails.views.mvc.renderer.DefaultViewRenderer.render(DefaultViewRenderer.groovy:111)
        at grails.artefact.controller.RestResponder$Trait$Helper.internalRespond(RestResponder.groovy:188)
        at grails.artefact.controller.RestResponder$Trait$Helper.respond(RestResponder.groovy:98)
        at extramuroweb.FornecedorController.index(FornecedorController.groovy:24)
        ... 38 common frames omitted
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
        at java.lang.String.substring(String.java:1967)
        at grails.views.resolve.TemplateResolverUtils.fullTemplateNameForClass(TemplateResolverUtils.groovy:23)
        at grails.views.ResolvableGroovyTemplateEngine.resolveTemplate(ResolvableGroovyTemplateEngine.groovy:226)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$_renderEntityId_closure12.doCall(DefaultGrailsJsonViewHelper.groovy:745)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper.renderEntityId(DefaultGrailsJsonViewHelper.groovy:741)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$_process_closure8.doCall(DefaultGrailsJsonViewHelper.groovy:600)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.cloneDelegateAndGetContent(StreamingJsonBuilder.java:721)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.cloneDelegateAndGetContent(StreamingJsonBuilder.java:713)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.call(StreamingJsonBuilder.java:603)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper.process(DefaultGrailsJsonViewHelper.groovy:599)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper.process(DefaultGrailsJsonViewHelper.groovy:528)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$_process_closure6.doCall(DefaultGrailsJsonViewHelper.groovy:567)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.cloneDelegateAndGetContent(StreamingJsonBuilder.java:721)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.cloneDelegateAndGetContent(StreamingJsonBuilder.java:713)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.call(StreamingJsonBuilder.java:603)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper.process(DefaultGrailsJsonViewHelper.groovy:564)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$_renderDefault_closure1.doCall(DefaultGrailsJsonViewHelper.groovy:179)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$3$_writeTo_closure1.doCall(DefaultGrailsJsonViewHelper.groovy:217)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.cloneDelegateAndGetContent(StreamingJsonBuilder.java:721)
        at grails.plugin.json.builder.StreamingJsonBuilder$StreamingJsonDelegate.cloneDelegateAndGetContent(StreamingJsonBuilder.java:713)
        at grails.plugin.json.builder.StreamingJsonBuilder.call(StreamingJsonBuilder.java:208)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$3.writeTo(DefaultGrailsJsonViewHelper.groovy:208)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper.handleValue(DefaultGrailsJsonViewHelper.groovy:332)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$_getIterableWritable_closure3.doCall(DefaultGrailsJsonViewHelper.groovy:267)
        at grails.plugin.json.view.api.internal.DefaultGrailsJsonViewHelper$4.writeTo(DefaultGrailsJsonViewHelper.groovy:283)
        at grails.plugin.json.view.JsonViewTemplate.json(JsonViewTemplate.groovy:126)
        at server_object__object_gson.run(server_object__object_gson:5)
        at grails.plugin.json.view.JsonViewTemplate.doWrite(JsonViewTemplate.groovy:35)
        at grails.views.AbstractWritableScript.writeTo(AbstractWritableScript.groovy:40)
        ... 44 common frames omitted

      

I am using Angular 2 profile. Many of my domain classes have gson files, but even Fornecedor da domain does'nt have get the error.

+3


source to share





All Articles