Search code examples
grailsgroovygsp

No signature of method: java.lang.String.encodeAsLineBreak() groovy / grails


I'm trying to debug a gsp page, but I'm getting the following error:

Error 500:   
Servlet: default  
URI: /iucentral/QAInfo/list
Exception Message: No signature of method: java.lang.String.encodeAsLineBreak() is applicable for argument types: () values: [] 
Caused by:
  Error processing GroovyPageView:
  Error executing tag <g:form>:
  Error evaluating expression [QAInfoInstance.fromTables.encodeAsHTML().encodeAsLineBreak()] on line [428]: 
    groovy.lang.MissingMethodException: No signature of method: java.lang.String.encodeAsLineBreak() is applicable for argument types: () values: []
    at D:/Users/psouzamo/Documents/workspace-sts-2.7.2.RELEASE/uicentral/grails-app/views/QAInfo/list.gsp:441  
Class: list.gsp   
At Line: [446]  
Code Snippet:  

Solution

  • LineBreak is not a standard Grails codec, so make sure that your custom codec is correctly defined in the grails/utils folder.

    class LineBreakCodec {
        static encode = { str ->
            // convert the string and return the result
        }
    }
    

    See the Custom Codecs section at the end of 11.2 http://grails.org/doc/latest/guide/single.html#11.2%20Encoding%20and%20Decoding%20Objects