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

Debugger always stepping through if and else statement blocks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0u1
    • core-svc
    • None
    • x86
    • windows_xp

      From a NetBeans user (test-case is also reproducible with JDB):

      If you step through the following code, the debugger will step through both if
      and else statement blocks.

      If aString was defined outside of the while loop, the debugger behaves normally.

      regards,

      Norman.


      ==========================
      public class aBUG {
          
          public static void main(String a[]) {
              boolean aContinue = true;
              int aCount = 1;
              //String aString[] = {"1", "2", "3"};
              String aProcess[] = {"", "", ""};
              String aMessage[] = {"1", "A message"};
              while (aContinue) {
                  System.out.println(aCount);
                  try {
                      if (aMessage[1].length() > 0) {
                          String aString[] = {"1", "2", "3"};
                          if (! aProcess[2].equalsIgnoreCase("123")){
                              aCount++;
                          } else {
                              aCount++;
                          }
                      } else {
                          aContinue = false;
                      }
                  } catch (NullPointerException e) {
                      aContinue = false;
                  }
              }
          }

            Unassigned Unassigned
            mentlich Martin Entlicher
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: