You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by sm...@apache.org on 2006/04/13 13:41:55 UTC
svn commit: r393788 - in
/incubator/harmony/enhanced/classlib/trunk/modules/beans/src:
main/java/java/beans/MethodDescriptor.java
test/java/org/apache/harmony/tests/java/beans/MethodDescriptorTest.java
Author: smishura
Date: Thu Apr 13 04:41:48 2006
New Revision: 393788
URL: http://svn.apache.org/viewcvs?rev=393788&view=rev
Log:
Fixing HARMONY-226 (MethodDescriptor constructor should throw NullPointerException)
Added:
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/MethodDescriptorTest.java (with props)
Modified:
incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java
Modified: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java?rev=393788&r1=393787&r2=393788&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/main/java/java/beans/MethodDescriptor.java Thu Apr 13 04:41:48 2006
@@ -29,8 +29,8 @@
public class MethodDescriptor extends FeatureDescriptor {
- private Method method = null;
- private ParameterDescriptor[] parameterDescriptors = {};
+ private Method method;
+ private ParameterDescriptor[] parameterDescriptors;
/**
* @com.intel.drl.spec_ref
@@ -39,13 +39,14 @@
ParameterDescriptor[] parameterDescriptors) {
super();
+ if (method == null) {
+ throw new NullPointerException();
+ }
this.method = method;
this.parameterDescriptors = parameterDescriptors;
-
- if(method != null) {
- setName(method.getName());
- setDisplayName(method.getName());
- }
+
+ setName(method.getName());
+ setDisplayName(method.getName());
}
/**
@@ -54,11 +55,14 @@
public MethodDescriptor(Method method) {
super();
- this.method = method;
- if(method != null) {
- setName(method.getName());
- setDisplayName(method.getName());
+ if (method == null) {
+ throw new NullPointerException();
}
+ this.method = method;
+ this.parameterDescriptors = new ParameterDescriptor[0];
+
+ setName(method.getName());
+ setDisplayName(method.getName());
}
/**
Added: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/MethodDescriptorTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/MethodDescriptorTest.java?rev=393788&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/MethodDescriptorTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/MethodDescriptorTest.java Thu Apr 13 04:41:48 2006
@@ -0,0 +1,51 @@
+/*
+ * 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.java.beans;
+
+import junit.framework.TestCase;
+import java.beans.MethodDescriptor;
+import java.beans.ParameterDescriptor;
+
+public class MethodDescriptorTest extends TestCase {
+
+ /**
+ * @tests java.beans.MethodDescriptor#MethodDescriptor(
+ * java.lang.reflect.Method)
+ */
+ public void test_Ctor1_NullPointerExpection() {
+ try {
+ // Regression for HARMONY-226
+ new MethodDescriptor(null);
+ fail("No expected NullPointerException");
+ } catch (NullPointerException e) {
+ }
+ }
+
+ /**
+ * @tests java.beans.MethodDescriptor#MethodDescriptor(
+ * java.lang.reflect.Method,
+ * java.beans.ParameterDescriptor[])
+ */
+ public void test_Ctor2_NullPointerExpection() {
+ try {
+ // Regression for HARMONY-226
+ new MethodDescriptor(null, new ParameterDescriptor[0]);
+ fail("No expected NullPointerException");
+ } catch (NullPointerException e) {
+ }
+ }
+}
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/beans/src/test/java/org/apache/harmony/tests/java/beans/MethodDescriptorTest.java
------------------------------------------------------------------------------
svn:eol-style = native