mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8187073: The java.util.logging.Level.findLevel() will not correctly find a Level by it's int value
Reviewed-by: rriggs
This commit is contained in:
parent
82bf0799c6
commit
eb62b5e51e
2 changed files with 35 additions and 9 deletions
|
@ -389,14 +389,15 @@ public class Level implements java.io.Serializable {
|
|||
try {
|
||||
int x = Integer.parseInt(name);
|
||||
level = KnownLevel.findByValue(x, KnownLevel::mirrored);
|
||||
if (!level.isPresent()) {
|
||||
// add new Level
|
||||
Level levelObject = new Level(name, x);
|
||||
// There's no need to use a reachability fence here because
|
||||
// KnownLevel keeps a strong reference on the level when
|
||||
// level.getClass() == Level.class.
|
||||
return KnownLevel.findByValue(x, KnownLevel::mirrored).get();
|
||||
if (level.isPresent()) {
|
||||
return level.get();
|
||||
}
|
||||
// add new Level
|
||||
Level levelObject = new Level(name, x);
|
||||
// There's no need to use a reachability fence here because
|
||||
// KnownLevel keeps a strong reference on the level when
|
||||
// level.getClass() == Level.class.
|
||||
return KnownLevel.findByValue(x, KnownLevel::mirrored).get();
|
||||
} catch (NumberFormatException ex) {
|
||||
// Not an integer.
|
||||
// Drop through.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue