Re: [Simple-support] RegistryStrategy causes NPE when Converter is used
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2012-05-07 07:19:56
|
Cool, thanks for the feedback, ill make sure this is sorted out in the next release. --- On Sun, 6/5/12, Shevek <sh...@an...> wrote: From: Shevek <sh...@an...> Subject: Re: [Simple-support] RegistryStrategy causes NPE when Converter is used To: sim...@li... Received: Sunday, 6 May, 2012, 9:35 PM On Sun, 2012-05-06 at 20:24 -0700, Shevek wrote: > Test case is a bit tangled, but I can provide it if the explanation > below isn't sufficient: > > * Interface Value has a method getType() which returns the type of the > value. > > * However ArrayValue implements this to return the type of the element, > not the array type. See TreeStrategy.read() lines circa 105, where > 'actual', not 'expect' is passed to readArray(). > > * This causes RegistryStrategy's read() method to call lookup() with an > element type, and return a Converter when it is actually holding the > array node, not the element node. > > * This causes the Converter to fail, since it gets given the InputNode > for the array itself, not the InputNode for the array element, and so > the attributes expected are not present. > > Possible solutions: > > 1) Pass 'actual', not 'expect' to ArrayValue. This makes ArrayValue > satisfy the contract of Value, but may break things which rely on > ArrayValue being a special case. > > 2) During deserialization, at the point where RegistryStrategy calls > lookup(), make it ignore Value.getType(), since that is invalid, and > rely on the expected type if present. This may still have to use > Value.getType() during serialization... Changing read() to call lookup(type, null) fixes the bug. write() still calls lookup(type, value) S. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Simple-support mailing list Sim...@li... https://lists.sourceforge.net/lists/listinfo/simple-support |