Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot set readonly property - when modifing attributes  RSS feed

 
Bill Lee
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am attempting to modify an attribute based on a criteria. When I attempt the following, I get

Exception in thread "main" groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: value for class: java.lang.String

allRecords.findAll{
it.'@ZipCode'.equals('60245')
}each{
it.'@State'.value = 'IL'
}

Does anyone know how to surpass this exception? Thank.s
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!