[Seaside-dev] Issue 68 in seaside: WAApplication>>#sessionCookieFor: somtimes answers anAssociation instead of aCookie

codesite-noreply at google.com codesite-noreply at google.com
Fri May 16 18:42:48 UTC 2008


Issue 68: WAApplication>>#sessionCookieFor: somtimes answers 
anAssociation instead of aCookie
http://code.google.com/p/seaside/issues/detail?id=68

New issue report by wembley.instantiations:
What steps will reproduce the problem?
1. Run WAApplicationTest under SUnit
2. Notice that testWrongPrefix test fails.

What is the expected output? What do you see instead?

WAApplication>>#sessionCookieFor: should always answer either nil or a
cookie.  However, for this testcase, it is answering an association with
the key 'aCookie' and value 'anOrderedCollection'.  This occurs because
this code snippet from sessionCookieFor: is:

	candidates := candidates reject: [ :each |
		| path |
		path := each value.
		path notEmpty and: [ path first = '..' ] ].

	candidates isEmpty
		ifTrue: [  ^nil ].
	candidates size = 1
		ifTrue: [ ^candidates first].

	candidates sort: [ :a :b |
		a value size < b value size ].
	
	^candidates first key

but should be:

	candidates := candidates reject: [ :each |
		| path |
		path := each value.
		path notEmpty and: [ path first = '..' ] ].

	candidates isEmpty
		ifTrue: [  ^nil ].
	candidates size = 1
		ifTrue: [ ^candidates first key].  "<== Notice change here"

	candidates sort: [ :a :b |
		a value size < b value size ].
	
	^candidates first key

Actually, I think it would be clearer to rewrite this snippet as:

	candidates := candidates reject: [ :each |
		| path |
		path := each value.
		path notEmpty and: [ path first = '..' ] ].

	candidates isEmpty
		ifTrue: [  ^nil ].
	candidates size > 1
		ifTrue: [
			candidates sort: [ :a :b |
				 a value size < b value size ]].
	
	^candidates first key

What version of the product are you using? On what operating system?

Seaside 2.9
  WAApplication 2.9-pmm.144
  WAApplicationTest 2.9-pmm.117

WinXP

Please provide any additional information below.



Issue attributes:
	Status: New
	Owner: ----
	Labels: Type-Defect Priority-Medium

-- 
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings


More information about the seaside-dev mailing list