[JAVA-720] DBCursor.next() throws the wrong Exception Created: 23/Dec/12  Updated: 19/Mar/13  Resolved: 30/Dec/12

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.10.1
Fix Version/s: 2.11.0

Type: Bug Priority: Minor - P4
Reporter: Sean Reilly Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The contract for java.util.Iterator specifies that next() should throw a NoSuchElementException "if the iteration has no more elements". Instead, the java driver throws a RuntimeException. See http://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html#next() for more details.

Backwards compatibility: IMO, this can be fixed without backwards compatibility concerns, because NoSuchElementException is a subclass of RuntimeException.



 Comments   
Comment by Jeffrey Yemin [ 30/Dec/12 ]

Merged pull request with a fix: https://github.com/mongodb/mongo-java-driver/pull/94

Comment by Sean Reilly [ 23/Dec/12 ]

Github pull request coming momentarily.

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