From 00e27b4a373ba025470d1a2fe2a7e1ad82dfbc08 Mon Sep 17 00:00:00 2001 From: Peter Kofler Date: Sat, 23 Mar 2013 15:42:02 +0100 Subject: [PATCH] fix Nullpointer Exception when using -l jsp --- .../main/java/net/sourceforge/pmd/cli/PMDParameters.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pmd/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java b/pmd/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java index e747221b60..993c73a567 100644 --- a/pmd/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java +++ b/pmd/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java @@ -118,7 +118,11 @@ public class PMDParameters { configuration.setSuppressMarker(params.getSuppressmarker()); configuration.setThreads(params.getThreads()); for ( LanguageVersion language : LanguageVersion.findVersionsForLanguageTerseName( params.getLanguage() ) ) { - configuration.getLanguageVersionDiscoverer().setDefaultLanguageVersion(language.getLanguage().getVersion(params.getVersion())); + LanguageVersion languageVersion = language.getLanguage().getVersion(params.getVersion()); + if (languageVersion == null) { + languageVersion = language.getLanguage().getDefaultVersion(); + } + configuration.getLanguageVersionDiscoverer().setDefaultLanguageVersion(languageVersion); } try { configuration.prependClasspath(params.getAuxclasspath());