Skip to content

Commit

Permalink
Stop using ValidationSecurityManager as SecurityManager
Browse files Browse the repository at this point in the history
The Security Manager is deprecated and subject to removal in a future release. There is no replacement for the Security Manager.

See also spotbugs#1579
  • Loading branch information
wborn committed Mar 22, 2022
1 parent 04cedd1 commit efee878
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 332 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Currently the versioning policy of this project follows [Semantic Versioning v2.
### Fixed
- Bumped Saxon-HE from 10.6 to 11.2 ([#1955](https://github.com/spotbugs/spotbugs/pull/1955))
- Fixed traversal of nested archives governed by `-nested:true` ([#1930](https://github.com/spotbugs/spotbugs/pull/1930))
- Warnings of deprecated System::setSecurityManager calls on Java 17 ([#1983](https://github.com/spotbugs/spotbugs/pull/1983))

## 4.6.0 - 2022-03-08
### Fixed
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,6 @@ private TypeQualifierValue(ClassDescriptor typeQualifier, @CheckForNull Object v
try {
Global.getAnalysisCache().getClassAnalysis(ClassData.class, checkerName);

// found it.
SecurityManager m = System.getSecurityManager();
if (m == null) {
if (DEBUG_CLASSLOADING) {
System.out.println("Setting ValidationSecurityManager");
}
System.setSecurityManager(ValidationSecurityManager.INSTANCE);
}

Class<?> c = ValidatorClassLoader.INSTANCE.loadClass(checkerName.getDottedClassName());
if (TypeQualifierValidator.class.isAssignableFrom(c)) {

Expand Down Expand Up @@ -187,14 +178,6 @@ private TypeQualifierValue(ClassDescriptor typeQualifier, @CheckForNull Object v
AnalysisContext.logError("Unable to construct type qualifier checker " + checkerName + " due to "
+ e.getClass().getSimpleName() + ":" + e.getMessage());
}
} else if (DEBUG_CLASSLOADING) {
SecurityManager m = System.getSecurityManager();
if (m == null) {
if (DEBUG_CLASSLOADING) {
System.out.println("Setting ValidationSecurityManager");
}
System.setSecurityManager(ValidationSecurityManager.INSTANCE);
}
}
}
this.validator = validator1;
Expand Down Expand Up @@ -269,7 +252,7 @@ public When validate(@CheckForNull Object constantValue) {
Profiler profiler = analysisCache.getProfiler();
profiler.start(validator.getClass());
try {
return ValidationSecurityManager.sandboxedValidation(proxy, validator, constantValue);
return validator.forConstantValue(proxy, constantValue);
} catch (Exception e) {
AnalysisContext.logError("Error executing custom validator for " + typeQualifier + " " + constantValue, e);
return When.UNKNOWN;
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit efee878

Please sign in to comment.