diff --git a/pmd/src/net/sourceforge/pmd/ant/PMDTask.java b/pmd/src/net/sourceforge/pmd/ant/PMDTask.java index d07dd9dec9..75498b2dc0 100644 --- a/pmd/src/net/sourceforge/pmd/ant/PMDTask.java +++ b/pmd/src/net/sourceforge/pmd/ant/PMDTask.java @@ -129,7 +129,9 @@ public class PMDTask extends Task { } } catch (PMDException pmde) { log(pmde.toString(), Project.MSG_VERBOSE); - log(pmde.getReason().getMessage(), Project.MSG_VERBOSE); + if (pmde.getReason() != null && pmde.getReason().getMessage() != null) { + log(pmde.getReason().getMessage(), Project.MSG_VERBOSE); + } if (failOnError) { throw new BuildException(pmde); }