Index: modules/beans/src/main/java/java/beans/Introspector.java =================================================================== --- modules/beans/src/main/java/java/beans/Introspector.java.orig 2006-03-21 07:48:18.000000000 +0000 +++ modules/beans/src/main/java/java/beans/Introspector.java 2006-03-27 19:36:49.000000000 +0100 @@ -72,6 +72,9 @@ throws IntrospectionException { BeanInfo result = null; + if (beanClass == null) + throw new java.lang.NullPointerException(); + if (flags == USE_ALL_BEANINFO) { result = getBeanInfo(beanClass, null, false, false); } else if (flags == IGNORE_IMMEDIATE_BEANINFO) { @@ -87,6 +90,8 @@ */ public static BeanInfo getBeanInfo(Class beanClass) throws IntrospectionException { + if (beanClass == null) + throw new java.lang.NullPointerException(); return getBeanInfo(beanClass, null, false, false); } @@ -96,6 +101,8 @@ public static BeanInfo getBeanInfo(Class beanClass, Class stopClass) throws IntrospectionException { + if (beanClass == null) + throw new java.lang.NullPointerException(); return getBeanInfo(beanClass, stopClass, false, false); } Index: modules/beans/src/test/java/org/apache/harmony/tests/beans/IntrospectorTest.java =================================================================== --- modules/beans/src/test/java/org/apache/harmony/tests/beans/IntrospectorTest.java.orig 2006-03-21 07:48:16.000000000 +0000 +++ modules/beans/src/test/java/org/apache/harmony/tests/beans/IntrospectorTest.java 2006-03-27 19:33:31.000000000 +0100 @@ -274,7 +274,32 @@ fail(ie.getClass() + ": " + ie.getMessage()); } } - + + public void testGetBeanInfo_NPE() { + try { + BeanInfo info = Introspector.getBeanInfo((java.lang.Class)null); + fail("getBeanInfo should throw NullPointerException"); + } catch (Exception e) { + assertEquals("java.lang.NullPointerException", + e.getClass().getName()); + } + try { + BeanInfo info = Introspector.getBeanInfo((java.lang.Class)null, + (java.lang.Class)null); + fail("getBeanInfo should throw NullPointerException"); + } catch (Exception e) { + assertEquals("java.lang.NullPointerException", + e.getClass().getName()); + } + try { + BeanInfo info = Introspector.getBeanInfo((java.lang.Class)null, 0); + fail("getBeanInfo should throw NullPointerException"); + } catch (Exception e) { + assertEquals("java.lang.NullPointerException", + e.getClass().getName()); + } + } + /** * */