[JAVA-545] more verbose error messages for illegal field names Created: 25/Mar/12  Updated: 19/Oct/16  Resolved: 27/Aug/12

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

Type: Bug Priority: Minor - P4
Reporter: Steve Strassmann Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

morphia version 0.99
mongodb version v1.8.1



 Description   

To help debugging, please include additional context info (such as the class name and field name) in the error message.

In the example below, it takes guesswork to find out which field and which class this error occurred in.

java.lang.IllegalArgumentException: fields stored in the db can't have . in them
com.mongodb.DBCollection._checkKeys(DBCollection.java:828)
com.mongodb.DBCollection._checkKeys(DBCollection.java:834)
com.mongodb.DBCollection._checkObject(DBCollection.java:817)
com.mongodb.DBCollection.save(DBCollection.java:516)
com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:731)
com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:793)
com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:787)
com.google.code.morphia.dao.BasicDAO.save(BasicDAO.java:109)
com.vmware.cloudchooser.ActivePages$DAO.update(ActivePages.java:60)
org.apache.jsp.admin.admin_002dactive_jsp._jspService(admin_002dactive_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)



 Comments   
Comment by Jeffrey Yemin [ 26/Mar/12 ]

Please upgrade to version 2.7.3 of the Java driver, where this has already been addressed. You will at least be informed about the field name. As for the class name, the Java driver is not aware of it, so you would have to open up a bug in the Morphia project for that one.

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