[ https://issues.apache.org/jira/browse/GROOVY-4020?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-4020: -------------------------------- Labels: ClassFormatError (was: ) > java.lang.ClassFormatError when using the name including "-" sign > ----------------------------------------------------------------- > > Key: GROOVY-4020 > URL: https://issues.apache.org/jira/browse/GROOVY-4020 > Project: Groovy > Issue Type: Bug > Components: Compiler > Affects Versions: 1.6.5 > Reporter: Tran The Trong > Priority: Major > Labels: ClassFormatError > > I'm not sure if there any constraint with the name parameter before passing > to GroovyCodeSource but it is raising an exception if the name includes "-" > sign : > GroovyCodeSource gcs = new GroovyCodeSource(inputStream, "file-name.gtmpl", > "/groovy/shell"); > Here is the exception : > Caused by: java.lang.ClassFormatError: Illegal class name "File-name" in > class file File-name > at java.lang.ClassLoader.defineClass1(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:616) > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) > at groovy.lang.GroovyClassLoader.access$200(GroovyClassLoader.java:54) > at > groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:482) > at > groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:499) > at > groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:503) > at > org.codehaus.groovy.control.CompilationUnit$10.call(CompilationUnit.java:728) > at > org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:925) > at > org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:462) > at > groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:278) > It seems that the name parameter is used for createing Class in Java, so it > must be a binary name as defined by the Java Language Specification. If so, > the name would be validated and converted to good one ? Or I must to take > care of that myself before using GroovyCodeSource ? -- This message was sent by Atlassian Jira (v8.20.7#820007)