Domanda

Error Message:

No signature of method: org.codehaus.groovy.runtime.GStringImpl.split() 
is applicable for argument types: (java.lang.String) values: [:]

Possible solutions: split(), split(), split(groovy.lang.Closure), 
plus(java.lang.String), wait(),toList()

Code snippet:

static getRosterId(def session) {
     session.filter?.split(':')[0]
}
static getSubject(def session) {
    session.filter?.split(':')[1]
}

JDK:

OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

Grails Version:

2.0.1

Ubuntu Version:

Ubuntu 12.04.3 LTS (GNU/Linux 3.8.0-29-generic x86_64)

this is doing a split on what should be a normal String... of course it's a GString while in grails, this code works in production, on our local boxes, but does not work on our CI Ubuntu server.... not sure why Grails wouldn't be able to resolve String methods in this particular environment, we are not doing anything special in this class, no String.metaClass manipulation... straight Grails.

Any input would be awesome

È stato utile?

Soluzione

Our final fix was

static getRosterId(def session) {
     session.filter?.toString().split(':')[0]
}
static getSubject(def session) {
     session.filter?.toString().split(':')[1]
}

This should not be needed in Groovy! :( a GStringImpl Object should resolve all GString and java.lang.String methods :/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top