title: BeanUtils throwing NullPointerException in hashCode()
body: <p>I am using the <code>org.apache.commons.beanutils.BeanUtilsBean</code> to copy properties between objects. But it's throwing <code>NullPointerException</code> exception in <code>hashCode()</code> method. When I check the <code>DB</code>, <code>prodcode</code> property is not <code>null</code>. So shouldn't throw <code>NullPointerException</code>.</p>
  
  <p>My <code>DTO</code> <code>object</code> is like below.  One notable thing is, I store same <code>EquipmentDTO</code> as child equipments into this equipment. All the equipment has same property. So I use recursive pattern.</p>
  
  <p>eg. One parent equipment can have many child equipment.</p>
  
  <pre><code>public interface Copiable {
       public Object copy();
  }
  
  
  
  public class EquipmentDTO implements Copiable {
      private Long equipid;
      private String prodcode;
      private List&lt;EquipmentDTO &gt; childEquipmentList;  // Recursively store child Equipment
  
      public EquipmentDTO () {
         super();
      }
  
      public Long getEquipmentid() {
         return equipid;
      }
  
      public void setEquipmentid(Long equipid) {
         this.equipid= equipid;
      }
  
      public String getProdcode() {
         return prodcode;
      }  
      public int hashCode() {
         return getProdcode().hashCode();
      }
  
          @Override
      public boolean equals(Object o){
         if(o == null)return false;
  
         if(!(o instanceof EquipmentDTO ) ) return false;
  
         EquipmentDTO other = (EquipmentDTO ) o;
  
         return this.prodcode.equals(other.getProdcode());
  
      } 
  }
  </code></pre>
  
  <p>The <code>NullPointerException</code> occurs only in production environment.
  I use Java 1.6, Oracle weblogic.</p>
  
  <h1>Update</h1>
  
  <p><code>BeanUtils</code> code snipt.</p>
  
  <pre><code>public static void copy(Object src, Object dest) {
       try {
          org.apache.commons.beanutils.BeanUtilsBean beanUtil = BeanUtilsBean.getInstance();
          beanUtil.getConvertUtils().register(false, true, 0);
          beanUtil.copyProperties(dest, src);
      } catch (InvocationTargetException ite) {
          //set dest to null if exception
          ite.printStackTrace();
          dest = null;
      } catch (IllegalAccessException iae) {
          //set dest to null if exception
          iae.printStackTrace();
          dest = null;
      }
  }
  </code></pre>
  
  <h1>Update</h1>
  
  <p>Here is the stack trace.</p>
  
  <pre><code>Caused By: java.lang.NullPointerException
      at com.xxxx.xxxx.xxx.vo.EquipmentDTO.hashCode(EquipmentDTO.java:361)
      at java.lang.Object.toString(Object.java:219)
      at java.lang.String.valueOf(String.java:2826)
      at org.apache.commons.beanutils.BeanUtilsBean.copyProperties(BeanUtilsBean.java:246)
  </code></pre>