Marc+Paul:

Thanks for your advice. Here's the link to the JIRA - 
https://issues.apache.org/jira/browse/GROOVY-7616

R,
rahul

Rahul Somasunderam
Engineer, Transcend Insights


On Oct 6, 2015, at 5:23 AM, Marc Paquette 
<mar...@mac.com<mailto:mar...@mac.com>> wrote:

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 
<rsomasunde...@transcendinsights.com<mailto:rsomasunde...@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 
<mar...@mac.com<mailto:mar...@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 
<rsomasunde...@transcendinsights.com<mailto:rsomasunde...@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.



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.

Reply via email to