[groovy-user] Could not find which method getChars() to invoke from this list

140 views
Skip to first unread message

citron

unread,
May 10, 2010, 5:40:21 PM5/10/10
to us...@groovy.codehaus.org

Hi,

any one knows why I get this error?

Its working fine in the Groovy Console but not in my Grails application.

Thanks!

tranformRVtreeToXML("""{ ADV_CLASS="INFO" ADV_SOURCE="SYSTEM"
ADV_NAME="RVD.CONNECTED" }"""))


private def tranformRVtreeToXML(def rvTree){
println rvTree
def branches = new LinkedList()
def buffer =""
def leaf_mode = 0
def rvXML=""
def tree = ""
try{
if(rvTree.startsWith("{"))
tree="="+rvTree
else
tree="={\""+rvTree+" }"
tree.toString().getChars().each{
buffer+=it
if ( leaf_mode == 0 ){
if( buffer.endsWith("={")){
branches.push(buffer.substring(0,buffer.length()-2).trim())
rvXML << "<${buffer.substring(0,buffer.length()-2).trim()}>"
buffer = ''
} else if (buffer.endsWith('=\"') ) {
branches.push(buffer.substring(0,buffer.length()-2).trim())
leaf_mode = 1
rvXML << "<${buffer.substring(0,buffer.length()-2).trim()}>"
buffer = ''
} else if ( buffer.endsWith("}")) {
buffer = ''
rvXML "</${branches.pop()}>"
}
} else {
if ( buffer.endsWith('"')&& !buffer.endsWith('\\"')) {
rvXML << buffer.substring(0,buffer.length()-1)
rvXML << "</${branches.pop()}>"
buffer = ''
leaf_mode = 0
}
}

}
}catch(Exception e){
e.printStackTrace()
rvXML="""<Message>${rvTree}</Message>"""
}
return rvXML
}


org.codehaus.groovy.runtime.metaclass.MethodSelectionException: Could not
find which method getChars() to invoke from this list:
void java.lang.String#getChars([C, int)
public void java.lang.String#getChars(int, int, [C, int)
at groovy.lang.MetaClassImpl.chooseMethod(MetaClassImpl.java:2423)
at
groovy.lang.MetaClassImpl.getNormalMethodWithCaching(MetaClassImpl.java:1005)
at
groovy.lang.MetaClassImpl.getMethodWithCaching(MetaClassImpl.java:959)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:769)
at
groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:946)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
at
org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
at
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(ScriptBytecodeAdapter.java:198)
at RvListener.tranformRVtreeToXML(RvListener.groovy:249)
at RvListener.this$2$tranformRVtreeToXML(RvListener.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
at
groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:946)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:78)
at RvListener.updateBrowser(RvListener.groovy:304)
at RvListener.this$2$updateBrowser(RvListener.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
at
groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:946)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:78)
at RvListener.onMsg(RvListener.groovy:229)
at com.tibco.tibrv.TibrvEvent.invoke(TibrvEvent.java:160)
at com.tibco.tibrv.TibrvImplQueueC.natDispatch(Native Method)
at com.tibco.tibrv.TibrvImplQueueC.dispatch(TibrvImplQueueC.java:44)
at com.tibco.tibrv.TibrvQueue.dispatch(TibrvQueue.java:301)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:230)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:912)
at
groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:946)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:756)
at
org.codehaus.groovy.runtime.InvokerHelper.invokePojoMethod(InvokerHelper.java:766)
at
org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:754)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN(ScriptBytecodeAdapter.java:170)
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0(ScriptBytecodeAdapter.java:198)
at RvListener.run(RvListener.groovy:205)
at java.lang.Thread.run(Thread.java:619)
--
View this message in context: http://old.nabble.com/Could-not-find-which-method-getChars%28%29-to-invoke-from-this-list-tp28517320p28517320.html
Sent from the groovy - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


--
You received this message because you are subscribed to the Google Groups "Groovy Users" group.
To post to this group, send email to groov...@googlegroups.com.
To unsubscribe from this group, send email to groovy-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/groovy-user?hl=en.

citron

unread,
May 10, 2010, 6:09:30 PM5/10/10
to us...@groovy.codehaus.org

using toCharArray() instead of getChars() solved this particular problem.
View this message in context: http://old.nabble.com/Could-not-find-which-method-getChars%28%29-to-invoke-from-this-list-tp28517320p28517651.html
Reply all
Reply to author
Forward
0 new messages