Program: 171687
Project: 171687
Buggy source:
private void handleSteamMessage(CallbackMsg msg){
  Log.i(TAG,msg.toString());
  msg.handle(ConnectedCallback.class,new ActionT<ConnectedCallback>(){
    @Override public void call(    ConnectedCallback callback){
      Log.i(TAG,"String_Node_Str");
      stopTimeout();
      connected=true;
      attemptRestoreLogin();
    }
  }
);
  msg.handle(DisconnectedCallback.class,new ActionT<DisconnectedCallback>(){
    @Override public void call(    DisconnectedCallback callback){
      Log.i(TAG,"String_Node_Str");
      stopTimeout();
      connected=false;
      loggedIn=false;
      scheduler.schedule(new Runnable(){
        @Override public void run(){
          startTimeout();
          Log.i(TAG,"String_Node_Str");
          steamClient.connect();
        }
      }
,3,TimeUnit.SECONDS);
      LocalBroadcastManager.getInstance(SteamService.this).sendBroadcast(new Intent(DISCONNECT_EVENT));
    }
  }
);
  msg.handle(LoggedOffCallback.class,new ActionT<LoggedOffCallback>(){
    @Override public void call(    LoggedOffCallback callback){
      Log.i(TAG,"String_Node_Str" + callback.getResult().toString());
      stopTimeout();
      if (callback.getResult() == EResult.LoggedInElsewhere) {
        updateNotification(getString(R.string.logged_in_elsewhere));
        unscheduleFarmTask();
        if (!waiting) {
          waiting=true;
          waitHandle=scheduler.scheduleAtFixedRate(waitTask,0,30,TimeUnit.SECONDS);
        }
      }
 else {
        steamClient.disconnect();
      }
    }
  }
);
  msg.handle(LoggedOnCallback.class,new ActionT<LoggedOnCallback>(){
    @Override public void call(    final LoggedOnCallback callback){
      final EResult result=callback.getResult();
      Log.i(TAG,result.toString());
      final String webApiUserNonce=callback.getWebAPIUserNonce();
      if (result == EResult.OK) {
        loggedIn=true;
        steamId=steamClient.getSteamId().convertToLong();
        if (!paused) {
          updateNotification(getString(R.string.logged_in));
        }
 else {
          showPausedNotification();
        }
        executor.execute(new Runnable(){
          @Override public void run(){
            boolean gotAuth=false;
            for (int i=0; i < 3; i++) {
              gotAuth=webHandler.authenticate(steamClient,webApiUserNonce);
              Log.i(TAG,"String_Node_Str" + gotAuth);
              if (gotAuth) {
                break;
              }
              Log.i(TAG,"String_Node_Str");
              try {
                Thread.sleep(500);
              }
 catch (              InterruptedException e) {
                e.printStackTrace();
              }
            }
            if (gotAuth) {
              resumeFarming();
            }
 else {
              updateNotification(getString(R.string.web_login_failed));
            }
          }
        }
);
      }
 else {
        if (result == EResult.InvalidPassword && !Prefs.getLoginKey().isEmpty()) {
          Log.i(TAG,"String_Node_Str");
          Prefs.writeLoginKey("String_Node_Str");
          updateNotification(getString(R.string.login_key_expired));
        }
        steamClient.disconnect();
      }
      final Intent intent=new Intent(LOGIN_EVENT);
      intent.putExtra(RESULT,result);
      LocalBroadcastManager.getInstance(SteamService.this).sendBroadcast(intent);
    }
  }
);
  msg.handle(LoginKeyCallback.class,new ActionT<LoginKeyCallback>(){
    @Override public void call(    LoginKeyCallback callback){
      Log.i(TAG,"String_Node_Str");
      Prefs.writeLoginKey(callback.getLoginKey());
    }
  }
);
  msg.handle(JobCallback.class,new ActionT<JobCallback>(){
    @Override public void call(    JobCallback callback){
      if (callback.getCallbackType() == UpdateMachineAuthCallback.class) {
        Log.i(TAG,"String_Node_Str");
        final UpdateMachineAuthCallback authCallback=(UpdateMachineAuthCallback)callback.getCallback();
        final byte[] data=authCallback.getData();
        final byte[] sha1=CryptoHelper.SHAHash(data);
        writeSentryFile(data);
        final MachineAuthDetails auth=new MachineAuthDetails();
        auth.jobId=callback.getJobId().getValue();
        auth.fileName=authCallback.getFileName();
        auth.bytesWritten=authCallback.getBytesToWrite();
        auth.fileSize=data.length;
        auth.offset=authCallback.getOffset();
        auth.result=EResult.OK;
        auth.lastError=0;
        auth.oneTimePassword=authCallback.getOneTimePassword();
        auth.sentryFileHash=sha1;
        steamUser.sendMachineAuthResponse(auth);
        final String sentryHash=Utils.bytesToHex(sha1);
        Prefs.writeSentryHash(sentryHash);
      }
    }
  }
);
  msg.handle(CMListCallback.class,new ActionT<CMListCallback>(){
    @Override public void call(    CMListCallback callback){
      final String[] servers=callback.getServerList();
      if (servers.length > 0) {
        Log.i(TAG,"String_Node_Str");
        Prefs.writeCmServers(Utils.arrayToString(servers));
      }
    }
  }
);
  msg.handle(NotificationUpdateCallback.class,new ActionT<NotificationUpdateCallback>(){
    @Override public void call(    NotificationUpdateCallback callback){
      Log.i(TAG,"String_Node_Str" + callback.getNotificationCounts().toString());
      for (      Map.Entry<NotificationType,Integer> entry : callback.getNotificationCounts().entrySet()) {
        if (entry.getKey() == NotificationType.ITEMS && entry.getValue() > 0 && farming) {
          executor.execute(farmTask);
          break;
        }
      }
    }
  }
);
  msg.handle(PurchaseResponseCallback.class,new ActionT<PurchaseResponseCallback>(){
    @Override public void call(    PurchaseResponseCallback callback){
      if (callback.getResult() == EResult.OK) {
        final KeyValue kv=callback.getPurchaseReceiptInfo().getKeyValues();
        if (kv.get("String_Node_Str").asInteger() == EPaymentMethod.ActivationCode.v()) {
          final StringBuilder products=new StringBuilder();
          final int size=kv.get("String_Node_Str").asInteger();
          Log.i(TAG,"String_Node_Str" + size);
          for (int i=0; i < size; i++) {
            final String lineItem=kv.get("String_Node_Str").get(i + "String_Node_Str").get("String_Node_Str").asString();
            Log.i(TAG,"String_Node_Str" + i + "String_Node_Str"+ lineItem);
            products.append(lineItem);
            if (i + 1 < size) {
              products.append("String_Node_Str");
            }
          }
          new Handler(Looper.getMainLooper()).post(new Runnable(){
            @Override public void run(){
              Toast.makeText(getApplicationContext(),getString(R.string.activated,products.toString()),Toast.LENGTH_LONG).show();
            }
          }
);
        }
      }
 else {
        final int purchaseResult=callback.getPurchaseResultDetails();
        new Handler(Looper.getMainLooper()).post(new Runnable(){
          @Override public void run(){
            String error;
            if (purchaseResult == 9) {
              error=getString(R.string.product_already_owned);
            }
 else             if (purchaseResult == 14) {
              error=getString(R.string.invalid_key);
            }
 else {
              error=getString(R.string.activation_failed);
            }
            Toast.makeText(getApplicationContext(),error,Toast.LENGTH_LONG).show();
          }
        }
);
      }
    }
  }
);
  msg.handle(PersonaStateCallback.class,new ActionT<PersonaStateCallback>(){
    @Override public void call(    PersonaStateCallback callback){
      if (steamClient.getSteamId().equals(callback.getFriendID())) {
        personaName=callback.getName();
        avatarHash=Utils.bytesToHex(callback.getAvatarHash()).toLowerCase();
        Log.i(TAG,"String_Node_Str" + avatarHash);
        final Intent event=new Intent(PERSONA_EVENT);
        event.putExtra(PERSONA_NAME,personaName);
        event.putExtra(AVATAR_HASH,avatarHash);
        LocalBroadcastManager.getInstance(SteamService.this).sendBroadcast(event);
      }
    }
  }
);
  msg.handle(FreeLicenseCallback.class,new ActionT<FreeLicenseCallback>(){
    @Override public void call(    final FreeLicenseCallback callback){
      final int gameId=callback.getGameId();
      final int[] grantedApps=callback.getGrantedApps();
      final int[] grantedPackages=callback.getGrantedPackages();
      if (grantedApps.length > 0 || grantedPackages.length > 0) {
        new Handler(Looper.getMainLooper()).post(new Runnable(){
          @Override public void run(){
            Toast.makeText(SteamService.this,getString(R.string.activated,String.valueOf(gameId)),Toast.LENGTH_LONG).show();
          }
        }
);
      }
 else {
        executor.execute(new Runnable(){
          @Override public void run(){
            final String msg;
            if (webHandler.addFreeLicense(gameId)) {
              msg=getString(R.string.activated,String.valueOf(gameId));
            }
 else {
              msg=getString(R.string.activation_failed);
            }
            new Handler(Looper.getMainLooper()).post(new Runnable(){
              @Override public void run(){
                Toast.makeText(SteamService.this,msg,Toast.LENGTH_LONG).show();
              }
            }
);
          }
        }
);
      }
    }
  }
);
  msg.handle(AccountInfoCallback.class,new ActionT<AccountInfoCallback>(){
    @Override public void call(    AccountInfoCallback callback){
      if (Prefs.getOffline()) {
        return;
      }
      int tries=0;
      String nickname;
      while (tries < 5) {
        nickname=steamFriends.getPersonaName();
        if (nickname != null && !nickname.equals("String_Node_Str")) {
          break;
        }
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
        tries++;
      }
      steamFriends.setPersonaState(EPersonaState.Online);
    }
  }
);
}

