Why exception messages suck

One of my pet peeves is that library builders take special care to check for errors or exception conditions, but fail miserably to communicate what is wrong and how to fix it. The case today: json-lib (2.1).

I’m trying to use it to serialize a bean to JSON format and to compare it to a JSON serialized bean (it is easier to check text instead of the debugger trees). But the json-lib tells me that there is a cycle in the bean.

Caused by: net.sf.json.JSONException: There is a cycle in the hierarchy!
	at net.sf.json.util.CycleDetectionStrategy$StrictCycleDetectionStrategy.handleRepeatedReferenceAsObject(CycleDetectionStrategy.java:73)
	at net.sf.json.JSONObject._fromBean(JSONObject.java:658)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:182)
	at net.sf.json.JSONObject._processValue(JSONObject.java:2426)
	at net.sf.json.JSONObject._setInternal(JSONObject.java:2447)
	at net.sf.json.JSONObject.setValue(JSONObject.java:1189)
	at net.sf.json.JSONObject._fromBean(JSONObject.java:725)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:182)
	at net.sf.json.JSONObject._processValue(JSONObject.java:2426)
	at net.sf.json.JSONObject._setInternal(JSONObject.java:2447)
	at net.sf.json.JSONObject.setValue(JSONObject.java:1189)
	at net.sf.json.JSONObject._fromBean(JSONObject.java:725)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:182)
	at net.sf.json.JSONObject._processValue(JSONObject.java:2426)
	at net.sf.json.JSONObject._setInternal(JSONObject.java:2447)
	at net.sf.json.JSONObject.setValue(JSONObject.java:1189)
	at net.sf.json.JSONObject._fromBean(JSONObject.java:725)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:182)
	at net.sf.json.JSONObject._processValue(JSONObject.java:2426)
	at net.sf.json.JSONObject._setInternal(JSONObject.java:2447)
	at net.sf.json.JSONObject.setValue(JSONObject.java:1189)
	at net.sf.json.JSONObject._fromBean(JSONObject.java:725)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:182)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:145)

Very informative stack trace indeed.

Wicket in Action – MEAP chapters 9 and 10

I have a premonition that you will be able to snuggle up in front of your CO2 neutral fireplace sipping a nice cup of hot chocolate with a freshly printed copy of Wicket in Action‘s chapters 9 and 10 this weekend.

If you are in a more warmer climate (it is freezing out here) you can read them in your hammock on the porch looking at a nice sunset, sipping a martini.

Keep checking your inbox tomorrow!