takcy / openid4java

Automatically exported from code.google.com/p/openid4java
Apache License 2.0
0 stars 0 forks source link

ConsumerManager.setPrefAssocSessEnc does not add priority to existing AssociationSessionType #119

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

The ConsumerManager.setPrefAssocSessEnc does not behave as I would expect. If I 
call consumerManager.setPrefAssocSessEnc(AssociationSessionType.DH_SHA1), the 
first association requested is still AssociationSessionType.DH_SHA256.

I believe this is a bug in the ConsumerManager#associate(DiscoveryInformation 
discovered, int maxAttempts) implementation. The javadoc on LinkedHashMap.put 
states "Associates the specified value with the specified key in this map. If 
the map previously contained a mapping for this key, the old value is 
replaced." Since the key DH_SHA1 already exists, it's ordering remains the same 
(it's null value is just replaced with another null value) and DH_SHA1 does not 
get priority.

I have attached a patch that includes a JUnit that reproduces the issue and a 
fix. 

Original issue reported on code.google.com by rwi...@gmail.com on 8 Jun 2010 at 3:15

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed in r693, thank you for the patch!

Original comment by Johnny.B...@gmail.com on 1 Nov 2012 at 12:24