Program: 32382
Project: 32382
Buggy source:
@Override public void handleMessage(Message msg){
  TransportBroker broker=provider.get();
  if (broker == null) {
    Log.e(TAG,"String_Node_Str");
  }
  Bundle bundle=msg.getData();
  if (bundle != null) {
    bundle.setClassLoader(loader);
  }
  if (bundle != null && bundle.containsKey(TransportConstants.ENABLE_LEGACY_MODE_EXTRA)) {
    boolean enableLegacy=bundle.getBoolean(TransportConstants.ENABLE_LEGACY_MODE_EXTRA,false);
    broker.enableLegacyMode(enableLegacy);
  }
switch (msg.what) {
case TransportConstants.ROUTER_REGISTER_CLIENT_RESPONSE:
switch (msg.arg1) {
case TransportConstants.REGISTRATION_RESPONSE_SUCESS:
      broker.registeredWithRouterService=true;
    if (bundle != null) {
      if (bundle.containsKey(TransportConstants.HARDWARE_CONNECTED)) {
        if (bundle.containsKey(TransportConstants.CONNECTED_DEVICE_STRING_EXTRA_NAME)) {
        }
        broker.onHardwareConnected(TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_CONNECTED)));
      }
    }
  break;
case TransportConstants.REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED:
Log.d(TAG,"String_Node_Str");
broker.registeredWithRouterService=false;
broker.enableLegacyMode(true);
broker.onLegacyModeEnabled();
break;
default :
broker.registeredWithRouterService=false;
Log.w(TAG,"String_Node_Str" + msg.arg1);
break;
}
;
break;
case TransportConstants.ROUTER_UNREGISTER_CLIENT_RESPONSE:
if (msg.arg1 == TransportConstants.UNREGISTRATION_RESPONSE_SUCESS) {
}
 else {
Log.w(TAG,"String_Node_Str" + msg.arg1);
}
break;
case TransportConstants.ROUTER_RECEIVED_PACKET:
int flags=bundle.getInt(TransportConstants.BYTES_TO_SEND_FLAGS,TransportConstants.BYTES_TO_SEND_FLAG_NONE);
if (bundle.containsKey(TransportConstants.FORMED_PACKET_EXTRA_NAME)) {
Parcelable packet=bundle.getParcelable(TransportConstants.FORMED_PACKET_EXTRA_NAME);
if (flags == TransportConstants.BYTES_TO_SEND_FLAG_NONE) {
if (packet != null) {
broker.onPacketReceived(packet);
}
 else {
Log.w(TAG,"String_Node_Str");
}
}
 else if (flags == TransportConstants.BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED) {
broker.bufferedPacket=(SdlPacket)packet;
if (broker.bufferedPayloadAssembler != null) {
broker.bufferedPayloadAssembler.close();
broker.bufferedPayloadAssembler=null;
}
broker.bufferedPayloadAssembler=new ByteAraryMessageAssembler();
broker.bufferedPayloadAssembler.init();
}
}
 else if (bundle.containsKey(TransportConstants.BYTES_TO_SEND_EXTRA_NAME)) {
if (broker.bufferedPayloadAssembler != null) {
byte[] chunk=bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
if (!broker.bufferedPayloadAssembler.handleMessage(flags,chunk)) {
Log.e(TAG,"String_Node_Str");
}
if (broker.bufferedPayloadAssembler.isFinished()) {
broker.bufferedPacket.setPayload(broker.bufferedPayloadAssembler.getBytes());
broker.bufferedPayloadAssembler.close();
broker.bufferedPayloadAssembler=null;
broker.onPacketReceived(broker.bufferedPacket);
broker.bufferedPacket=null;
}
}
}
 else {
Log.w(TAG,"String_Node_Str");
}
break;
case TransportConstants.HARDWARE_CONNECTION_EVENT:
if (bundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)) {
Log.d(TAG,"String_Node_Str");
if (isLegacyModeEnabled()) {
broker.onLegacyModeEnabled();
}
 else {
broker.onHardwareDisconnected(TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_DISCONNECTED)));
}
break;
}
if (bundle.containsKey(TransportConstants.HARDWARE_CONNECTED)) {
if (bundle != null && bundle.containsKey(TransportConstants.CONNECTED_DEVICE_STRING_EXTRA_NAME)) {
}
broker.onHardwareConnected(TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_CONNECTED)));
break;
}
break;
default :
super.handleMessage(msg);
}
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  TransportBroker broker=provider.get();
  if (broker == null) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  Bundle bundle=msg.getData();
  if (bundle != null) {
    bundle.setClassLoader(loader);
  }
  if (bundle != null && bundle.containsKey(TransportConstants.ENABLE_LEGACY_MODE_EXTRA)) {
    boolean enableLegacy=bundle.getBoolean(TransportConstants.ENABLE_LEGACY_MODE_EXTRA,false);
    broker.enableLegacyMode(enableLegacy);
  }