Fixed version (ground truth):
private void handleSteamMessage(CallbackMsg msg){
  Log.i(TAG,msg.toString());
  msg.handle(ConnectedCallback.class,new ActionT<ConnectedCallback>(){
    @Override public void call(    ConnectedCallback callback){
      Log.i(TAG,"String_Node_Str");
      stopTimeout();
      connected=true;
      if (logOnDetails != null) {
        doLogin();
      }
 else {
        attemptRestoreLogin();
      }
    }
  }
);
  msg.handle(DisconnectedCallback.class,new ActionT<DisconnectedCallback>(){
    @Override public void call(    DisconnectedCallback callback){
      Log.i(TAG,"String_Node_Str");
      stopTimeout();
      connected=false;
      loggedIn=false;
      final int delay;
      if (reconnectWithoutDelay) {
        reconnectWithoutDelay=false;
        delay=0;
      }
 else {
        delay=3;
      }
      scheduler.schedule(new Runnable(){
        @Override public void run(){
          startTimeout();
          Log.i(TAG,"String_Node_Str");
          steamClient.connect();
        }
      }
,delay,TimeUnit.SECONDS);
      LocalBroadcastManager.getInstance(SteamService.this).sendBroadcast(new Intent(DISCONNECT_EVENT));
    }
  }
);
  msg.handle(LoggedOffCallback.class,new ActionT<LoggedOffCallback>(){
    @Override public void call(    LoggedOffCallback callback){
      Log.i(TAG,"String_Node_Str" + callback.getResult().toString());
      stopTimeout();
      if (callback.getResult() == EResult.LoggedInElsewhere) {
        updateNotification(getString(R.string.logged_in_elsewhere));
        unscheduleFarmTask();
        if (!waiting) {
          waiting=true;
          waitHandle=scheduler.scheduleAtFixedRate(waitTask,0,30,TimeUnit.SECONDS);
        }
      }
 else {
        steamClient.disconnect();
      }
    }
  }
);
  msg.handle(LoggedOnCallback.class,new ActionT<LoggedOnCallback>(){
    @Override public void call(    final LoggedOnCallback callback){
      final EResult result=callback.getResult();
      Log.i(TAG,result.toString());
      final String webApiUserNonce=callback.getWebAPIUserNonce();
      if (result == EResult.OK) {
        loggedIn=true;
        steamId=steamClient.getSteamId().convertToLong();
        if (!paused) {
          updateNotification(getString(R.string.logged_in));
        }
 else {
          showPausedNotification();
        }
        executor.execute(new Runnable(){
          @Override public void run(){
            boolean gotAuth=false;
            for (int i=0; i < 3; i++) {
              gotAuth=webHandler.authenticate(steamClient,webApiUserNonce);
              Log.i(TAG,"String_Node_Str" + gotAuth);
              if (gotAuth) {
                break;
              }
              Log.i(TAG,"String_Node_Str");
              try {
                Thread.sleep(500);
              }
 catch (              InterruptedException e) {
                e.printStackTrace();
              }
            }
            if (gotAuth) {
              resumeFarming();
            }
 else {
              updateNotification(getString(R.string.web_login_failed));
            }
          }
        }
);
      }
 else {
        if (result == EResult.InvalidPassword && !Prefs.getLoginKey().isEmpty()) {
          Log.i(TAG,"String_Node_Str");
          Prefs.writeLoginKey("String_Node_Str");
          updateNotification(getString(R.string.login_key_expired));
        }
      }
      final Intent intent=new Intent(LOGIN_EVENT);
      intent.putExtra(RESULT,result);
      LocalBroadcastManager.getInstance(SteamService.this).sendBroadcast(intent);
    }
  }
);
  msg.handle(LoginKeyCallback.class,new ActionT<LoginKeyCallback>(){
    @Override public void call(    LoginKeyCallback callback){
      Log.i(TAG,"String_Node_Str");
      Prefs.writeLoginKey(callback.getLoginKey());
    }
  }
);
  msg.handle(JobCallback.class,new ActionT<JobCallback>(){
    @Override public void call(    JobCallback callback){
      if (callback.getCallbackType() == UpdateMachineAuthCallback.class) {
        Log.i(TAG,"String_Node_Str");
        final UpdateMachineAuthCallback authCallback=(UpdateMachineAuthCallback)callback.getCallback();
        final byte[] data=authCallback.getData();
        final byte[] sha1=CryptoHelper.SHAHash(data);
        writeSentryFile(data);
        final MachineAuthDetails auth=new MachineAuthDetails();
        auth.jobId=callback.getJobId().getValue();
        auth.fileName=authCallback.getFileName();
        auth.bytesWritten=authCallback.getBytesToWrite();
        auth.fileSize=data.length;
        auth.offset=authCallback.getOffset();
        auth.result=EResult.OK;
        auth.lastError=0;
        auth.oneTimePassword=authCallback.getOneTimePassword();
        auth.sentryFileHash=sha1;
        steamUser.sendMachineAuthResponse(auth);
        final String sentryHash=Utils.bytesToHex(sha1);
        Prefs.writeSentryHash(sentryHash);
      }
    }
  }
);
  msg.handle(CMListCallback.class,new ActionT<CMListCallback>(){
    @Override public void call(    CMListCallback callback){
      final String[] servers=callback.getServerList();
      if (servers.length > 0) {
        Log.i(TAG,"String_Node_Str");
        Prefs.writeCmServers(Utils.arrayToString(servers));
      }
    }
  }
);
  msg.handle(NotificationUpdateCallback.class,new ActionT<NotificationUpdateCallback>(){
    @Override public void call(    NotificationUpdateCallback callback){
      Log.i(TAG,"String_Node_Str" + callback.getNotificationCounts().toString());
      for (      Map.Entry<NotificationType,Integer> entry : callback.getNotificationCounts().entrySet()) {
        if (entry.getKey() == NotificationType.ITEMS && entry.getValue() > 0 && farming) {
          executor.execute(farmTask);
          break;
        }
      }
    }
  }
);
  msg.handle(PurchaseResponseCallback.class,new ActionT<PurchaseResponseCallback>(){
    @Override public void call(    PurchaseResponseCallback callback){
      if (callback.getResult() == EResult.OK) {
        final KeyValue kv=callback.getPurchaseReceiptInfo().getKeyValues();
        if (kv.get("String_Node_Str").asInteger() == EPaymentMethod.ActivationCode.v()) {
          final StringBuilder products=new StringBuilder();
          final int size=kv.get("String_Node_Str").asInteger();
          Log.i(TAG,"String_Node_Str" + size);
          for (int i=0; i < size; i++) {
            final String lineItem=kv.get("String_Node_Str").get(i + "String_Node_Str").get("String_Node_Str").asString();
            Log.i(TAG,"String_Node_Str" + i + "String_Node_Str"+ lineItem);
            products.append(lineItem);
            if (i + 1 < size) {
              products.append("String_Node_Str");
            }
          }
          new Handler(Looper.getMainLooper()).post(new Runnable(){
            @Override public void run(){
              Toast.makeText(getApplicationContext(),getString(R.string.activated,products.toString()),Toast.LENGTH_LONG).show();
            }
          }
);
        }
      }
 else {
        final int purchaseResult=callback.getPurchaseResultDetails();
        new Handler(Looper.getMainLooper()).post(new Runnable(){
          @Override public void run(){
            String error;
            if (purchaseResult == 9) {
              error=getString(R.string.product_already_owned);
            }
 else             if (purchaseResult == 14) {
              error=getString(R.string.invalid_key);
            }
 else {
              error=getString(R.string.activation_failed);
            }
            Toast.makeText(getApplicationContext(),error,Toast.LENGTH_LONG).show();
          }
        }
);
      }
    }
  }
);
  msg.handle(PersonaStateCallback.class,new ActionT<PersonaStateCallback>(){
    @Override public void call(    PersonaStateCallback callback){
      if (steamClient.getSteamId().equals(callback.getFriendID())) {
        personaName=callback.getName();
        avatarHash=Utils.bytesToHex(callback.getAvatarHash()).toLowerCase();
        Log.i(TAG,"String_Node_Str" + avatarHash);
        final Intent event=new Intent(PERSONA_EVENT);
        event.putExtra(PERSONA_NAME,personaName);
        event.putExtra(AVATAR_HASH,avatarHash);
        LocalBroadcastManager.getInstance(SteamService.this).sendBroadcast(event);
      }
    }
  }
);
  msg.handle(FreeLicenseCallback.class,new ActionT<FreeLicenseCallback>(){
    @Override public void call(    final FreeLicenseCallback callback){
      final int gameId=callback.getGameId();
      final int[] grantedApps=callback.getGrantedApps();
      final int[] grantedPackages=callback.getGrantedPackages();
      if (grantedApps.length > 0 || grantedPackages.length > 0) {
        new Handler(Looper.getMainLooper()).post(new Runnable(){
          @Override public void run(){
            Toast.makeText(SteamService.this,getString(R.string.activated,String.valueOf(gameId)),Toast.LENGTH_LONG).show();
          }
        }
);
      }
 else {
        executor.execute(new Runnable(){
          @Override public void run(){
            final String msg;
            if (webHandler.addFreeLicense(gameId)) {
              msg=getString(R.string.activated,String.valueOf(gameId));
            }
 else {
              msg=getString(R.string.activation_failed);
            }
            new Handler(Looper.getMainLooper()).post(new Runnable(){
              @Override public void run(){
                Toast.makeText(SteamService.this,msg,Toast.LENGTH_LONG).show();
              }
            }
);
          }
        }
);
      }
    }
  }
);
  msg.handle(AccountInfoCallback.class,new ActionT<AccountInfoCallback>(){
    @Override public void call(    AccountInfoCallback callback){
      if (Prefs.getOffline()) {
        return;
      }
      int tries=0;
      String nickname;
      while (tries < 5) {
        nickname=steamFriends.getPersonaName();
        if (nickname != null && !nickname.equals("String_Node_Str")) {
          break;
        }
        try {
          Thread.sleep(1000);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
        tries++;
      }
      steamFriends.setPersonaState(EPersonaState.Online);
    }
  }
);
}