[JAVA-2271] ConnectionString.getCredentialList should return immutable List Created: 02/Aug/16  Updated: 19/Oct/16  Resolved: 22/Sep/16

Status: Closed
Project: Java Driver
Component/s: API, Configuration
Affects Version/s: 3.0.0
Fix Version/s: 3.4.0-rc1, 3.4.0

Type: Improvement Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Jeffrey Yemin
Resolution: Done Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to JAVA-2269 Unable to connect to cluster DB in AW... Closed

 Description   

It's a potential source of bugs for applications who write code like:

  new ConnectionString(...).getCredentialList().add(...);

thinking that a credential is added to the list. But ConnectionString is actually immutable, and getCredentialList returns a new ArrayList each time it's called, making that call a no-op.

The getCredentialList implementation should be updated to return an immutable list so that the above code results in a runtime exception, and the documentation should be updated to reflect that.

The ConnectionString class should also be annotated with @Immutable.



 Comments   
Comment by Githook User [ 22/Sep/16 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-2271: Ensure that ConnectionString.getCredentialList returns an immutable list.
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/a6ba15a7d82433ca63e90538f83b263258e022ef

Generated at Thu Feb 08 08:56:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.