Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8207235

ManagementFactory.getPlatformMXBeans(BufferPoolMXBean.class) throws NPE

    Details

    • Subcomponent:
    • Introduced In Build:
      b10
    • Introduced In Version:
      11
    • Resolved In Build:
      b23
    • Verification:
      Verified

      Backports

        Description

        If the following simple code is run from command line using JDK11 (seen in b12 al least) an NPE is thrown.

        public class Test {
            public static void main(String... args) {
                System.out.println(
                       java.lang.management.ManagementFactory.getPlatformMXBeans(
                                java.lang.management.BufferPoolMXBean.class
                        )
                );
            }
        }

        Exception in thread "main" java.lang.NullPointerException
        at java.management/sun.management.ManagementFactoryHelper.getBufferPoolMXBeans(ManagementFactoryHelper.java:345)
        at java.management/java.lang.management.DefaultPlatformMBeanProvider$10.nameToMBeanMap(DefaultPlatformMBeanProvider.java:422)
        at java.management/sun.management.spi.PlatformMBeanProvider$PlatformComponent.getMBeans(PlatformMBeanProvider.java:195)
        at java.management/java.lang.management.ManagementFactory.lambda$getPlatformMXBeans$3(ManagementFactory.java:726)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:271)
        at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1675)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
        at java.management/java.lang.management.ManagementFactory.getPlatformMXBeans(ManagementFactory.java:727)
        at Test.main(Test.java:4)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  redestad Claes Redestad
                  Reporter:
                  dbessono Dmitry Bessonov
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: