[JAVA-159] Issue with ObjectId.isValid method Created: 30/Aug/10 Updated: 29/Oct/10 Resolved: 28/Sep/10 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | None |
| Affects Version/s: | 2.0, 2.1 |
| Fix Version/s: | 2.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Shyamantak | Assignee: | Eliot Horowitz (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
All |
||
| Description |
|
if you see the ObjectId.java (http://github.com/mongodb/mongo-java- isValid(String) method it returns "true" for those strings whose And then if you see the constructor code, you would notice following byte b[] = new byte[12]; Here it expects the string to be of 24 characters. Hence sometimes though isValid method returns true it cannot create a This is an important issue as in some cases does not allow to store valid data. |
| Comments |
| Comment by Shyamantak [ 01/Oct/10 ] |
|
Excellent!! Thanks a lot Eliot for letting know about it. |