Emmanuel Lecharny created FC-49:
-----------------------------------

             Summary: The J2eePolicyMgrImpl.createSession() class stores the 
wront type into the context
                 Key: FC-49
                 URL: https://issues.apache.org/jira/browse/FC-49
             Project: FORTRESS-CORE
          Issue Type: Bug
    Affects Versions: 1.0.0-RC39
            Reporter: Emmanuel Lecharny
             Fix For: 1.0.0-RC40


The Map we use in this method should contain a {{<String, Session>}}. In the 
method, we store a {{String}} (a serialized version of the session). In order 
for this to be possible, the {{Map}} has no generic :

{code}
        HashMap context = new HashMap<String, Session>();
{code}

Obviously, using something like :

{code}
        HashMap<String, Session> context = new HashMap<String, Session>();
{code}

will cause a compilation error a few lines down :

{code}
        String ser = serialize( session );

        // Store the serialized principal inside the context hashmap
        // which allows overriden toString to return it later, from within an 
application thread.
        // This facilitates assertion of rbac session from the tomcat realm 
into the web application session.
        context.put( TcPrincipal.SERIALIZED, ser );  <<---------- Error !
{code}

This serialized form of the session is only used by the 
{{TcTerminal.toString()}} method :

{code}
    public final String toString()
    {
        String ser = null;
        HashMap context = getContext();
        if ( context != null )
        {
            ser = (String)context.get( SERIALIZED );
        }
        return ser;
    }
{code}

At this point, I think we should simply use a {{HashMap<String, Object>}} data 
structure, and cast the content accordingly to the {{String}} we use as a key 
(ie, to {{Session}} when the key is {{"session"}} and to {{String}} when it's 
{{"SERIALIZED"}} 




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to