Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8160440

if condition goes wrong way

XMLWordPrintable

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      boolean b = isCancelled(); //b == true
      if (b)
          return false; //This has not been executed
      publishProgress(values); //Also not executed
      return true; //Debugger comes here
      Why? This is Android example, isCancelled() is boolean

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Install Android Studio
      2.Create a class extends AsyncTask<Void, Void, Void>
      3.In implemented 'doInBackground' function paste theese lines of code

      p.s. isCanceled checks AsyncTask.cancel(boolean) function

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      false return I expected
      ACTUAL -
      true returns

      REPRODUCIBILITY :
      This bug can be reproduced always.

      SUPPORT :
      YES

            aroy Abhijit Roy (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: