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

Summary: Debugger stops in the incorrect line code after "fix"
Product: debugger Reporter: ecerichter
Component: JavaAssignee: Martin Entlicher <mentlicher>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: Screenshot on where NetBeans stopped

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