commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r834031 - in /commons/proper/beanutils/trunk: RELEASE-NOTES.txt src/java/org/apache/commons/beanutils/BeanUtilsBean.java src/test/org/apache/commons/beanutils/bugs/Jira368TestCase.java xdocs/changes.xml
Date Mon, 09 Nov 2009 12:26:52 GMT
Author: niallp
Date: Mon Nov  9 12:26:52 2009
New Revision: 834031

URL: http://svn.apache.org/viewvc?rev=834031&view=rev
Log:
BEANUTILS-368 Fix NullPointerException in BeanUtilsBean .setProperty() - thanks to Peter Fassev

Added:
    commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/bugs/Jira368TestCase.java
  (with props)
Modified:
    commons/proper/beanutils/trunk/RELEASE-NOTES.txt
    commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanUtilsBean.java
    commons/proper/beanutils/trunk/xdocs/changes.xml

Modified: commons/proper/beanutils/trunk/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/RELEASE-NOTES.txt?rev=834031&r1=834030&r2=834031&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/RELEASE-NOTES.txt (original)
+++ commons/proper/beanutils/trunk/RELEASE-NOTES.txt Mon Nov  9 12:26:52 2009
@@ -17,7 +17,7 @@
 
 
                           Commons BeanUtils Package
-                               Version 1.8.1
+                               Version 1.8.2
                                Release Notes
 
 INTRODUCTION:
@@ -29,11 +29,11 @@
 For more information on Commons BeanUtils, see
 o http://commons.apache.org/beanutils/
 
-Compatibility with 1.8.0
+Compatibility with 1.8.1
 ========================
-BeanUtils 1.8.1 is binary compatible release with Beanutils 1.8.0, containing mostly bug
fixes.
+BeanUtils 1.8.2 is binary compatible release with Beanutils 1.8.1, containing only bug fixes.
 
-BeanUtils 1.8.1 requires a minimum of JDK 1.3.
+BeanUtils 1.8.2 requires a minimum of JDK 1.3.
 
 Memory Leak
 ===========
@@ -41,7 +41,7 @@
 in BeanUtils 1.8.0 for JDK 1.5+.
 
 Testing of BeanUtils 1.8.1 revealed that the leak still appears to exist
-(in both BeanUtils 1.8.0 and 1.8.1 versions) in IBM's JDK 1.6 implementation.
+(in BeanUtils 1.8.0, 1.8.1 and 1.8.2 versions) in IBM's JDK 1.6 implementation.
 
 
 see http://issues.apache.org/jira/browse/BEANUTILS-291
@@ -53,22 +53,5 @@
 
 The following is a list of the bugs fixed in this release, with their Jira issue number:
 
-  * [BEANUTILS-300] - NPE in LazyDynaList
-  * [BEANUTILS-327] - JDBCDynaClass throws class not found exception under java6
-  * [BEANUTILS-336] - MappedPropertyDescriptor#reLoadClass() possible NPE / odd code; also
swallows Throwable
-  * [BEANUTILS-339] - BeanUtilsBean.setProperty throws IllegalArgumentException if value
is null
-  * [BEANUTILS-345] - BeanUtilsBean.setProperty does not handle some kind of nested properties
-  * [BEANUTILS-347] - MappedPropertyDescriptor throws an exception after method reference
has been garbage collected
-  * [BEANUTILS-349] - copyProperties throws NullPointerException if an IllegalArgumentException
is thrown due to a null value parameter for a primitive
-  * [BEANUTILS-351] - FloatLocaleConverter cannot parse 0
-  * [BEANUTILS-354] - Type in BooleanConverter: "Cna't convert value"
-
-
-ENHANCEMENTS:
-=============
-The following is a list of enhancements in this release, with their Jira issue number:
-
-  * [BEANUTILS-333] - Avoid calling setAccessible() if not needed
-  * [BEANUTILS-344] - Method createDynaProperty of JDBCDynaClass should first look for column
label instead of column name in ResultSetMetadata object..
-  * [BEANUTILS-350] - change visibility of method "evaluateValue" belongs to the class BeanPropertyValueEqualsPredicate
to "protected".
+  * [BEANUTILS-368] - NullPointerException in BeanUtilsBean .setProperty()
 

Modified: commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanUtilsBean.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanUtilsBean.java?rev=834031&r1=834030&r2=834031&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanUtilsBean.java
(original)
+++ commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/BeanUtilsBean.java
Mon Nov  9 12:26:52 2009
@@ -927,7 +927,7 @@
             type = dynaProperty.getType();
         } else if (target instanceof Map) {
             type = Object.class;
-        } else if (target.getClass().isArray() && index >= 0) {
+        } else if (target != null && target.getClass().isArray() && index
>= 0) {
             type = Array.get(target, index).getClass();
         } else {
             PropertyDescriptor descriptor = null;

Added: commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/bugs/Jira368TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/bugs/Jira368TestCase.java?rev=834031&view=auto
==============================================================================
--- commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/bugs/Jira368TestCase.java
(added)
+++ commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/bugs/Jira368TestCase.java
Mon Nov  9 12:26:52 2009
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.beanutils.bugs;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.apache.commons.beanutils.BeanUtils;
+
+/**
+ * See https://issues.apache.org/jira/browse/BEANUTILS-368
+ * <p />
+ *
+ * @version $Revision$ $Date$
+ */
+public class Jira368TestCase extends TestCase {
+
+    /**
+     * Create a test case with the specified name.
+     *
+     * @param name The name of the test
+     */
+    public Jira368TestCase(String name) {
+        super(name);
+    }
+
+    /**
+     * Run the Test.
+     *
+     * @param args Arguments
+     */
+    public static void main(String[] args) {
+        junit.textui.TestRunner.run(suite());
+    }
+
+    /**
+     * Create a test suite for this test.
+     *
+     * @return a test suite
+     */
+    public static Test suite() {
+        return (new TestSuite(Jira368TestCase.class));
+    }
+
+    /**
+     * Set up.
+     *
+     * @throws java.lang.Exception
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    /**
+     * Tear Down.
+     *
+     * @throws java.lang.Exception
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Test {@link BeanUtils} setProperty() with Null value
+     */
+    public void testBeanUtilsSetProperty_NullBean() throws Exception {
+        try {
+            BeanUtils.setProperty(null, "foo", "bar");
+        } catch (NullPointerException e) {
+            fail("Threw NullPointerException");
+        } catch (IllegalArgumentException e) {
+            // expected result
+        } catch (Exception e) {
+            fail("Threw " + e);
+        }
+    }
+}

Propchange: commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/bugs/Jira368TestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/bugs/Jira368TestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: commons/proper/beanutils/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/beanutils/trunk/xdocs/changes.xml?rev=834031&r1=834030&r2=834031&view=diff
==============================================================================
--- commons/proper/beanutils/trunk/xdocs/changes.xml (original)
+++ commons/proper/beanutils/trunk/xdocs/changes.xml Mon Nov  9 12:26:52 2009
@@ -39,6 +39,12 @@
   </properties>
   <body>
 
+    <release version="1.8.2" date="2009-11-13" description="Bug fix for 1.8.1">
+      <action dev="niallp" type="fix" issue="BEANUTILS-368" due-to="Peter Fassev">
+         NullPointerException in BeanUtilsBean .setProperty()
+      </action>
+    </release>
+
     <release version="1.8.1" date="2009-10-20" description="Bug fixes for 1.8.0">
       <action dev="niallp" type="fix" issue="BEANUTILS-300" due-to="Henri and Sebb">
          NPE in LazyDynaList



Mime
View raw message