Skip to main content

[json-processing-spec users] JSON exceptions

  • From: Jitendra Kotamraju < >
  • To:
  • Cc:
  • Subject: [json-processing-spec users] JSON exceptions
  • Date: Fri, 19 Oct 2012 13:50:32 -0700

Exceptions in the current API:
* JsonException (a runtime exception) :
- wraps ClassNotFoundException, InstantiationException, IllegalAccessException(only for loading default provider, shouldn't happen)
   - Wraps UnsupportedEncodingException
   - Wraps IOException
   - Thrown for duplicate keys
   - or anything else(for e.g parsing errors)
* Other runtime exceptions are where they are appropriate : ServiceConfigurationError, IllegalArgumentException, IndexOutOfBoundsException, ClassCastException, IllegalStateException, NumberFormatException, ArithmeticException, NoSuchElementException, UnsupportedOperationException

Here are some of my thoughts:

* Any use in defining JsonParserException and JsonGeneratorException ?
* JsonException is thrown for duplicate keys while building JsonObject. Should we use a new exception or use IllegalArgumentException ?
* Should we use CharSet instead of String where encoding parameter is passed ? For e.g.:
s/JsonReader(InputStream in, String encoding)/JsonReader(InputStream, CharSet)
JDK 7 defined constants for standard charsets in StandardCharsets. For e.g StandardCharsets.UTF_8
Applications take advantage of those constants when they use JDK 7. That also means that API doesn't have to specify
of wrapping UnsupportedEncodingException in many places. Infact, it seems to be that some places UnsupportedCharsetException/IllegalCharsetNameException would be more appropriate than UnsupportedEncodingException.


[json-processing-spec users] JSON exceptions

Jitendra Kotamraju 10/19/2012

[json-processing-spec users] Re: JSON exceptions

Tatu Saloranta 10/20/2012

[json-processing-spec users] Re: JSON exceptions

Eugen Cepoi 10/20/2012

[json-processing-spec users] Re: JSON exceptions

Tatu Saloranta 10/20/2012

[json-processing-spec users] Re: JSON exceptions

Jitendra Kotamraju 10/22/2012

[json-processing-spec users] Re: JSON exceptions

Jitendra Kotamraju 10/21/2012

[json-processing-spec users] Re: JSON exceptions

Tatu Saloranta 10/22/2012

[json-processing-spec users] Re: JSON exceptions

Eugen Cepoi 10/25/2012

[json-processing-spec users] Re: JSON exceptions

Jitendra Kotamraju 10/25/2012

[json-processing-spec users] Re: JSON exceptions

Eugen Cepoi 10/25/2012

[json-processing-spec users] Re: JSON exceptions

Jitendra Kotamraju 10/25/2012
 
 
Close
loading
Please Confirm
Close