title: com.sun.jdi.InvocationException occurred invoking method in JDK8
body: <p>I am migrating my application from JDK 7 to JDK 8. While doing, I am facing an exception <code>com.sun.jdi.InvocationException occurred invoking method</code> when an instance of <code>TestField</code> as shown below is created. I  am getting the exception while debugging and could not find the reason for it. I suspect <strong>NullPointerException</strong> occurs and <strong>InvocationException</strong> masks it. I have the below Object methods overridden in <code>TestField</code>. </p>
  
  <p>Below utility classes are a part of <code>commons-lang</code> jar.</p>
  
  <p><em>HashCodeBuilder<br/>
  EqualsBuilder<br/>
  ToStringBuilder</em></p>
  
  <pre><code>public class TestField {
  
  private String name;
  
  private Rules rules;
  
  public TestField(String name, Rules rules)
  
  {   this.name = name;
      this.rules = rules;
  }
  
  public String toString() {
      return new ToStringBuilder(this)
      .append("\n name", this.getName())
      .append("\n Rules", this.getRules())
      .append("\n ")
      .toString();
  }
  
  public boolean equals(Object other) {
      if ( !(other instanceof TestField) ) return false;
      TestField castOther = (TestField) other;
      return new EqualsBuilder()
          .append(this.getName(), castOther.getName())
                  .append(this.getRules(), castOther.getRules())
          .isEquals();
  }
  
  public int hashCode() {
      return new HashCodeBuilder()
          .append(this.getName())            
          .append(this.getRules())            
          .toHashCode();
  }   
  }
  </code></pre>
  
  <p>Have anyone faced such an issue. Could anyone please help me to resolve the same. Thanks.</p>