Program: 79122
Project: 79122
Buggy source:
/** 
 * Returns a <tt>MonitorInfo</tt> object represented by the given <tt>CompositeData</tt>. The given <tt>CompositeData</tt> must contain the following attributes as well as the attributes specified in the <a href="LockInfo.html#MappedType"> mapped type</a> for the   {@link LockInfo} class:<blockquote> <table border> <tr> <th align=left>Attribute Name</th> <th align=left>Type</th> </tr> <tr> <td>lockedStackFrame</td> <td><tt>CompositeData as specified in the <a href="ThreadInfo.html#StackTrace">stackTrace</a> attribute defined in the  {@link ThreadInfo#from ThreadInfo.from} method.</tt></td> </tr> <tr> <td>lockedStackDepth</td> <td><tt>java.lang.Integer</tt></td> </tr> </table> </blockquote>
 * @param cd <tt>CompositeData</tt> representing a <tt>MonitorInfo</tt>
 * @throws IllegalArgumentException if <tt>cd</tt> does notrepresent a <tt>MonitorInfo</tt> with the attributes described above.
 * @return a <tt>MonitorInfo</tt> object representedby <tt>cd</tt> if <tt>cd</tt> is not <tt>null</tt>; <tt>null</tt> otherwise.
 */
public static MonitorInfo from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof MonitorInfoCompositeData) {
    return ((MonitorInfoCompositeData)cd).getMonitorInfo();
  }
 else {
    MonitorInfoCompositeData.validateCompositeData(cd);
    String className=MonitorInfoCompositeData.getClassName(cd);
    int identityHashCode=MonitorInfoCompositeData.getIdentityHashCode(cd);
    int stackDepth=MonitorInfoCompositeData.getLockedStackDepth(cd);
    StackTraceElement stackFrame=MonitorInfoCompositeData.getLockedStackFrame(cd);
    return new MonitorInfo(className,identityHashCode,stackDepth,stackFrame);
  }
}

Fixed version (ground truth):
/** 
 * Returns a <tt>MonitorInfo</tt> object represented by the given <tt>CompositeData</tt>. The given <tt>CompositeData</tt> must contain the following attributes as well as the attributes specified in the <a href="LockInfo.html#MappedType"> mapped type</a> for the   {@link LockInfo} class:<blockquote> <table border summary="The attributes and their types the given CompositeData contains"> <tr> <th align=left>Attribute Name</th> <th align=left>Type</th> </tr> <tr> <td>lockedStackFrame</td> <td><tt>CompositeData as specified in the <a href="ThreadInfo.html#StackTrace">stackTrace</a> attribute defined in the  {@link ThreadInfo#from ThreadInfo.from} method.</tt></td> </tr> <tr> <td>lockedStackDepth</td> <td><tt>java.lang.Integer</tt></td> </tr> </table> </blockquote>
 * @param cd <tt>CompositeData</tt> representing a <tt>MonitorInfo</tt>
 * @throws IllegalArgumentException if <tt>cd</tt> does notrepresent a <tt>MonitorInfo</tt> with the attributes described above.
 * @return a <tt>MonitorInfo</tt> object representedby <tt>cd</tt> if <tt>cd</tt> is not <tt>null</tt>; <tt>null</tt> otherwise.
 */
public static MonitorInfo from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof MonitorInfoCompositeData) {
    return ((MonitorInfoCompositeData)cd).getMonitorInfo();
  }
 else {
    MonitorInfoCompositeData.validateCompositeData(cd);
    String className=MonitorInfoCompositeData.getClassName(cd);
    int identityHashCode=MonitorInfoCompositeData.getIdentityHashCode(cd);
    int stackDepth=MonitorInfoCompositeData.getLockedStackDepth(cd);
    StackTraceElement stackFrame=MonitorInfoCompositeData.getLockedStackFrame(cd);
    return new MonitorInfo(className,identityHashCode,stackDepth,stackFrame);
  }
}