Patches item #1266090, was opened at 2005-08-22 13:17
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684977&aid=1266090&group_id=119783

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: core
Group: 1.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Ralf Ebert (dreivier)
Assigned to: Nobody/Anonymous (nobody)
Summary: Exception when replacing non-existent components

Initial Comment:
        if (child.getParent() != this)
        {


            // Add to map
            final Component replaced = put(child);
            addedComponent(child);
-            removedComponent(replaced);

            // Look up to make sure it was already in the map
            if (replaced == null)
            {
                throw new IllegalArgumentException(
                        exceptionMessage("A child component with the id '" 
+ child.getId()
                                + "' didn't exist"));
            }
+            removedComponent(replaced);

        }

Because: removedComponent throws a null pointer exception when 
called with null (you don't see the very helpful error message) and it 
doesn't make sense to remove a component which didn't exist. 
Cleaner approach would be checking for component existence at first 
and not changing component tree at all when there is nothing to 
replace.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=684977&aid=1266090&group_id=119783


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to