...
All committers are expected to follow these standards; Checkstyle or similar (Lynt) is used to check compliance.
CDAP 6.9+
CDAP starting from version 6.8 uses slightly relaxed Google Coding Standards.
CDAP 6.8 and before
Summary
The main things for layout purposes in the standard are:
...
- try/catch blocks should be laid out like any other compound statement [mandatory]. For example:
try { String str = someStrings[specifiedIndex]; } catch (IndexOutOfBoundsException ex) { // The user specified an incorrect index, better take // some remedial action. }
When an exception is caught but ignored then a comment should be supplied explaining the rationale [mandatory]. For example:
try { propertySet.setProperty("thingy", new Integer(10)); } catch (UnknownPropertyException ignore) { // This exception will never occur as "thingy" definitely exists }
- All exceptions that are likely to be thrown by a method should be documented, except if they are runtime exceptions (note: the compiler will not enforce catch blocks for runtimes even if they are mentioned in the throws clause) [mandatory]. For example:
/* Comment snippet: * @exception IllegalValueException Thrown if values is null or * any of the integers it contains is null. */ private Integer sum(Integer[] values) throws IllegalValueException
- InterruptedException should be caught and should not be ignored. It should set the correct state of the thread or status is checked before rethrowing.