[JAVA-2040] Type casting int and long while using get fails but doesn't throw any exception and gets stuck. Created: 18/Nov/15 Updated: 25/Nov/15 Resolved: 25/Nov/15 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Anshul Goel | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Comments |
| Comment by Jeffrey Yemin [ 25/Nov/15 ] | |||
|
Hi Anshul, As you haven't responded to my question in a while, I'm closing this ticket, but feel free to comment at a later time and I can re-open. | |||
| Comment by Jeffrey Yemin [ 18/Nov/15 ] | |||
|
I'm not sure what you mean. Consider this small test:
It will throw a ClassCastException, as expected, since a Long can not be un-boxed to an int:
| |||
| Comment by Anshul Goel [ 18/Nov/15 ] | |||
|
The problem is : Suppose I have an DBObject object; int x = (int) object.get(key); would get stuck if value returned by object.get(key) is long or vice versa. |