switch (msg.what) {
case TransportConstants.ROUTER_REGISTER_CLIENT_RESPONSE:
switch (msg.arg1) {
case TransportConstants.REGISTRATION_RESPONSE_SUCESS:
      broker.registeredWithRouterService=true;
    if (bundle != null) {
      if (bundle.containsKey(TransportConstants.HARDWARE_CONNECTED)) {
        if (bundle.containsKey(TransportConstants.CONNECTED_DEVICE_STRING_EXTRA_NAME)) {
        }
        broker.onHardwareConnected(TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_CONNECTED)));
      }
    }
  break;
case TransportConstants.REGISTRATION_RESPONSE_DENIED_LEGACY_MODE_ENABLED:
Log.d(TAG,"String_Node_Str");
broker.registeredWithRouterService=false;
broker.enableLegacyMode(true);
broker.onLegacyModeEnabled();
break;
default :
broker.registeredWithRouterService=false;
Log.w(TAG,"String_Node_Str" + msg.arg1);
break;
}
;
break;
case TransportConstants.ROUTER_UNREGISTER_CLIENT_RESPONSE:
if (msg.arg1 == TransportConstants.UNREGISTRATION_RESPONSE_SUCESS) {
}
 else {
Log.w(TAG,"String_Node_Str" + msg.arg1);
}
break;
case TransportConstants.ROUTER_RECEIVED_PACKET:
int flags=bundle.getInt(TransportConstants.BYTES_TO_SEND_FLAGS,TransportConstants.BYTES_TO_SEND_FLAG_NONE);
if (bundle.containsKey(TransportConstants.FORMED_PACKET_EXTRA_NAME)) {
Parcelable packet=bundle.getParcelable(TransportConstants.FORMED_PACKET_EXTRA_NAME);
if (flags == TransportConstants.BYTES_TO_SEND_FLAG_NONE) {
if (packet != null) {
broker.onPacketReceived(packet);
}
 else {
Log.w(TAG,"String_Node_Str");
}
}
 else if (flags == TransportConstants.BYTES_TO_SEND_FLAG_SDL_PACKET_INCLUDED) {
broker.bufferedPacket=(SdlPacket)packet;
if (broker.bufferedPayloadAssembler != null) {
broker.bufferedPayloadAssembler.close();
broker.bufferedPayloadAssembler=null;
}
broker.bufferedPayloadAssembler=new ByteAraryMessageAssembler();
broker.bufferedPayloadAssembler.init();
}
}
 else if (bundle.containsKey(TransportConstants.BYTES_TO_SEND_EXTRA_NAME)) {
if (broker.bufferedPayloadAssembler != null) {
byte[] chunk=bundle.getByteArray(TransportConstants.BYTES_TO_SEND_EXTRA_NAME);
if (!broker.bufferedPayloadAssembler.handleMessage(flags,chunk)) {
Log.e(TAG,"String_Node_Str");
}
if (broker.bufferedPayloadAssembler.isFinished()) {
broker.bufferedPacket.setPayload(broker.bufferedPayloadAssembler.getBytes());
broker.bufferedPayloadAssembler.close();
broker.bufferedPayloadAssembler=null;
broker.onPacketReceived(broker.bufferedPacket);
broker.bufferedPacket=null;
}
}
}
 else {
Log.w(TAG,"String_Node_Str");
}
break;
case TransportConstants.HARDWARE_CONNECTION_EVENT:
if (bundle.containsKey(TransportConstants.HARDWARE_DISCONNECTED)) {
Log.d(TAG,"String_Node_Str");
if (isLegacyModeEnabled()) {
broker.onLegacyModeEnabled();
}
 else {
broker.onHardwareDisconnected(TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_DISCONNECTED)));
}
break;
}
if (bundle.containsKey(TransportConstants.HARDWARE_CONNECTED)) {
if (bundle != null && bundle.containsKey(TransportConstants.CONNECTED_DEVICE_STRING_EXTRA_NAME)) {
}
broker.onHardwareConnected(TransportType.valueOf(bundle.getString(TransportConstants.HARDWARE_CONNECTED)));
break;
}
break;
default :
super.handleMessage(msg);
}
}