diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c0e92d..c8df564 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.4.2 +* Fix storage deserialization crash on unknown actions value #273 + ## 1.4.1 * Fix ``Add class qualifier to static member access outside declaring class`` not working correctly for ``switch`` statements #263 diff --git a/build.gradle b/build.gradle index 8265b6a..3069aad 100644 --- a/build.gradle +++ b/build.gradle @@ -3,13 +3,13 @@ plugins { id 'idea' id 'checkstyle' id 'pmd' - id 'org.jetbrains.intellij.platform' version '2.6.0' + id 'org.jetbrains.intellij.platform' version '2.7.0' } ext { checkstyleVersion = '10.26.1' - pmdVersion = '7.15.0' + pmdVersion = '7.16.0' } def properties(String key) { @@ -58,7 +58,7 @@ dependencies { checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" pmd "net.sourceforge.pmd:pmd-ant:${pmdVersion}", "net.sourceforge.pmd:pmd-java:${pmdVersion}" - testImplementation platform('org.junit:junit-bom:5.13.3'), + testImplementation platform('org.junit:junit-bom:5.13.4'), 'org.junit.jupiter:junit-jupiter', 'org.junit.jupiter:junit-jupiter-engine', 'org.assertj:assertj-core:3.27.3' diff --git a/gradle.properties b/gradle.properties index 0fc254a..436c569 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ pluginName=Save Actions X pluginVersion=1.4.2-SNAPSHOT # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType=IC -platformVersion=2025.1.3 +platformVersion=2025.1.4.1 platformSinceBuild=243 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformBundledPlugins = com.intellij.java, com.jetbrains.php:203.4449.22 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 1b33c55..8bdaf60 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d4081da..2a84e18 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 23d15a9..ef07e01 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/src/main/java/software/xdev/saveactions/model/Storage.java b/src/main/java/software/xdev/saveactions/model/Storage.java index a8f86a0..7036a99 100644 --- a/src/main/java/software/xdev/saveactions/model/Storage.java +++ b/src/main/java/software/xdev/saveactions/model/Storage.java @@ -1,7 +1,6 @@ package software.xdev.saveactions.model; import java.util.ArrayList; -import java.util.EnumSet; import java.util.HashSet; import java.util.List; import java.util.Objects; @@ -18,9 +17,12 @@ @State(name = "SaveActionSettings", storages = {@com.intellij.openapi.components.Storage("saveactions_settings.xml")}) @Service(Service.Level.PROJECT) +@SuppressWarnings("PMD.UseEnumCollections") // Set must be nullable! public final class Storage implements PersistentStateComponent { private boolean firstLaunch; + // Must use a set that supports nullable values! + // For example EnumSet will crash when encountering an unknown/null value private Set actions; private Set exclusions; private Set inclusions; @@ -31,7 +33,7 @@ public final class Storage implements PersistentStateComponent public Storage() { this.firstLaunch = true; - this.actions = EnumSet.noneOf(Action.class); + this.actions = new HashSet<>(); this.exclusions = new HashSet<>(); this.inclusions = new HashSet<>(); this.configurationPath = null; @@ -42,7 +44,7 @@ public Storage() public Storage(final Storage storage) { this.firstLaunch = storage.firstLaunch; - this.actions = EnumSet.copyOf(storage.actions); + this.actions = new HashSet<>(storage.actions); this.exclusions = new HashSet<>(storage.exclusions); this.inclusions = new HashSet<>(storage.inclusions); this.configurationPath = storage.configurationPath;