Share

Mockrunner

Tracker: Bugs

5 MockHttpServletRequest getSession semantics incorrect - ID: 1876760
Last Update: Settings changed ( aibba )

According to the HttpServletRequest API, a call to getSession() creates a
new session if one has not been created. And a call to getSession(boolean)
does not create a new one if none exists.

As implemented in version .4, getSession() returns a session only if one
was previously set by setSession(), and getSession(false) will return a
session only if getSession() has been called before (regardless of whether
there was already a session in place).

I think this patch to the two methods would fix it:

public HttpSession getSession()
{
if (session == null) {
session = new MockHttpSession();
}
return session;
}

public HttpSession getSession(boolean create)
{
if(!create) return session;
return getSession();
}


The bug may also be in the WebMockObjectFactory.create*MockObjects*
methods, but I don't know those methods well enough to be able to tell.


Ken Koster ( kenkoster ) - 2008-01-21 21:15

5

Closed

None

Alwin Ibba

None

None

Public


Comment ( 1 )




Date: 2008-01-22 06:26
Sender: aibbaProject Admin


http://sourceforge.net/tracker/index.php?func=detail&aid=1788627&group_id=85669&atid=576909


Log in to comment.

Attached File

No Files Currently Attached

Changes ( 3 )

Field Old Value Date By
status_id Open 2008-01-22 06:26 aibba
close_date - 2008-01-22 06:26 aibba
assigned_to nobody 2008-01-22 06:26 aibba