Working with Wicket 1.2.6. Having trouble with the implementation of
Component toString() - it has been implemented by wicket framework to
use an overloaded 'detailed' version that contains the following:

.append((isRenderAllowed() && isVisible())

The repercussions of this is that where component.toString() is called
from within an overridden instance of component isVisible() method we
get ourselves into a recursive loop. Eventually, this leads to a
java.lang.StackOverflowError with varying results depending on app
server. In IBM Websphere version 6.0.2.2 it actually crashes the server
altogether.

Unfortunately, the wicket framework itself unwittingly corroborates in
this situation arising. A contrived example code and scenario where this
can occur is in wicket.model.AbstractDetachableModel :-

 public final Object getObject(final Component component)
        {
                attach();
                try
                {
                        return onGetObject(component);
                }
                catch (RuntimeException e)
                {
                        throw new WicketRuntimeException("unable to get
object, model: " + this
                                        + ", called with component " +
component, e);
                }
        }

Above the WicketRuntimeException message string calls the
component.toString() method. Below is an overridden isVisible()
implementation (from within MyPage component) where a PropertyModel
fails to find the appropriate getXXX for the expression XXX leading to a
WicketRuntimeException in wicket.util.lang.PropertyResolver. For
instance:-

                final PropertyModel model = new PropertyModel(this,
"incorrectNameOfListGetMethod");
                
                Panel myPanel = new MyPanel("myPanel") {
                        public boolean isVisible() {
                                return
((List)model.getObject(this)).size() > 0;
                        }
                };

Stacktrace of error:-

at
wicket.util.lang.PropertyResolver.findGetter(PropertyResolver.java:374)
        at
wicket.util.lang.PropertyResolver.getGetAndSetter(PropertyResolver.java:
233)
        at
wicket.util.lang.PropertyResolver.getObjectAndGetSetter(PropertyResolver
.java:200)
        at
wicket.util.lang.PropertyResolver.getValue(PropertyResolver.java:88)
        at
wicket.model.AbstractPropertyModel.onGetObject(AbstractPropertyModel.jav
a:132)
        at
wicket.model.AbstractDetachableModel.getObject(AbstractDetachableModel.j
ava:104)
        at com.arcs.spike.page.MyPage$1.isVisible(MyPage.java:29)


Is there some way we can work easily around this sort of issue? Eg. A
hook in the framework etc to create our own versions of components (with
overridden implementaiton of toString() via a factory? Would rather
avoid patching the wicket jar if possible. Thanks in advance for any
help.

>> apologies if footer of email is verbose - company policy restricts us
to include this and have no other email account available <<

**********************************************************************
This email (and any attachments) may contain privileged and/or confidential 
information. If you are not the intended recipient please do not disclose, 
copy, distribute, disseminate or take any action in reliance on it. If you have 
received this message in error please reply and tell us and then delete it. 
Should you wish to communicate with us by email we cannot guarantee the 
security of any data outside our own computer systems. For the protection of 
Legal & General's systems and staff, incoming emails will be automatically 
scanned. Any information contained in this message may be subject to applicable 
terms and conditions and must not be construed as giving investment advice 
within or outside the United Kingdom. 

Legal & General Group plc is registered in England under company number 1417162 
and is a holding company.

The registered office for all companies in the Legal & General group is One 
Coleman Street London EC2R 5AA.

The following subsidiary companies of Legal & General Group Plc are authorised 
and regulated by the Financial Services Authority: Legal & General Partnership 
Services Limited, Legal & General Insurance Limited, Legal & General Assurance 
Society Limited, Legal & General (Unit Trust Managers) Limited and Legal & 
General (Portfolio Management Services) Limited.

Legal & General International (Ireland) is incorporated in Ireland under 
company number 440141 with its registered office at Alexandra House, The 
Sweepstakes, Ballsbridge, Dublin 4 and is authorised by the Financial Regulator 
in Ireland and by the Financial Services Authority for the conduct of insurance 
business in the UK. 

Full details can be found at http://www.legalandgeneralgroup.com/ 

**********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to