From 777ad8caa2cabf6c4276bf96a3016f60da15f8dc Mon Sep 17 00:00:00 2001 From: Jan Hentschel Date: Sat, 23 Dec 2017 17:38:49 +0100 Subject: [PATCH] HBASE-19604 Fixed Checkstyle errors in hbase-protocol-shaded and enabled Checkstyle to fail on violations --- hbase-protocol-shaded/pom.xml | 16 ++++++++++++++++ .../hadoop/hbase/util/ForeignExceptionUtil.java | 10 ++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/hbase-protocol-shaded/pom.xml b/hbase-protocol-shaded/pom.xml index ab04e98d167..03030b82cc9 100644 --- a/hbase-protocol-shaded/pom.xml +++ b/hbase-protocol-shaded/pom.xml @@ -179,6 +179,22 @@ + + org.apache.maven.plugins + maven-checkstyle-plugin + + + checkstyle + validate + + check + + + true + + + + diff --git a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/util/ForeignExceptionUtil.java b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/util/ForeignExceptionUtil.java index 0e4bb94973f..f8cef893d7d 100644 --- a/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/util/ForeignExceptionUtil.java +++ b/hbase-protocol-shaded/src/main/java/org/apache/hadoop/hbase/util/ForeignExceptionUtil.java @@ -93,7 +93,10 @@ public final class ForeignExceptionUtil { GenericExceptionMessage payload = gemBuilder.build(); ForeignExceptionMessage.Builder exception = ForeignExceptionMessage.newBuilder(); exception.setGenericException(payload); - if (source != null) exception.setSource(source); + if (source != null) { + exception.setSource(source); + } + return exception.build(); } @@ -104,7 +107,10 @@ public final class ForeignExceptionUtil { */ public static List toProtoStackTraceElement(StackTraceElement[] trace) { // if there is no stack trace, ignore it and just return the message - if (trace == null) return null; + if (trace == null) { + return null; + } + // build the stack trace for the message List pbTrace = new ArrayList<>(trace.length); for (StackTraceElement elem : trace) {