Session storage - invalid component path

  3 posts   Feedicon  
Replies: 2 - Last Post: January 21, 2010 06:52
by: etf
showing 1 - 3 of 3
 
Posted: December 29, 2009 14:11 by etf
There is an issue with session storage. In particular with method getComponentPathname . It is "inflexible and buggy".
The corresponding ticket in SAF tracker is #94.
I have created the ticket in our project also. It is BSAF-70.

Here is the description:


The current implementation of SessionStorage.getComponentPathname is inflexible
and buggy.

Why inflexible:
The component passed to the save/ restore methods might have a different parent
hierarchy when restoring it than it had when it was saved. With the current
implementation, which is dependent on the parent hierarchy, the stored session
information will not be found anymore, because the calculated name is different,
in this case.


Why buggy:

while((c.getParent() != null) ...) {
c = c.getParent();
...
int n = c.getParent().getComponentZOrder(c);

While tested if c.getParent() is not null,
c.getParent().getParent().getComponentZOrder(c) still throws a
NullPointerException, if c.getParent().getParent() is null.

This situation arises if a component is passed to save/ restore, whose top most
parent is not a Window, not an Applet and has no name set.

Proposed solution:
Since only one component tree is stored per file, there is no need to include
the parents of the root component in the name as well. So when calculating the
name from the parent hierarchy just stop if the passed root has been reached.

Note: It should also be possible to avoid to recalculate the name of the parents
eg. by using a Stack.

 
Posted: January 20, 2010 23:26 by mawcs
I have a question related to this. Why is the information stored in a file instead of the Java Preferences API ? Using the Java Preferences API opens the possibility of customized backstores and expanded preferences built in. This is sort of the whole point of an application framework. If you happen to desire that it be put in a file in some arbitrary location, you can change the backstore. If, however, you just want it saved to be retrieved the next time, the Java Preferences hide all of the nitty-gritty and it is super easy.

As it stands now, I have to manage some arbitrary file ("session.xml") for some of my window settings and then other application preferences in the Java Preferences API.

Looking at the code, it would be fairly trivial to implement a dual solution with preferences as default.
 
Posted: January 21, 2010 06:52 by etf
Thanks for you input.

Related jira issue:
http://kenai.com/jira/browse/BSAF-26

ans related topic in the forum:
http://kenai.com/projects/bsaf/forums/open-discussion/topics/1542-Reverting-to-original-implementation-of-the-PersistenceStorage-
Replies: 2 - Last Post: January 21, 2010 06:52
by: etf
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close