Use Objects.equals() for null-safe string comparison
See gh-31305
This commit is contained in:
parent
bc3d98565c
commit
1d12c74042
|
@ -27,7 +27,6 @@ import org.gradle.api.plugins.JavaPlugin;
|
|||
import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion;
|
||||
import org.gradle.jvm.toolchain.JavaToolchainSpec;
|
||||
import org.gradle.jvm.toolchain.JvmVendorSpec;
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,6 @@ import org.gradle.api.Plugin;
|
|||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.plugins.JavaBasePlugin;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.tasks.SourceSetContainer;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.lang.reflect.Modifier;
|
|||
import java.lang.reflect.Parameter;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -179,7 +180,7 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes
|
|||
testClass.getName(), Arrays.toString(methodsWithErrors)));
|
||||
}, String.class);
|
||||
|
||||
if (errorMessage != NO_VIOLATIONS_DETECTED) {
|
||||
if (!Objects.equals(errorMessage, NO_VIOLATIONS_DETECTED)) {
|
||||
throw new IllegalStateException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
@ -218,7 +219,7 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes
|
|||
published by other tests since the application context may be shared.""";
|
||||
}, String.class);
|
||||
|
||||
if (errorMessage != NO_VIOLATIONS_DETECTED) {
|
||||
if (!Objects.equals(errorMessage, NO_VIOLATIONS_DETECTED)) {
|
||||
throw new IllegalStateException(errorMessage);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue