我们的生产系统和一些测试系统存在问题。我们有一个间歇性的 Grails 异常,它发生在 View 中。
No signature of method: static org.apache.commons.lang.StringUtils.isNotBlank() is applicable for argument types: (null) values: [null] Possible solutions: isNotBlank(java.lang.String), isBlank(java.lang.String)
该错误似乎表明 Grails 似乎无法确定它应该使用 StringUtils.isNotBlank(String) 应该在将 null 传递给它时使用。
我们注意到:
我不确定 Grails 版本是什么或如何检查它。如果您在下面评论如何找到它,我很乐意使用 Grails 版本编辑问题。
最佳答案
我可以通过运行在控制台中重现这一点:
org.apache.commons.lang.StringUtils.isNotBlank((Object)null) => Your Error
仅传递 null 允许编译器将 null 强制为 String:
org.apache.commons.lang.StringUtils.isNotBlank(null) => false
您传入的任何内容都可能严格键入为 String 以外的内容,但为 null。 Groovy 编译器在强制类型方面非常聪明,但我已经看到它在一些简单的情况下崩溃了。如果使用 @CompileStatic 和/或使用 native Java 对象,则尤其如此。
关于grails - 间歇性 Grails 异常 : MissingMethodException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30249252/