/** * Extract errors from groovy exception, coding defensively against * possible null values. * @param e the CompilationFailedException * @return A List of errors */ private List<?> getErrors(final CompilationFailedException e) { ProcessingUnit unit = e.getUnit(); if (unit != null) { ErrorCollector collector = unit.getErrorCollector(); if (collector != null) { List<?> errors = collector.getErrors(); if (errors != null) { return errors; } } } return Collections.EMPTY_LIST; } }