Program: 23998
Project: 23998
Buggy source:
private void processUnsolicited(Parcel p){
  int response;
  Object ret;
  response=p.readInt();
  try {
switch (response) {
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
      ret=responseVoid(p);
    break;
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
  ret=responseVoid(p);
break;
case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED:
ret=responseVoid(p);
break;
case RIL_UNSOL_RESPONSE_NEW_SMS:
ret=responseString(p);
break;
case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT:
ret=responseString(p);
break;
case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM:
ret=responseInts(p);
break;
case RIL_UNSOL_ON_USSD:
ret=responseStrings(p);
break;
case RIL_UNSOL_NITZ_TIME_RECEIVED:
ret=responseString(p);
break;
case RIL_UNSOL_SIGNAL_STRENGTH:
ret=responseSignalStrength(p);
break;
case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
ret=responseDataCallList(p);
break;
case RIL_UNSOL_SUPP_SVC_NOTIFICATION:
ret=responseSuppServiceNotification(p);
break;
case RIL_UNSOL_STK_SESSION_END:
ret=responseVoid(p);
break;
case RIL_UNSOL_STK_PROACTIVE_COMMAND:
ret=responseString(p);
break;
case RIL_UNSOL_STK_EVENT_NOTIFY:
ret=responseString(p);
break;
case RIL_UNSOL_STK_CALL_SETUP:
ret=responseInts(p);
break;
case RIL_UNSOL_SIM_SMS_STORAGE_FULL:
ret=responseVoid(p);
break;
case RIL_UNSOL_SIM_REFRESH:
ret=responseInts(p);
break;
case RIL_UNSOL_CALL_RING:
ret=responseCallRing(p);
break;
case RIL_UNSOL_RESTRICTED_STATE_CHANGED:
ret=responseInts(p);
break;
case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED:
ret=responseVoid(p);
break;
case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS:
ret=responseCdmaSms(p);
break;
case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS:
ret=responseString(p);
break;
case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL:
ret=responseVoid(p);
break;
case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE:
ret=responseVoid(p);
break;
case RIL_UNSOL_CDMA_CALL_WAITING:
ret=responseCdmaCallWaiting(p);
break;
case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS:
ret=responseInts(p);
break;
case RIL_UNSOL_CDMA_INFO_REC:
ret=responseCdmaInformationRecord(p);
break;
case RIL_UNSOL_OEM_HOOK_RAW:
ret=responseRaw(p);
break;
default :
throw new RuntimeException("String_Node_Str" + response);
}
}
 catch (Throwable tr) {
Log.e(LOG_TAG,"String_Node_Str" + response + "String_Node_Str"+ tr.toString());
return;
}
switch (response) {
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
setRadioStateFromRILInt(p.readInt());
if (RILJ_LOGD) unsljLogMore(response,mState.toString());
break;
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
if (RILJ_LOGD) unsljLog(response);
mCallStateRegistrants.notifyRegistrants(new AsyncResult(null,null,null));
break;
case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED:
if (RILJ_LOGD) unsljLog(response);
mNetworkStateRegistrants.notifyRegistrants(new AsyncResult(null,null,null));
break;
case RIL_UNSOL_RESPONSE_NEW_SMS:
{
if (RILJ_LOGD) unsljLog(response);
String a[]=new String[2];
a[1]=(String)ret;
SmsMessage sms;
sms=SmsMessage.newFromCMT(a);
if (mSMSRegistrant != null) {
mSMSRegistrant.notifyRegistrant(new AsyncResult(null,sms,null));
}
break;
}
case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mSmsStatusRegistrant != null) {
mSmsStatusRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM:
if (RILJ_LOGD) unsljLogRet(response,ret);
int[] smsIndex=(int[])ret;
if (smsIndex.length == 1) {
if (mSmsOnSimRegistrant != null) {
mSmsOnSimRegistrant.notifyRegistrant(new AsyncResult(null,smsIndex,null));
}
}
 else {
if (RILJ_LOGD) riljLog("String_Node_Str" + smsIndex.length);
}
break;
case RIL_UNSOL_ON_USSD:
String[] resp=(String[])ret;
if (resp.length < 2) {
resp=new String[2];
resp[0]=((String[])ret)[0];
resp[1]=null;
}
if (RILJ_LOGD) unsljLogMore(response,resp[0]);
if (mUSSDRegistrant != null) {
mUSSDRegistrant.notifyRegistrant(new AsyncResult(null,resp,null));
}
break;
case RIL_UNSOL_NITZ_TIME_RECEIVED:
if (RILJ_LOGD) unsljLogRet(response,ret);
long nitzReceiveTime=p.readLong();
Object[] result=new Object[2];
result[0]=ret;
result[1]=Long.valueOf(nitzReceiveTime);
if (mNITZTimeRegistrant != null) {
mNITZTimeRegistrant.notifyRegistrant(new AsyncResult(null,result,null));
}
 else {
mLastNITZTimeInfo=result;
}
break;
case RIL_UNSOL_SIGNAL_STRENGTH:
if (RILJ_LOGV) unsljLogvRet(response,ret);
if (mSignalStrengthRegistrant != null) {
mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
if (RILJ_LOGD) unsljLogRet(response,ret);
mDataConnectionRegistrants.notifyRegistrants(new AsyncResult(null,ret,null));
break;
case RIL_UNSOL_SUPP_SVC_NOTIFICATION:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mSsnRegistrant != null) {
mSsnRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_STK_SESSION_END:
if (RILJ_LOGD) unsljLog(response);
if (mStkSessionEndRegistrant != null) {
mStkSessionEndRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_STK_PROACTIVE_COMMAND:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mStkProCmdRegistrant != null) {
mStkProCmdRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_STK_EVENT_NOTIFY:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mStkEventRegistrant != null) {
mStkEventRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_STK_CALL_SETUP:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mStkCallSetUpRegistrant != null) {
mStkCallSetUpRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_SIM_SMS_STORAGE_FULL:
if (RILJ_LOGD) unsljLog(response);
if (mIccSmsFullRegistrant != null) {
mIccSmsFullRegistrant.notifyRegistrant();
}
break;
case RIL_UNSOL_SIM_REFRESH:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mIccRefreshRegistrant != null) {
mIccRefreshRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_CALL_RING:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mRingRegistrant != null) {
mRingRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_RESTRICTED_STATE_CHANGED:
if (RILJ_LOGD) unsljLogvRet(response,ret);
if (mRestrictedStateRegistrant != null) {
mRestrictedStateRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED:
if (RILJ_LOGD) unsljLog(response);
if (mIccStatusChangedRegistrants != null) {
mIccStatusChangedRegistrants.notifyRegistrants();
}
break;
case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS:
if (RILJ_LOGD) unsljLog(response);
SmsMessage sms=(SmsMessage)ret;
if (mSMSRegistrant != null) {
mSMSRegistrant.notifyRegistrant(new AsyncResult(null,sms,null));
}
break;
case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS:
if (RILJ_LOGD) unsljLog(response);
if (mGsmBroadcastSmsRegistrant != null) {
mGsmBroadcastSmsRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL:
if (RILJ_LOGD) unsljLog(response);
if (mIccSmsFullRegistrant != null) {
mIccSmsFullRegistrant.notifyRegistrant();
}
break;
case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE:
if (RILJ_LOGD) unsljLog(response);
if (mEmergencyCallbackModeRegistrant != null) {
mEmergencyCallbackModeRegistrant.notifyRegistrant();
}
break;
case RIL_UNSOL_CDMA_CALL_WAITING:
if (RILJ_LOGD) unsljLog(response);
if (mCallWaitingInfoRegistrants != null) {
mCallWaitingInfoRegistrants.notifyRegistrants(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mOtaProvisionRegistrants != null) {
mOtaProvisionRegistrants.notifyRegistrants(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_CDMA_INFO_REC:
ArrayList<CdmaInformationRecords> listInfoRecs;
try {
listInfoRecs=(ArrayList<CdmaInformationRecords>)ret;
}
 catch (ClassCastException e) {
Log.e(LOG_TAG,"String_Node_Str",e);
break;
}
for (CdmaInformationRecords rec : listInfoRecs) {
if (RILJ_LOGD) unsljLogRet(response,rec);
notifyRegistrantsCdmaInfoRec(rec);
}
break;
case RIL_UNSOL_OEM_HOOK_RAW:
if (RILJ_LOGD) unsljLogvRet(response,IccUtils.bytesToHexString((byte[])ret));
if (mUnsolOemHookRawRegistrant != null) {
mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
}
}

Fixed version (ground truth):
private void processUnsolicited(Parcel p){
  int response;
  Object ret;
  response=p.readInt();
  try {
switch (response) {
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
      ret=responseVoid(p);
    break;
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
  ret=responseVoid(p);
break;
case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED:
ret=responseVoid(p);
break;
case RIL_UNSOL_RESPONSE_NEW_SMS:
ret=responseString(p);
break;
case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT:
ret=responseString(p);
break;
case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM:
ret=responseInts(p);
break;
case RIL_UNSOL_ON_USSD:
ret=responseStrings(p);
break;
case RIL_UNSOL_NITZ_TIME_RECEIVED:
ret=responseString(p);
break;
case RIL_UNSOL_SIGNAL_STRENGTH:
ret=responseSignalStrength(p);
break;
case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
ret=responseDataCallList(p);
break;
case RIL_UNSOL_SUPP_SVC_NOTIFICATION:
ret=responseSuppServiceNotification(p);
break;
case RIL_UNSOL_STK_SESSION_END:
ret=responseVoid(p);
break;
case RIL_UNSOL_STK_PROACTIVE_COMMAND:
ret=responseString(p);
break;
case RIL_UNSOL_STK_EVENT_NOTIFY:
ret=responseString(p);
break;
case RIL_UNSOL_STK_CALL_SETUP:
ret=responseInts(p);
break;
case RIL_UNSOL_SIM_SMS_STORAGE_FULL:
ret=responseVoid(p);
break;
case RIL_UNSOL_SIM_REFRESH:
ret=responseInts(p);
break;
case RIL_UNSOL_CALL_RING:
ret=responseCallRing(p);
break;
case RIL_UNSOL_RESTRICTED_STATE_CHANGED:
ret=responseInts(p);
break;
case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED:
ret=responseVoid(p);
break;
case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS:
ret=responseCdmaSms(p);
break;
case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS:
ret=responseString(p);
break;
case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL:
ret=responseVoid(p);
break;
case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE:
ret=responseVoid(p);
break;
case RIL_UNSOL_CDMA_CALL_WAITING:
ret=responseCdmaCallWaiting(p);
break;
case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS:
ret=responseInts(p);
break;
case RIL_UNSOL_CDMA_INFO_REC:
ret=responseCdmaInformationRecord(p);
break;
case RIL_UNSOL_OEM_HOOK_RAW:
ret=responseRaw(p);
break;
default :
throw new RuntimeException("String_Node_Str" + response);
}
}
 catch (Throwable tr) {
Log.e(LOG_TAG,"String_Node_Str" + response + "String_Node_Str"+ tr.toString());
return;
}
switch (response) {
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
setRadioStateFromRILInt(p.readInt());
if (RILJ_LOGD) unsljLogMore(response,mState.toString());
break;
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
if (RILJ_LOGD) unsljLog(response);
mCallStateRegistrants.notifyRegistrants(new AsyncResult(null,null,null));
break;
case RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED:
if (RILJ_LOGD) unsljLog(response);
mNetworkStateRegistrants.notifyRegistrants(new AsyncResult(null,null,null));
break;
case RIL_UNSOL_RESPONSE_NEW_SMS:
{
if (RILJ_LOGD) unsljLog(response);
String a[]=new String[2];
a[1]=(String)ret;
SmsMessage sms;
sms=SmsMessage.newFromCMT(a);
if (mSMSRegistrant != null) {
mSMSRegistrant.notifyRegistrant(new AsyncResult(null,sms,null));
}
break;
}
case RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mSmsStatusRegistrant != null) {
mSmsStatusRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM:
if (RILJ_LOGD) unsljLogRet(response,ret);
int[] smsIndex=(int[])ret;
if (smsIndex.length == 1) {
if (mSmsOnSimRegistrant != null) {
mSmsOnSimRegistrant.notifyRegistrant(new AsyncResult(null,smsIndex,null));
}
}
 else {
if (RILJ_LOGD) riljLog("String_Node_Str" + smsIndex.length);
}
break;
case RIL_UNSOL_ON_USSD:
String[] resp=(String[])ret;
if (resp.length < 2) {
resp=new String[2];
resp[0]=((String[])ret)[0];
resp[1]=null;
}
if (RILJ_LOGD) unsljLogMore(response,resp[0]);
if (mUSSDRegistrant != null) {
mUSSDRegistrant.notifyRegistrant(new AsyncResult(null,resp,null));
}
break;
case RIL_UNSOL_NITZ_TIME_RECEIVED:
if (RILJ_LOGD) unsljLogRet(response,ret);
long nitzReceiveTime=p.readLong();
Object[] result=new Object[2];
result[0]=ret;
result[1]=Long.valueOf(nitzReceiveTime);
if (mNITZTimeRegistrant != null) {
mNITZTimeRegistrant.notifyRegistrant(new AsyncResult(null,result,null));
}
 else {
mLastNITZTimeInfo=result;
}
break;
case RIL_UNSOL_SIGNAL_STRENGTH:
if (RILJ_LOGV) unsljLogvRet(response,ret);
if (mSignalStrengthRegistrant != null) {
mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_DATA_CALL_LIST_CHANGED:
if (RILJ_LOGD) unsljLogRet(response,ret);
mDataConnectionRegistrants.notifyRegistrants(new AsyncResult(null,ret,null));
break;
case RIL_UNSOL_SUPP_SVC_NOTIFICATION:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mSsnRegistrant != null) {
mSsnRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_STK_SESSION_END:
if (RILJ_LOGD) unsljLog(response);
if (mStkSessionEndRegistrant != null) {
mStkSessionEndRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_STK_PROACTIVE_COMMAND:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mStkProCmdRegistrant != null) {
mStkProCmdRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_STK_EVENT_NOTIFY:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mStkEventRegistrant != null) {
mStkEventRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_STK_CALL_SETUP:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mStkCallSetUpRegistrant != null) {
mStkCallSetUpRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_SIM_SMS_STORAGE_FULL:
if (RILJ_LOGD) unsljLog(response);
if (mIccSmsFullRegistrant != null) {
mIccSmsFullRegistrant.notifyRegistrant();
}
break;
case RIL_UNSOL_SIM_REFRESH:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mIccRefreshRegistrant != null) {
mIccRefreshRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_CALL_RING:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mRingRegistrant != null) {
mRingRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_RESTRICTED_STATE_CHANGED:
if (RILJ_LOGD) unsljLogvRet(response,ret);
if (mRestrictedStateRegistrant != null) {
mRestrictedStateRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
case RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED:
if (RILJ_LOGD) unsljLog(response);
if (mIccStatusChangedRegistrants != null) {
mIccStatusChangedRegistrants.notifyRegistrants();
}
break;
case RIL_UNSOL_RESPONSE_CDMA_NEW_SMS:
if (RILJ_LOGD) unsljLog(response);
SmsMessage sms=(SmsMessage)ret;
if (mSMSRegistrant != null) {
mSMSRegistrant.notifyRegistrant(new AsyncResult(null,sms,null));
}
break;
case RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS:
if (RILJ_LOGD) unsljLog(response);
if (mGsmBroadcastSmsRegistrant != null) {
mGsmBroadcastSmsRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL:
if (RILJ_LOGD) unsljLog(response);
if (mIccSmsFullRegistrant != null) {
mIccSmsFullRegistrant.notifyRegistrant();
}
break;
case RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE:
if (RILJ_LOGD) unsljLog(response);
if (mEmergencyCallbackModeRegistrant != null) {
mEmergencyCallbackModeRegistrant.notifyRegistrant();
}
break;
case RIL_UNSOL_CDMA_CALL_WAITING:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mCallWaitingInfoRegistrants != null) {
mCallWaitingInfoRegistrants.notifyRegistrants(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_CDMA_OTA_PROVISION_STATUS:
if (RILJ_LOGD) unsljLogRet(response,ret);
if (mOtaProvisionRegistrants != null) {
mOtaProvisionRegistrants.notifyRegistrants(new AsyncResult(null,ret,null));
}
break;
case RIL_UNSOL_CDMA_INFO_REC:
ArrayList<CdmaInformationRecords> listInfoRecs;
try {
listInfoRecs=(ArrayList<CdmaInformationRecords>)ret;
}
 catch (ClassCastException e) {
Log.e(LOG_TAG,"String_Node_Str",e);
break;
}
for (CdmaInformationRecords rec : listInfoRecs) {
if (RILJ_LOGD) unsljLogRet(response,rec);
notifyRegistrantsCdmaInfoRec(rec);
}
break;
case RIL_UNSOL_OEM_HOOK_RAW:
if (RILJ_LOGD) unsljLogvRet(response,IccUtils.bytesToHexString((byte[])ret));
if (mUnsolOemHookRawRegistrant != null) {
mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null,ret,null));
}
break;
}
}