BUG-4109: Correct checkstyle dependency and avoid a couple of NPEs 54/26854/3
authorStephen Kitt <skitt@redhat.com>
Fri, 11 Sep 2015 14:39:39 +0000 (16:39 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 17 Sep 2015 10:45:44 +0000 (10:45 +0000)
commitdd5ea5fdbcac8039df928bc7a076a48b5e5c2a81
tree5265b6aa5650bd2a34c5ff8bcb94739bd8f966f5
parentf57567345ea5fa7d38179889e2748003a38c384f
BUG-4109: Correct checkstyle dependency and avoid a couple of NPEs

We need to ensure that the version of checkstyle used to build the
plugin extension is the same as that used when running the
maven-checkstyle-plugin. (Otherwise, ABI changes break the checks,
notably changes in type values.) To do this, depend on the
maven-checkstyle-plugin; it's not particularly elegant but it gets the
job done.

Also fix a couple of places where a type or variable name is retrieved
before further checks which could be done beforehand. By doing the
risk-free checks before calculating the type or variable name, we
avoid NPEs.

Clean up an "if () { return true; } else { return false; }".

Change-Id: Iec696a7486e43f52db69befe12c6a053903c879d
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
common/checkstyle-logging/pom.xml
common/checkstyle-logging/src/main/java/org/opendaylight/yangtools/checkstyle/CheckLoggingUtil.java
common/checkstyle-logging/src/main/java/org/opendaylight/yangtools/checkstyle/LoggerMustBeSlf4jCheck.java
common/checkstyle-logging/src/main/java/org/opendaylight/yangtools/checkstyle/LoggerVariableNameCheck.java