svn commit: r900611 - in /jakarta/jmeter/trunk: src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java xdocs/changes.xml

[email protected]
Newsgroups gmane.comp.jakarta.jmeter.devel
Message-ID <[email protected]>
Author: sebb
Date: Mon Jan 18 23:49:41 2010
New Revision: 900611

URL: http://svn.apache.org/viewvc?rev=900611&view=rev
Log:
BeanInfoSupport now caches getBeanDescriptor() - should avoid an NPE on non-Sun JVMs when using CSVDataSet (and some other TestBeans)

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java?rev=900611&r1=900610&r2=900611&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/testbeans/BeanInfoSupport.java Mon Jan 18 23:49:41 2010
@@ -82,7 +82,10 @@
     // NOTREAD private Class beanClass;
     /** The BeanInfo for our class as obtained by the introspector. */
     private final BeanInfo rootBeanInfo;
-
+    
+    /** The descriptor for our class */
+    private final BeanDescriptor beanDescriptor;
+    
     /** The icons for this bean. */
     private final Image[] icons = new Image[5];
 
@@ -99,6 +102,10 @@
             throw new Error(e.toString()); // Programming error: bail out.
         }
 
+        // N.B. JVMs other than Sun may return different instances each time
+        // so we cache the value here (and avoid having to fetch it every time)
+        beanDescriptor = rootBeanInfo.getBeanDescriptor();
+        
         try {
             ResourceBundle resourceBundle = ResourceBundle.getBundle(
                     beanClass.getName() + "Resources",  // $NON-NLS-1$
@@ -201,7 +208,7 @@
     /** {@inheritDoc} */
     @Override
     public BeanDescriptor getBeanDescriptor() {
-        return rootBeanInfo.getBeanDescriptor();
+        return beanDescriptor;
     }
 
     /** {@inheritDoc} */

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=900611&r1=900610&r2=900611&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Mon Jan 18 23:49:41 2010
@@ -113,6 +113,7 @@
 <ul>
 <li>Bug 47646 -  NullPointerException in the "Random Variable" element</li>
 <li>Disallow adding any child elements to JDBC Configuration</li>
+<li>BeanInfoSupport now caches getBeanDescriptor() - should avoid an NPE on non-Sun JVMs when using CSVDataSet (and some other TestBeans)</li>
 </ul>
 
 <!-- ==================================================== -->
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.