Closed GoogleCodeExporter closed 8 years ago
fix:
Make a custom DomainObjectReader and override readFromXml(...) and change the
line 27 with result.id = this.idFromMap(map)
And add those methods at the end
private idFromMap(Map map) {
if (!map.id) {
return null
}
if (map.id instanceof Number) {
return map.id.toLong()
} else if(isNumeric(map.id)) {
return Long.parseLong(map.id)
}
return map.id
}
def isNumeric = {
def formatter = java.text.NumberFormat.instance
def pos = [0] as java.text.ParsePosition
formatter.parse(it, pos)
// if parse position index has moved to end of string
// them the whole string was numeric
pos.index == it.size()
}
Original comment by stest...@gmail.com
on 4 Aug 2011 at 2:50
Huge thanks for the fix. Good work!
I just pushed it to master
(https://github.com/krasserm/grails-jaxrs/commit/933daa67a19416781d703f96818c132
85665009a). Please let me know if it works for you now. Will add tests tomorrow.
Original comment by krass...@googlemail.com
on 4 Aug 2011 at 6:07
Tests added.
Original comment by krass...@googlemail.com
on 5 Aug 2011 at 4:19
Original issue reported on code.google.com by
stest...@gmail.com
on 4 Aug 2011 at 2:37