Program: 71254
Project: 71254
Buggy source:
/** 
 * Returns a   {@code MonitorInfo} object represented by thegiven  {@code CompositeData}. The given   {@code CompositeData} must contain the following attributesas well as the attributes specified in the <a href="LockInfo.html#MappedType"> mapped type</a> for the  {@link LockInfo} class:<blockquote> <table border="1"> <caption style="display:none">The attributes and their types the given CompositeData contains</caption> <tr> <th style="text-align:left">Attribute Name</th> <th style="text-align:left">Type</th> </tr> <tr> <td>lockedStackFrame</td> <td><code>CompositeData as specified in the <a href="ThreadInfo.html#StackTrace">stackTrace</a> attribute defined in the  {@link ThreadInfo#from ThreadInfo.from} method.</code></td> </tr> <tr> <td>lockedStackDepth</td> <td> {@code java.lang.Integer}</td> </tr> </table> </blockquote>
 * @param cd {@code CompositeData} representing a {@code MonitorInfo}
 * @throws IllegalArgumentException if {@code cd} does notrepresent a  {@code MonitorInfo} with the attributes describedabove.
 * @return a {@code MonitorInfo} object representedby  {@code cd} if {@code cd} is not {@code null};  {@code null} 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   {@code MonitorInfo} object represented by thegiven  {@code CompositeData}. The given   {@code CompositeData} must contain the following attributesas well as the attributes specified in the <a href="LockInfo.html#MappedType"> mapped type</a> for the  {@link LockInfo} class:<table class="striped" style="margin-left:2em"> <caption style="display:none">The attributes and their types the given CompositeData contains</caption> <thead> <tr> <th scope="col">Attribute Name</th> <th scope="col">Type</th> </tr> </thead> <tbody style="text-align:left"> <tr> <th scope="row">lockedStackFrame</th> <td><code>CompositeData as specified in the <a href="ThreadInfo.html#StackTrace">stackTrace</a> attribute defined in the  {@link ThreadInfo#from ThreadInfo.from} method.</code></td> </tr> <tr> <th scope="row">lockedStackDepth</th> <td> {@code java.lang.Integer}</td> </tr> </tbody> </table>
 * @param cd {@code CompositeData} representing a {@code MonitorInfo}
 * @throws IllegalArgumentException if {@code cd} does notrepresent a  {@code MonitorInfo} with the attributes describedabove.
 * @return a {@code MonitorInfo} object representedby  {@code cd} if {@code cd} is not {@code null};  {@code null} 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);
  }
}