groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Paquette <mar...@mac.com>
Subject Re: Illegal class name "String;1_groovyProxy"
Date Tue, 06 Oct 2015 12:23:26 GMT
Sorry, I looked up only the String#split method in the GDK omitting to look at the JDK, so
I mis-interpreted your intention with the `it.split(‘ ‘, 2)` as wanting to get the first
two results of the split…  I am not an internals expert, but the error you got has a pretty
obscur message and your usage appears legit so, yes I’m pretty sure a bug report would be
welcomed!

May I suggest you use a self-contained code example to reproduce the problem, for example
using a list of String instead of a file ?

> Le 2015-10-05 à 17:06, Rahul Somasunderam <rsomasunderam@transcendinsights.com>
a écrit :
> 
> Thanks Marc. This is what I ended up doing:
> 
> Map readConfig(File rcFile) {
>   rcFile.readLines().
>       findAll        { it.trim().length()  }.
>       findAll        { !it.startsWith('#') }.
>       collectEntries {
>         parts = it.split()
>         [parts.head(), parts.tail().join(' ')]
>       }
> }
> def rcFile = new File('X12deid.cfg')
> println readConfig(rcFile)
> 
> Should I be raising a bug?
> 
> R,
> rahul
> 
> Rahul Somasunderam
> Engineer, Transcend Insights
> 
> 
>> On Oct 5, 2015, at 1:39 PM, Marc Paquette <marcpa@mac.com <mailto:marcpa@mac.com>>
wrote:
>> 
>> How about :
>> 
>>    Map readConfig(File rcFile) {
>>      rcFile.readLines().
>>          findAll        { it.trim().length()  }.
>>          findAll        { !it.startsWith('#') }.
>>          collect        { it.split()[0..1] }.
>>          collectEntries {it}
>>    }
>>    def rcFile = new File('X12deid.cfg')
>>    println readConfig(rcFile)
>> 
>> ?  
>> 
>> The String#split() method does not take any arguments (ignoring the deprecated variants)
but you can get a sub-array of length 2 with [0..1], then collectEntries will convert it to
a Map.
>> 
>> Marc
>> 
>>> Le 2015-10-05 à 16:05, Rahul Somasunderam <rsomasunderam@transcendinsights.com
<mailto:rsomasunderam@transcendinsights.com>> a écrit :
>>> 
>>> Hi,
>>> 
>>> I'm getting this exception:
>>> 
>>> Caught: java.lang.ClassFormatError: Illegal class name "String;1_groovyProxy"
in class file String;1_groovyProxy
>>> java.lang.ClassFormatError: Illegal class name "String;1_groovyProxy" in class
file String;1_groovyProxy
>>> at AnonX12.readConfig(AnonX12.groovy:2)
>>> at AnonX12$readConfig.callCurrent(Unknown Source)
>>> at AnonX12.run(AnonX12.groovy:8)
>>> 
>>> I'm not sure how to debug it. This is my code:
>>> 
>>> Map readConfig(File rcFile) {
>>>   rcFile.readLines().
>>>       findAll        { it.trim().length()  }.
>>>       findAll        { !it.startsWith('#') }.
>>>       collectEntries { it.split(' ', 2)    }
>>> }
>>> def rcFile = new File('X12deid.cfg')
>>> println readConfig(rcFile)
>>> 
>>> Can anyone give me a pointer as to where I should start?
>>> 
>>> R,
>>> rahul
>>> 
>>> Rahul Somasunderam
>>> Engineer, Transcend Insights
>>> 
>>> 
>>> 
>>> The information transmitted is intended only for the person or entity to which
it is addressed
>>> and may contain CONFIDENTIAL material. If you receive this material/information
in error,
>>> please contact the sender and delete or destroy the material/information.
>> 
> 
> 
> The information transmitted is intended only for the person or entity to which it is
addressed
> and may contain CONFIDENTIAL material. If you receive this material/information in error,
> please contact the sender and delete or destroy the material/information.


Mime
View raw message