Fix Javadoc Separate test cases into separate test methods and add some additional tests. Clean up the code and fix a couple of edge cases This is part 1 of 2 of the fix for CVE-2015-5174