-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
11
ADDITIONAL SYSTEM INFORMATION :
JDK 11 and all earlier version also has this defect.
A DESCRIPTION OF THE PROBLEM :
I want to use custom log level name. So for that When calling the constructor by passing name, integer and resourceBundleName still the custom log level name is not working. Turned out the curlprit is null.
localizedLevelName is assigned with either null or name and never with resourceBundleName.
Following is the defective statement from the private constructor of java.util.logging.Level
this.localizedLevelName = resourceBundleName == null ? name : null; //defective
this.localizedLevelName = resourceBundleName == null ? name : resourceBundleName; //To fix the issue
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Call the parameterized constructor of java.util.logging.Level by passing 3 parameters (name, some integer value, custom level name)
Example:
public ConnectLogLevel(String name, int value, String customLogLevelName) {
super(name, value, customLogLevelName);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should be able to get the custom level name..
ACTUAL -
Custom level name is always empty
---------- BEGIN SOURCE ----------
import java.util.logging.Level;
public class ConnectLogLevel extends Level {
public static final Level TRACE = new ConnectLogLevel("TRACE", 10347, "TRACE");
public ConnectLogLevel(String name, int value, String customLogLevelName) {
super(name, value, customLogLevelName);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Nothing
FREQUENCY : always
JDK 11 and all earlier version also has this defect.
A DESCRIPTION OF THE PROBLEM :
I want to use custom log level name. So for that When calling the constructor by passing name, integer and resourceBundleName still the custom log level name is not working. Turned out the curlprit is null.
localizedLevelName is assigned with either null or name and never with resourceBundleName.
Following is the defective statement from the private constructor of java.util.logging.Level
this.localizedLevelName = resourceBundleName == null ? name : null; //defective
this.localizedLevelName = resourceBundleName == null ? name : resourceBundleName; //To fix the issue
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Call the parameterized constructor of java.util.logging.Level by passing 3 parameters (name, some integer value, custom level name)
Example:
public ConnectLogLevel(String name, int value, String customLogLevelName) {
super(name, value, customLogLevelName);
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should be able to get the custom level name..
ACTUAL -
Custom level name is always empty
---------- BEGIN SOURCE ----------
import java.util.logging.Level;
public class ConnectLogLevel extends Level {
public static final Level TRACE = new ConnectLogLevel("TRACE", 10347, "TRACE");
public ConnectLogLevel(String name, int value, String customLogLevelName) {
super(name, value, customLogLevelName);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Nothing
FREQUENCY : always