logo       

RE: Expected or unexpected: msg#00133

lang.groovy.user

Subject: RE: Expected or unexpected

Which JDK do you use?
Is it JDK 1.5?

-----Message d'origine-----
De : Russel Winder [mailto:russel-Q5fiE77zhxfe9xe1eoZjHA@xxxxxxxxxxxxxxxx]
Envoyé : lundi 22 novembre 2004 11:43
À : Groovy Users
Objet : [groovy-user] Expected or unexpected


Is there some default action undertaken when executing a Groovy script?
I have the script:

#! /usr/bin/env groovy

expectedPrompts = [
"Enter length of first side: ",
"Enter length of second side: ",
"Enter length of third side: "
]

which when executed produces:

Exception in thread "main" java.lang.ClassFormatError: Invalid index 1
in LocalVariableTable in class file testIt
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at
groovy.lang.GroovyClassLoader.access$100(GroovyClassLoader.java:81)
at
groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:505)
at
groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:515)
at
org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:604)
at
org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:844)
at
org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:540)
at
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:446)
at
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
at
groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:163)
at groovy.lang.GroovyShell$2.run(GroovyShell.java:220)
at java.security.AccessController.doPrivileged(Native Method)
at groovy.lang.GroovyShell.run(GroovyShell.java:218)
at groovy.lang.GroovyShell.run(GroovyShell.java:165)
at groovy.ui.GroovyMain.processOnce(GroovyMain.java:385)
at groovy.ui.GroovyMain.run(GroovyMain.java:251)
at groovy.ui.GroovyMain.process(GroovyMain.java:234)
at groovy.ui.GroovyMain.main(GroovyMain.java:136)
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:585)
at
org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
at org.codehaus.classworlds.Launcher.main(Launcher.java:461)

but if I add the line:

expectedPrompts.each { println it }

after the list declaration then the script works fine. I would have
thought a script with only a definition should execute correctly doing
nothing but...

--
Russel.
=============================================
Dr Russel Winder +44 20 7585 2200
41 Buckmaster Road +44 7770 465 077
London SW11 1EN, UK russel-Q5fiE77zhxfe9xe1eoZjHA@xxxxxxxxxxxxxxxx




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise