Program: 35769
Project: 35769
Buggy source:
/** 
 * Returns a   {@code ThreadInfo} object represented by thegiven  {@code CompositeData}. The given   {@code CompositeData} must contain the following attributesunless otherwise specified below: <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>threadId</td> <td> {@code java.lang.Long}</td> </tr> <tr> <td>threadName</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>threadState</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>suspended</td> <td>  {@code java.lang.Boolean}</td> </tr> <tr> <td>inNative</td> <td>  {@code java.lang.Boolean}</td> </tr> <tr> <td>blockedCount</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>blockedTime</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>waitedCount</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>waitedTime</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>lockInfo</td> <td>  {@code javax.management.openmbean.CompositeData}- the mapped type for   {@link LockInfo} as specified in the{@link LockInfo#from} method.<p> If  {@code cd} does not contain this attribute,the  {@code LockInfo} object will be constructed fromthe value of the  {@code lockName} attribute. </td></tr> <tr> <td>lockName</td> <td> {@code java.lang.String}</td> </tr> <tr> <td>lockOwnerId</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>lockOwnerName</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td><a id="StackTrace">stackTrace</a></td> <td>  {@code javax.management.openmbean.CompositeData[]}<p> Each element is a   {@code CompositeData} representingStackTraceElement containing the following attributes: <blockquote> <table cellspacing=1 cellpadding=0> <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>moduleName</td> <td> {@code java.lang.String}</td> </tr> <tr> <td>moduleVersion</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>className</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>methodName</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>fileName</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>lineNumber</td> <td>  {@code java.lang.Integer}</td> </tr> <tr> <td>nativeMethod</td> <td>  {@code java.lang.Boolean}</td> </tr> </table> </blockquote> </td> </tr> <tr> <td>lockedMonitors</td> <td>  {@code javax.management.openmbean.CompositeData[]}whose element type is the mapped type for  {@link MonitorInfo} as specified in the{@link MonitorInfo#from Monitor.from} method.<p> If  {@code cd} does not contain this attribute,this attribute will be set to an empty array. </td> </tr> <tr> <td>lockedSynchronizers</td> <td> {@code javax.management.openmbean.CompositeData[]}whose element type is the mapped type for  {@link LockInfo} as specified in the {@link LockInfo#from} method.<p> If  {@code cd} does not contain this attribute,this attribute will be set to an empty array. </td> </tr> <tr> <td>daemon</td> <td> {@code java.lang.Boolean}</td> </tr> <tr> <td>priority</td> <td>  {@code java.lang.Integer}</td> </tr> </table> </blockquote>
 * @param cd {@code CompositeData} representing a {@code ThreadInfo}
 * @throws IllegalArgumentException if {@code cd} does notrepresent a  {@code ThreadInfo} with the attributes describedabove.
 * @return a {@code ThreadInfo} object representedby  {@code cd} if {@code cd} is not {@code null};  {@code null} otherwise.
 * @revised 9
 * @spec JPMS
 */
public static ThreadInfo from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof ThreadInfoCompositeData) {
    return ((ThreadInfoCompositeData)cd).getThreadInfo();
  }
 else {
    return new ThreadInfo(cd);
  }
}

Fixed version (ground truth):
/** 
 * Returns a   {@code ThreadInfo} object represented by thegiven  {@code CompositeData}. The given   {@code CompositeData} must contain the following attributesunless otherwise specified below: <blockquote> <table class="plain"> <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>threadId</td> <td> {@code java.lang.Long}</td> </tr> <tr> <td>threadName</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>threadState</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>suspended</td> <td>  {@code java.lang.Boolean}</td> </tr> <tr> <td>inNative</td> <td>  {@code java.lang.Boolean}</td> </tr> <tr> <td>blockedCount</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>blockedTime</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>waitedCount</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>waitedTime</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>lockInfo</td> <td>  {@code javax.management.openmbean.CompositeData}- the mapped type for   {@link LockInfo} as specified in the{@link LockInfo#from} method.<p> If  {@code cd} does not contain this attribute,the  {@code LockInfo} object will be constructed fromthe value of the  {@code lockName} attribute. </td></tr> <tr> <td>lockName</td> <td> {@code java.lang.String}</td> </tr> <tr> <td>lockOwnerId</td> <td>  {@code java.lang.Long}</td> </tr> <tr> <td>lockOwnerName</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td><a id="StackTrace">stackTrace</a></td> <td>  {@code javax.management.openmbean.CompositeData[]}<p> Each element is a   {@code CompositeData} representingStackTraceElement containing the following attributes: <blockquote> <table class="borderless"> <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>moduleName</td> <td> {@code java.lang.String}</td> </tr> <tr> <td>moduleVersion</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>className</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>methodName</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>fileName</td> <td>  {@code java.lang.String}</td> </tr> <tr> <td>lineNumber</td> <td>  {@code java.lang.Integer}</td> </tr> <tr> <td>nativeMethod</td> <td>  {@code java.lang.Boolean}</td> </tr> </table> </blockquote> </td> </tr> <tr> <td>lockedMonitors</td> <td>  {@code javax.management.openmbean.CompositeData[]}whose element type is the mapped type for  {@link MonitorInfo} as specified in the{@link MonitorInfo#from Monitor.from} method.<p> If  {@code cd} does not contain this attribute,this attribute will be set to an empty array. </td> </tr> <tr> <td>lockedSynchronizers</td> <td> {@code javax.management.openmbean.CompositeData[]}whose element type is the mapped type for  {@link LockInfo} as specified in the {@link LockInfo#from} method.<p> If  {@code cd} does not contain this attribute,this attribute will be set to an empty array. </td> </tr> <tr> <td>daemon</td> <td> {@code java.lang.Boolean}</td> </tr> <tr> <td>priority</td> <td>  {@code java.lang.Integer}</td> </tr> </table> </blockquote>
 * @param cd {@code CompositeData} representing a {@code ThreadInfo}
 * @throws IllegalArgumentException if {@code cd} does notrepresent a  {@code ThreadInfo} with the attributes describedabove.
 * @return a {@code ThreadInfo} object representedby  {@code cd} if {@code cd} is not {@code null};  {@code null} otherwise.
 * @revised 9
 * @spec JPMS
 */
public static ThreadInfo from(CompositeData cd){
  if (cd == null) {
    return null;
  }
  if (cd instanceof ThreadInfoCompositeData) {
    return ((ThreadInfoCompositeData)cd).getThreadInfo();
  }
 else {
    return new ThreadInfo(cd);
  }
}