Skip to content

Commit becdba4

Browse files
authored
Merge pull request #227 from jborgers/master
Fixes issue #226: prevent NullPointerException; Configuration descrip…
2 parents f8d34b2 + ba4c03b commit becdba4

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pluginUntilBuild =
2020
pluginVerifierIdeVersions = IC-2023.3, IC-2024.1, IC-2024.2, IC-2024.3, IC-2025.1
2121

2222
platformType = IC
23-
platformVersion = 2023.3
23+
platformVersion = 2024.1
2424
#platformVersion = 251-EAP-SNAPSHOT
2525
org.jetbrains.intellij.platform.downloadSources=true
2626

src/main/java/com/intellij/plugins/bodhi/pmd/ConfigOption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Configuration options enumeration. Separation between key for persistent state and description to show in the UI.
99
*/
1010
public enum ConfigOption {
11-
TARGET_JDK("Target JDK", "Target JDK (max: " + latestSupportLanguageVersionByPmd("java") + ")", latestSupportLanguageVersionByPmd("java")),
11+
TARGET_JDK("Target JDK", "Target Java version (max: " + latestSupportLanguageVersionByPmd("java") + ")", latestSupportLanguageVersionByPmd("java")),
1212
TARGET_KOTLIN_VERSION("Target Kotlin version", "Target Kotlin version (max: " + latestSupportLanguageVersionByPmd("kotlin") + ")", latestSupportLanguageVersionByPmd("kotlin")),
1313
STATISTICS_URL("Statistics URL", "Statistics URL to export usage anonymously", ""),
1414
THREADS("Threads", "Threads (fastest: " + PMDUtil.AVAILABLE_PROCESSORS + ")", String.valueOf(PMDUtil.AVAILABLE_PROCESSORS));

src/main/java/com/intellij/plugins/bodhi/pmd/PMDProjectComponent.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,12 @@ public void loadState(PersistentData state) {
303303
optionToValue.put(ConfigOption.STATISTICS_URL, "");
304304
}
305305
else {
306-
optionToValue.put(ConfigOption.fromKey(key), state.getOptionKeyToValue().get(key));
306+
// make sure the value is not null, if so, make it the default value, see #226
307+
String optionValue = state.getOptionKeyToValue().get(key);
308+
if (optionValue == null) {
309+
optionValue = ConfigOption.fromKey(key).getDefaultValue();
310+
}
311+
optionToValue.put(ConfigOption.fromKey(key), optionValue);
307312
}
308313
}
309314

0 commit comments

Comments
 (0)