jfree/jfreechart-fse — pull request #23 by amishwins (2013-10-27 16:58:54+00:00)
Title: Fix bug 1084 - throw an exception if the wrong object is used for an edg...

...e

This commit fixes the issue as described in http://sourceforge.net/p/jfreechart/bugs/1084/. The "add" method in BorderArrangement first checks if the object passed in is null, and if not, then immediately casts it to a RectangleEdge. If the object is not a Rectangle edge, then a ClassCastException is thrown as described by the author of bug 1084. I've added a condition which checks if the object passed in is not an instance of RectangleEdge. If it is not, then an IllegalArgumentException is thrown, which is more appropriate.

There is no risk here to client code since RectangleEdge is an enumeration, and thus cannot be extended. Also included are two unit tests which verify the contract.