On 05/10/2013 08:03 AM, David Holmes wrote:
Short version:
Cache the value returned by toString and use it to copy-construct a new
String on subsequent calls to toString(). Clear the cache on any
mutating operation.
webrev: http://cr.openjdk.java.net/~dholmes/8013395/webrev.v2/
Shouldn't you clear the cache before the modification, in case the
modification throws an exception mid-way? But you cache String (and not
char[]s), so it's probably not that important.
--
Florian Weimer / Red Hat Product Security Team