allink28 / json-simple

Automatically exported from code.google.com/p/json-simple
Apache License 2.0
0 stars 0 forks source link

org.json.simple.parser.ParseException should override get[Localized]Message #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. capture a org.json.simple.parser.ParseException
2. use the 'getMessage' or 'getLocalizedMessage' API
3. returns NULL (when there is a message returned by toString)

What is the expected output? What do you see instead?
Should be the same as the 'toString()' method; or at least comparable useful.

What version of the product are you using? On what operating system?
1.1

Please provide any additional information below.
Right now the ParseException's 'toString' method is overridden. Which
leaves the get[Localized]Message APIs doing nothing. The override should
be in the get[Localized]Message and the inherited toString will work
fine. This will cover all three methods...

Original issue reported on code.google.com by wascally@gmail.com on 9 May 2009 at 10:50

GoogleCodeExporter commented 8 years ago
Thanks. It will be refined in later release.

Original comment by fangyid...@gmail.com on 11 May 2009 at 3:51

GoogleCodeExporter commented 8 years ago
Hi, could any of you fix this issue? Thanks.

Original comment by fangyid...@gmail.com on 2 Jun 2009 at 10:02

GoogleCodeExporter commented 8 years ago
Hi,

Indeed, this bug is very annoying because standard error-handling code 
gets confused due to:

1. It breaks the typical exception.toString() implementation not to report its 
name first
(this is the most disturbing).

2. The exception does not have an exception-message at all.

FIX
---
Please, 
a) move the code from ParseException.toString() to ParseException.getMessage(),
and 
b) stop overridding toString() method.

Original comment by ankos...@gmail.com on 8 Jul 2010 at 6:19

GoogleCodeExporter commented 8 years ago
This is done in r214.

Original comment by jon.cham...@gmail.com on 10 Aug 2013 at 3:40