mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8344039: Remove security manager dependency in java.time
Reviewed-by: naoto, mullan, lancea
This commit is contained in:
parent
1eb38c8eb7
commit
5ac330b1ac
2 changed files with 47 additions and 78 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -61,8 +61,6 @@
|
|||
*/
|
||||
package java.time.zone;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
@ -146,28 +144,21 @@ public abstract class ZoneRulesProvider {
|
|||
static {
|
||||
// if the property java.time.zone.DefaultZoneRulesProvider is
|
||||
// set then its value is the class name of the default provider
|
||||
@SuppressWarnings("removal")
|
||||
final List<ZoneRulesProvider> loaded =
|
||||
AccessController.doPrivileged(new PrivilegedAction<List<ZoneRulesProvider>>() {
|
||||
public List<ZoneRulesProvider> run() {
|
||||
List<ZoneRulesProvider> result = new ArrayList<>();
|
||||
String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
|
||||
if (prop != null) {
|
||||
try {
|
||||
Class<?> c = Class.forName(prop, true, ClassLoader.getSystemClassLoader());
|
||||
@SuppressWarnings("deprecation")
|
||||
ZoneRulesProvider provider = ZoneRulesProvider.class.cast(c.newInstance());
|
||||
registerProvider(provider);
|
||||
result.add(provider);
|
||||
} catch (Exception x) {
|
||||
throw new Error(x);
|
||||
}
|
||||
} else {
|
||||
registerProvider(new TzdbZoneRulesProvider());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
});
|
||||
final List<ZoneRulesProvider> loaded = new ArrayList<>();
|
||||
String prop = System.getProperty("java.time.zone.DefaultZoneRulesProvider");
|
||||
if (prop != null) {
|
||||
try {
|
||||
Class<?> c = Class.forName(prop, true, ClassLoader.getSystemClassLoader());
|
||||
@SuppressWarnings("deprecation")
|
||||
ZoneRulesProvider provider = ZoneRulesProvider.class.cast(c.newInstance());
|
||||
registerProvider(provider);
|
||||
loaded.add(provider);
|
||||
} catch (Exception x) {
|
||||
throw new Error(x);
|
||||
}
|
||||
} else {
|
||||
registerProvider(new TzdbZoneRulesProvider());
|
||||
}
|
||||
|
||||
ServiceLoader<ZoneRulesProvider> sl = ServiceLoader.load(ZoneRulesProvider.class, ClassLoader.getSystemClassLoader());
|
||||
Iterator<ZoneRulesProvider> it = sl.iterator();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue