This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Product Version = NetBeans IDE 8.1 (Build 201510222201) Operating System = Windows 10 version 10.0 running on amd64 Java; VM; Vendor = 1.8.0_72 Runtime = Java HotSpot(TM) 64-Bit Server VM 25.72-b15 Reproducibility: Happens every time STEPS: * Open dialog Foo * Click on button "Click me" ACTUAL: nothing happens EXPECTED: message pops up For a String Object in a class, which by reflection is accessible from the Field, return null when casted to int[][][][][], the rouitne used is from Class class /** * Casts an object to the class or interface represented * by this {@code Class} object. * * @param obj the object to be cast * @return the object after casting, or null if obj is null * * @throws ClassCastException if the object is not * null and is not assignable to the type T. * * @since 1.5 */ @SuppressWarnings("unchecked") public T cast(Object obj) { if (obj != null && !isInstance(obj)) throw new ClassCastException(cannotCastMsg(obj)); return (T) obj; } thus: public Class MyClass { public String name; public void function() { Field[] ff = getClass().getFields(); if (ff != null) { for (Field field : ff) { try { int[][][][][] fv = int[][][][][].class.cast(field.get(this)); } catch (ClassCastException e) { } } } } return in function for fv null when function is called, wheras the javadoc states a cast exception is thrown
I think I made a mistake by reporting this, because the null pointer exception is thrown because the String is a null object, else the ClassCastException would be thrown.