Property binding code doesn't like Map.Entry
--------------------------------------------

                 Key: STS-330
                 URL: http://mc4j.org/jira/browse/STS-330
             Project: Stripes
          Issue Type: Bug
          Components: Validation
    Affects Versions: Release 1.4.2
            Reporter: Tim Fennell
         Assigned To: Tim Fennell
             Fix For: Release 1.5


The summary is merely an example.  The actual case is that the code does not 
deal well with the following scenario:
1. Stripes gets handed an instance of Foo
2. Foo implements a public interface, AnInterface which specifies public 
getter/setter methods
3. Foo is actually a protected or private (inner) class
4. Stripes tries to get or set the property value of one of the properties 
specified in the public interface AnInterface

The primary example is with Map.Entry, which is public and specifies accessors 
for 'key' and 'value'.  However, in the JDK all the implementations of 
Map.Entry are non-accessible classes (usually private inner classes of their 
respective Map implementations).  The PropertyDescriptors handed back by the 
JDK Introspector provide as accessor/mutator methods, the public methods of 
these private classes which cannot be executed via reflection without an 
IllegalAccessException!

I think there are two possible solutions:
1) if Introspector provides public methods that are not accessible, call 
setAccessible(true) on them
2) Use the method names and parameter types and search up the hierarchy for a 
public interface that specifies the method. Take the method from the public 
interface and call invoke() on that.

I've verified that they both work.  #2 is probably more correct, but is also a 
lot more work (to code, and at runtime).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://mc4j.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to