Hi *,
while reviewing Sonar warnings I stumbled upon
org.apache.tamaya.sysprops.ConfiguredSystemProperties
and thought to add a simple test.
But it seems that I don'T understand how to use that class.
Initializing it as propsed by its Javadoc in a test yields a
<snip>
*** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with
message transform method call failed at JPLISAgent.c line: 880
java.lang.ExceptionInInitializerError
at
java.logging/java.util.logging.SimpleFormatter.<init>(SimpleFormatter.java:67)
at
java.logging/java.util.logging.ConsoleHandler.<init>(ConsoleHandler.java:79)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:488)
at java.base/java.lang.Class.newInstance(Class.java:558)
at
java.logging/java.util.logging.LogManager.createLoggerHandlers(LogManager.java:997)
at
java.logging/java.util.logging.LogManager.access$1300(LogManager.java:155)
at java.logging/java.util.logging.LogManager$4.run(LogManager.java:968)
at java.logging/java.util.logging.LogManager$4.run(LogManager.java:964)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at
java.logging/java.util.logging.LogManager.loadLoggerHandlers(LogManager.java:964)
at
java.logging/java.util.logging.LogManager.initializeGlobalHandlers(LogManager.java:2389)
at
java.logging/java.util.logging.LogManager.access$1800(LogManager.java:155)
at
java.logging/java.util.logging.LogManager$RootLogger.accessCheckedHandlers(LogManager.java:2483)
at java.logging/java.util.logging.Logger.getHandlers(Logger.java:2089)
at java.logging/java.util.logging.Logger.log(Logger.java:976)
at java.logging/java.util.logging.Logger.doLog(Logger.java:1006)
at java.logging/java.util.logging.Logger.log(Logger.java:1029)
at java.logging/java.util.logging.Logger.info(Logger.java:1802)
at
org.apache.tamaya.sysprops.ConfiguredSystemProperties.install(ConfiguredSystemProperties.java:63)
at
org.apache.tamaya.sysprops.ConfiguredSystemPropertiesTest.objectCreation(ConfiguredSystemPropertiesTest.java:28)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.lang.NullPointerException
at org.apache.tamaya.Configuration.current(Configuration.java:436)
at
org.apache.tamaya.sysprops.ConfiguredSystemProperties.createNewProperties(ConfiguredSystemProperties.java:325)
at
org.apache.tamaya.sysprops.ConfiguredSystemProperties.getContextualProperties(ConfiguredSystemProperties.java:318)
at
org.apache.tamaya.sysprops.ConfiguredSystemProperties.getProperty(ConfiguredSystemProperties.java:83)
at java.base/java.lang.System.getProperty(System.java:813)
at
java.base/sun.security.action.GetPropertyAction.privilegedGetProperty(GetPropertyAction.java:128)
at
java.base/jdk.internal.logger.SimpleConsoleLogger.getDefaultLevel(SimpleConsoleLogger.java:59)
at
java.base/jdk.internal.logger.SimpleConsoleLogger.<clinit>(SimpleConsoleLogger.java:53)
... 53 more
</snip>
Is that due to a newer JDK or is that a bug?
Thanks for any ideas,
Phil