Please ignore the hyperlink that showed up in the code snippet...  It
wasn't there when I was typing the e-mail.  Gotta love MS.  :-) 


The electronic mail message you have received and any files transmitted
with it are confidential and solely for the intended addressee(s)'s
attention. Do not divulge, copy, forward, or use the contents,
attachments, or information without permission of Fannie Mae.
Information contained in this message is provided solely for the purpose
stated in the message or its attachment(s) and must not be disclosed to
any third party or used for any other purpose without consent of Fannie
Mae. If you have received this message and/or any files transmitted with
it in error, please delete them from your system, destroy any hard
copies of them, and contact the sender.      


-----Original Message-----
From: Gentry, Michael (Contractor) [mailto:[EMAIL PROTECTED]

Sent: Tuesday, January 30, 2007 9:03 AM
To: Tapestry users
Subject: Tapestry prop: suggestion (or question)

I've downloaded and tried out the prop: prefix extension from HLS.  One
thing I was *really* hoping for, compared to OGNL, is that it would
ignore null pointers, at least on reads.  I have report-type pages
(read-only) where I can sometimes have thousands of rows with 10-15
columns.  Each of those columns currently has bulky cover methods which
do NPE protection in case a relationship is missing (the actual values
almost always come from a dotted path: foo.bar.baz.status, and OGNL will
blow up if "bar" is null).  I was hoping the prop: extension would
handle this, but it seems to work just like OGNL if it hits a null.  If
something doesn't exist, I'm pretty happy with just getting a null back
and displaying nothing.
 
I played with the code a bit and this seems to work if you edit
PropertyAccessorBinding.java and change the getObject() method:
 
    public Object getObject()
    {
        return _accessor.readProperty();
    } <http://www.len.ro/work/articles/tapestry-ajax-application-1/> 
 
to:
 
    public Object getObject()
    {
      try
      {
        return _accessor.readProperty();
      }
      catch (NullPointerException exception)
      {
        // Ignore NPE on reads ...
        return null;
      }
    }
 
A) Does this seem like a reasonable thing to do?
B) If yes to A, could it maybe be included in the actual prop: package
(would beat maintaining a separate branch).
 
Thanks!
 
/dev/mrg
 
PS. I didn't alter setObject() ... I'd consider that an actual error if
you were trying to set things through nulls.
 

The electronic mail message you have received and any files transmitted
with it are confidential and solely for the intended addressee(s)'s
attention. Do not divulge, copy, forward, or use the contents,
attachments, or information without permission of Fannie Mae.
Information contained in this message is provided solely for the purpose
stated in the message or its attachment(s) and must not be disclosed to
any third party or used for any other purpose without consent of Fannie
Mae. If you have received this message and/or any files transmitted with
it in error, please delete them from your system, destroy any hard
copies of them, and contact the sender.     


 

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

Reply via email to