Re: [Simple-support] RegistryStrategy causes NPE when Converter is used
Brought to you by:
niallg
|
From: Niall G. <gal...@ya...> - 2012-07-16 03:34:13
|
Can you send me on a patch with your fix or a test case, I think I know what your talking about here, but not 100% sure. --- On Sun, 15/7/12, Shevek <sh...@an...> wrote: > From: Shevek <sh...@an...> > Subject: Re: [Simple-support] RegistryStrategy causes NPE when Converter is used > To: "Niall Gallagher" <gal...@ya...> > Cc: sim...@li... > Received: Sunday, 15 July, 2012, 3:53 PM > 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 > > > > > |