Index: modules/beans/src/test/java/org/apache/harmony/tests/beans/MethodDescriptorTest.java =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ modules/beans/src/test/java/org/apache/harmony/tests/beans/MethodDescriptorTest.java 2006-03-22 08:20:33.000000000 +0000 @@ -0,0 +1,33 @@ +/* + * Copyright 2006 The Apache Software Foundation or its licensors, as applicable. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.harmony.tests.beans; + +import junit.framework.TestCase; +import java.beans.MethodDescriptor; + +public class MethodDescriptorTest extends TestCase { + + public void testNullPointerExpection() { + try { + MethodDescriptor bd = new MethodDescriptor(null); + fail("Constructor MethodDescriptor(null) should "+ + "throw NullPointerException"); + } catch (NullPointerException e) { + } + } + +} Index: modules/beans/src/main/java/java/beans/MethodDescriptor.java =================================================================== --- modules/beans/src/main/java/java/beans/MethodDescriptor.java.orig 2006-03-21 21:02:19.000000000 +0000 +++ modules/beans/src/main/java/java/beans/MethodDescriptor.java 2006-03-22 08:01:44.000000000 +0000 @@ -54,11 +54,12 @@ public MethodDescriptor(Method method) { super(); + if(method == null) + throw new NullPointerException(); + this.method = method; - if(method != null) { - setName(method.getName()); - setDisplayName(method.getName()); - } + setName(method.getName()); + setDisplayName(method.getName()); } /**