Donate Share

Java Bean Library

Tracker: Bugs

5 Problem with bean copying - ID: 2689861
Last Update: Settings changed ( sf-robot )

Hello, I use beanlib and hibernate-beanlib with the version 3.3.0beta21 and
I have a such case:
I try to copy a single bean which has many collections of
type Set. Those sets use hashCode method to properly store object. In my
hashCode and equals methods I use properties of other objects. When I do
such scenario then sometimes those other objects are not populated yet,
becouse recursive bean population algorithm started populating collection
which probably contains back reference to this object and then NullPointer
is thrown in hashcode method, due to the fact that this object is in
beanTransformer.clonedMap map already, but it hasn't bean populated yet. It
is kinda hard to explain so I attached an example project which is build
from two beans and one test class which throws such nullpointer.
Thanks for replay in case i do something wrong.
Cheers


Nobody/Anonymous ( nobody ) - 2009-03-17 10:07

5

Closed

None

Joe D. Velopar

None

None

Public


Comments ( 3 )

Date: 2009-09-21 02:21
Sender: sf-robotSourceForge.net Site Admin

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).


Date: 2009-09-06 06:05
Sender: joe_emporiumProject AdminAccepting Donations

When I ran the examples, the NPE occurred outside of beanlib. Is there a
bug in your example project ?

Exception in thread "main" java.lang.NullPointerException
at bean.Bean2.hashCode(Bean2.java:53)
at java.util.HashMap.put(HashMap.java:372)
at java.util.HashSet.add(HashSet.java:200)
at bean.Test.main(Test.java:17)


Date: 2009-03-17 10:09
Sender: nobody

Sorry, I didnt inserted my email address. Its
andrzejlobodzki@econsulting.pl


Attached File ( 1 )

Filename Description Download
beanlib.zip Example project Download

Changes ( 7 )

Field Old Value Date By
close_date 2009-09-06 06:05 2009-09-21 02:21 sf-robot
allow_comments 1 2009-09-21 02:21 sf-robot
status_id Pending 2009-09-21 02:21 sf-robot
close_date - 2009-09-06 06:05 joe_emporium
status_id Open 2009-09-06 06:05 joe_emporium
assigned_to nobody 2009-09-03 05:41 joe_emporium
File Added 318157: beanlib.zip 2009-03-17 10:07 nobody