This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 226196 - Debugger stops in the incorrect line code after "fix"
Summary: Debugger stops in the incorrect line code after "fix"
Status: NEW
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-15 17:52 UTC by ecerichter
Modified: 2013-02-15 18:03 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot on where NetBeans stopped (31.33 KB, image/png)
2013-02-15 17:59 UTC, ecerichter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ecerichter 2013-02-15 17:52:45 UTC
Product Version = NetBeans IDE 7.3 RC2 (Build 201302050851)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_13
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01

I've the following method (method start at line 514):

@Override
  public ReturnData processaFatura(Fatura fatura, boolean processaTodas) {
    ReturnData ret = new ReturnData();
    long t1 = System.currentTimeMillis();

    try {
      PrefaturaBroker.processaFatura(getUsuario(), fatura, processaTodas);
      ret.status = ReturnData.STATUS.OK;
      ret.message = "Prefatura gerada com sucesso!";
    } catch(Exception e) {
      Util.debug(e);
      ret.fatura = null;
      ret.status = ReturnData.STATUS.ERRO;
      ret.message = e.getMessage();
    }

    long t2 = System.currentTimeMillis();
    Util.debug("Tempo para processamento da fatura: " + (t2 - t1));

    return ret;
  }

1) Changed to (observer the line break after "ReturnData ret...":

@Override
  public ReturnData processaFatura(Fatura fatura, boolean processaTodas) {
    ReturnData ret = new ReturnData();

    long t1 = System.currentTimeMillis();

    try {
      PrefaturaBroker.processaFatura(getUsuario(), fatura, processaTodas);
      ret.status = ReturnData.STATUS.OK;
      ret.message = "Prefatura gerada com sucesso!";
    } catch(Exception e) {
      Util.debug(e);
      ret.fatura = null;
      ret.status = ReturnData.STATUS.ERRO;
      ret.message = e.getMessage();
    }

    long t2 = System.currentTimeMillis();
    Util.debug("Tempo para processamento da fatura: " + (t2 - t1));

    return ret;
  }

2) Then I click "Fix".
3) Mark breakpoints at "ReturnData ret=..." line and at "long t1 = System..." lines

Check log and see the breakpoint submission status:
"Attaching to tomcat_shared_memory_id6
LineBreakpoint NotaFiscal.java : 1157 successfully submitted.
LineBreakpoint PrefaturaServiceImpl.java : 515 successfully submitted.
User program running
LineBreakpoint PrefaturaServiceImpl.java : 517 successfully submitted.
LineBreakpoint PrefaturaBroker.java : 1018 successfully submitted."

so, the breakpoints are 

4) Execute the operation that is expected to stop at line "ReturnData ret=...".

and the debugger log becomes:

"Attaching to tomcat_shared_memory_id6
LineBreakpoint NotaFiscal.java : 1157 successfully submitted.
LineBreakpoint PrefaturaServiceImpl.java : 515 successfully submitted.
User program running
LineBreakpoint PrefaturaServiceImpl.java : 517 successfully submitted.
LineBreakpoint PrefaturaBroker.java : 1018 successfully submitted.
Breakpoint hit at line 517 in class br.com.simfreteV1.ui.server.PrefaturaServiceImpl by thread http-bio-8088-exec-55.
Thread http-bio-8088-exec-55 stopped at PrefaturaServiceImpl.java:517."

NetBeans stops at line 517 "long t1 = ..." because the second line break, otherwise it will execute without stopping.
Why is it ignoring the 515 breakpoint (before the changed line)?

Edson
Comment 1 ecerichter 2013-02-15 17:59:20 UTC
Created attachment 131434 [details]
Screenshot on where NetBeans stopped
Comment 2 ecerichter 2013-02-15 18:03:50 UTC
Just discovered one workaround:

If I unmark all breakpoints and mark them all again, the erratic behavior does not occur.

Edson