[Demonstration 1]

[Buggy Method]
public void setConnectionStatusAndNotify(final CONNECTION_STATE newState, final boolean makeStickyBroadcast) {
    synchronized (this) {
        Log.d("com.resmed.refresh.bluetooth", " connection status changed to : " + newState + " current sStatus : " + LL.mainModule.connectionState);
        AppFileLog.addTrace("connection status changed to : " + newState + " current sStatus : " + LL.mainModule.connectionState);
        if (newState == CONNECTION_STATE.BLUETOOTH_ON) {
            BluetoothSetup.count = 1;
        }
        if (newState == CONNECTION_STATE.SOCKET_CONNECTED && LL.reactContext != null) {
            BluetoothSetup.count = 1;
        }
        if (makeStickyBroadcast) {
            final Intent intent = new Intent("ACTION_RESMED_CONNECTION_STATUS");
            intent.putExtra("EXTRA_RESMED_CONNECTION_STATE", newState);
            LL.reactContext.sendStickyOrderedBroadcast(intent, null, null, -1, null, null);
        }
        if (newState == CONNECTION_STATE.SOCKET_BROKEN || newState == CONNECTION_STATE.BLUETOOTH_ON) {
            this.reconnection();
        }
        if (this.device != null)
            SPlusModule.main.sessionConnector.service.ReactToFoundDevice(this.device);
        // handling moved to BaseBluetoothActivity
        /*if (newState == CONNECTION_STATE.SOCKET_CONNECTED) {
				V.Log("YAY1!!!");
				//MainActivity.main.sendRpcToBed(RPCMapper.getInstance().openSession("c63eb080-a864-11e3-a5e2-0800200c9a66"));
				MainActivity.main.sendRpcToBed(RPCMapper.getInstance().openSession("c63eb080-a864-11e3-a5e2-000000000009"));
				AddReceivers(); // since this section always gets called, use it to set up the receivers for the second and third steps
			} else if (newState == CONNECTION_STATE.SESSION_OPENING) {
				V.Log("YAY2!!!");
				MainActivity.main.sendRpcToBed(RPCMapper.getInstance().clearBuffers());
			} else*/
        // session is auto-started
        /*if (newState == CONNECTION_STATE.SESSION_OPENED) {
				V.Log("YAY3!!!");
				//MainActivity.main.sendRpcToBed(RPCMapper.getInstance().startNightTracking());
				MainActivity.main.sendRpcToBed(RPCMapper.getInstance().startRealTimeStream());

				/*Timer timer = new Timer();
				timer.scheduleAtFixedRate(new TimerTask(){@Override public void run() {
					//SleepSessionManager.this.requestUserSleepState();
					V.Log("Stage:" + SPlusModule.main.baseManager.rm20Manager.getRealTimeSleepState());
					//SPlusModule.main.baseManager.rm20Manager.startRespRateCallbacks(true);

					/*SPlusModule.main.baseManager.stopCalculateAndSendResults();
					SPlusModule.main.baseManager.StartSession(71, 20, 1);*#/
				}}, 10000, 10000);*#/
			}*/
    }
}

[Buggy Hunk]
if (this.device != null)

[Patch]
if (this.device != null && SPlusModule.main.sessionConnector != null)

[Demonstration 2]

[Buggy Method]
public static void setSong(Track track) {
    stop();
    File file = new File("music/" + track.getPath());
    SongType type = track.getType();
    if (type == SongType.MP3 || type == SongType.AAC || type == SongType.WAV || type == SongType.AIFF) {
        mp3 = new Media(file.toURI().toString());
        mp3player = new MediaPlayer(mp3);
    } else if (type == SongType.MIDI) {
        try {
            midiSequence = MidiSystem.getSequence(file);
            midiSequencer.setSequence(midiSequence);
        } catch (InvalidMidiDataException | IOException e) {
        }
    }
}

[Buggy Hunk]
}catch(InvalidMidiDataException | IOException e){}

[Patch]
}catch(InvalidMidiDataException | IOException e){System.out.println(e);}

[Demonstration 3]

[Buggy Method]
private static String hash(String password) throws NoSuchAlgorithmException, InvalidKeySpecException {
    // generate a random salt
    SecureRandom rand = new SecureRandom();
    byte[] salt = new byte[SALT_LEN];
    rand.nextBytes(salt);
    return hash(password, salt);
}

[Buggy Hunk]
private static String hash(String password) throws NoSuchAlgorithmException, InvalidKeySpecException {

[Patch]
static String hash(String password) throws NoSuchAlgorithmException, InvalidKeySpecException {