Re: [Simple-support] RegistryStrategy causes NPE when Converter is used
Brought to you by:
niallg
|
From: Shevek <sh...@an...> - 2012-07-15 22:53:35
|
This bug is still outstanding in 2.6.4 - any chance of a fix in trunk? I have modified RegistryStrategy.read() to call lookup(type, null) again in 2.6.4 and now my code can parse arrays again. S. On Mon, 2012-05-07 at 00:19 -0700, Niall Gallagher wrote: > 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 > |