JSON Integration Adapter Code Review 2 Changes

From CDOT Wiki
Revision as of 21:48, 26 January 2014 by Andrew (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Important.png
This page may be obsolete.
It contains historical information.

JSONMessageFormatter

Tasks Status
Line 35
// attributes Should be // associations
Compelete
Line 40

Move s_logger (final static members) to right before // operations

Complete
Line 244

if (!innerPart.isCollection() || (bArrayElement && innerPart.isCollection())) should be if (!innerPart.isCollection() || bArrayElement)

Complete
Line 250, 265, 311

You shouldn’t have to catch ClassCastExceptions. You should catch all Exceptions at the top level and wrap them in an Integration exception with the cause exception contained. Like this:

     catch (IntegrationException e)
     {
        throw e;
     }
     catch (Exception e)
     {
        throw new IntegrationException("err.integration.format",
           new Object[]{message.getName()}, e);
     }

Complete
Line 369 Remove it Complete

JSONMessageParser

Tasks Status
Line 297, 338

In method parseObjectArray m_nListDepth is decremented, but never incremented. Is this a bug?

Complete
Line 366

parseValue(messagePart) is always called with m_currentMessagePart so you don’t need the argument.

Complete
Line 409, 443

In method parseArray m_nListDepth is decremented, but never incremented. Is this a bug?

Complete
Line 502

Move to Line 506 – it’s not faster

Complete

RootJSONMessagePartMapping

Tasks Status
Line 50, 75
Part instanceof PrimitiveMessagePart should never be true here. You can assert that it isn’t.

To make sure that it isn’t iterate over child parts, get their mapping and call finish on the mapping.

Complete


RootJSONMessagePartMapping

Tasks Status
Line 31
  • FORMAT_DEFAULT should be FORMAT_OBJECT
  • You can mention it’s the default in the documentation (javadoc/xsd).
Complete


JSONParser

Tasks Status
Line 71
  • Method parse is overridden for no reason.
Complete


JSONWriter

Tasks Status
Line 53, 76

Instead of having getEndObject and getEndArray methods create public static constants for these characters and use them everywhere.

Complete