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> 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.