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());