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 205166 - Go to Type uses *-sources.jar from different version of artifact than currently in CP
Summary: Go to Type uses *-sources.jar from different version of artifact than current...
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-15 20:25 UTC by bht
Modified: 2015-09-17 11:16 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Testcase in jar file (23.67 KB, application/octet-stream)
2011-11-15 20:26 UTC, bht
Details

Note You need to log in before you can comment on or make changes to this bug.
Description bht 2011-11-15 20:25:00 UTC
The issue started to occur when trying to debug a testcase with different versions of a class libary.

Product Version: NetBeans IDE Dev (Build 201111120600)

How to reproduce:

- Download Apache Wicket versions 1.5.1 and 1.5.2 and extract them.
- In the subdirectory src in each extracted directory, execute mvn -Dmaven.test.skip=true install
- Open with an editor the POM.xml (not the project) of the attached project and check the Wicket version to 1.5.1:
  <wicket.version>1.5.1</wicket.version>
- Close the file
- Check that the target dir in the attached project is empty
- Open NetBeans in a new empty userdir - do not import settings
- Menu|Tools|Options|Miscellaneous|Files|uncheck Enable auto-scanning of sources|OK
- Open the attached project
- Menu|Navigate|Go to Type|RequestCycle|OK
   Should find file in wicket-core-1.5.1.jar
- Set a breakpoint on line 208 requestHandlerExecutor.execute(handler);
- Project|Debug|Server GlassFish 3.1|Remember in current IDE session|OK
   The debugger breaks on this line as expected.
- Menu|Debug|Continue
- Finish the debug session
- In the Services window, undeploy the application and re-start the server (in debug mode)
- Remove the breakpoint
- Close RequestCycle.java
- open the project's pom.xml in the NetBeans editor and change the Wicket version to 1.5.2:
   <wicket.version>1.5.2</wicket.version>
- Save and close
- Project|Clean and build   
- Menu|Navigate|Go to Type|RequestCycle|OK
   Should find file in wicket-core-1.5.2.jar
- Set a breakpoint on line 208 requestHandlerExecutor.execute(handler);
- Project|Debug

Attaching to localhost:9009
Not able to submit breakpoint LineBreakpoint RequestCycle.java : 208, reason: No source root found for URL 'jar:file:/C:/Documents%20and%20Settings/treinebe/.m2/repository/org/apache/wicket/wicket-core/1.5.1/wicket-core-1.5.1-sources.jar!/org/apache/wicket/request/cycle/RequestCycle.java'. Verify the setup of project sources.
Invalid LineBreakpoint RequestCycle.java : 208
User program running

Cross check is to start the test fresh with 1.5.2 then switch to 1.5.1 to ensure that the error is not in the 1.5.2 distribution.

- Open with an editor the POM.xml (not the project) of the attached project and check the Wicket version to 1.5.2:
  <wicket.version>1.5.2</wicket.version>
- Close the file
- Check that the target dir in the attached project is empty
- Open NetBeans in a new empty userdir - do not import settings
- Menu|Tools|Options|Miscellaneous|Files|uncheck Enable auto-scanning of sources|OK
- Open the attached project
- Menu|Navigate|Go to Type|RequestCycle|OK
   Should find file in wicket-core-1.5.2.jar
- Set a breakpoint on line 252 requestHandlerExecutor.execute(handler); (note the different line number - was line 208 in 1.5.1)
- Project|Debug|Server GlassFish 3.1|Remember in current IDE session|OK
   The debugger breaks on this line as expected.
- Menu|Debug|Continue
- Finish the debug session
- In the Services window, undeploy the application and re-start the server (in debug mode)
- Remove the breakpoint
- Close RequestCycle.java
- open pom.xml and change the Wicket version from 1.5.2 to 1.5.1:
   <wicket.version>1.5.1</wicket.version>
- Save and close
- Project|Clean and build   
- Menu|Navigate|Go to Type|RequestCycle|OK
   Should find file in wicket-core-1.5.1.jar
- Set a breakpoint on line 252 requestHandlerExecutor.execute(handler);
- Project|Debug

Attaching to localhost:9009
User program running
Not able to submit breakpoint LineBreakpoint RequestCycle.java : 252, reason: No source root found for URL 'jar:file:/C:/Documents%20and%20Settings/treinebe/.m2/repository/org/apache/wicket/wicket-core/1.5.2/wicket-core-1.5.2-sources.jar!/org/apache/wicket/request/cycle/RequestCycle.java'. Verify the setup of project sources.
Invalid LineBreakpoint RequestCycle.java : 252

- Project|Clean
- Project|Build with Dependencies
- Project|Debug
Attaching to localhost:9009
Not able to submit breakpoint LineBreakpoint RequestCycle.java : 252, reason: No source root found for URL 'jar:file:/C:/Documents%20and%20Settings/treinebe/.m2/repository/org/apache/wicket/wicket-core/1.5.2/wicket-core-1.5.2-sources.jar!/org/apache/wicket/request/cycle/RequestCycle.java'. Verify the setup of project sources.
Invalid LineBreakpoint RequestCycle.java : 252
User program running
Comment 1 bht 2011-11-15 20:26:02 UTC
Created attachment 113240 [details]
Testcase in jar file
Comment 2 Martin Entlicher 2011-11-21 16:38:16 UTC
I have reproduced the problem exactly by following the described steps.
However, after:
open the project's pom.xml in the NetBeans editor and change the Wicket
version to 1.5.2:
   <wicket.version>1.5.2</wicket.version>
- Save and close
- Project|Clean and build   
- Menu|Navigate|Go to Type|RequestCycle|OK
   Should find file in wicket-core-1.5.2.jar

The Go to Type dialog says, that the RequestCycle is from .../wicket-core/1.5.2/wicket-core-1.5.2.jar, but the tooltip on the file's tab says that it comes from .../wicket-core/1.5.1/wicket-core-1.5.1-sources.jar

Therefore the error message that is printed when it's not possible to submit the breakpoint is correct. Debugger warns you correctly, since you have opened a wrong file.

Moving to maven to evaluate and to figure out why a bad source file was opened.
Comment 3 Jesse Glick 2011-11-21 18:40:14 UTC
(In reply to comment #0)
> - Download Apache Wicket versions 1.5.1 and 1.5.2 and extract them.
> - In the subdirectory src in each extracted directory, execute mvn
> -Dmaven.test.skip=true install

Why would you not simply use these versions of Wicket from Maven Central? Saves the long source package download and build steps, and seems to have the same result.

(In reply to comment #2)
> The Go to Type dialog says, that the RequestCycle is from
> .../wicket-core/1.5.2/wicket-core-1.5.2.jar, but the tooltip on the file's tab
> says that it comes from .../wicket-core/1.5.1/wicket-core-1.5.1-sources.jar

Reproduced. Fixed by simply closing and reopening the project. Seems Go to Type is using stale data somehow. I can confirm that RepositorySourceForBinaryQueryImpl is giving correct results, but presumably JavaTypeProvider is failing somewhere; without being able to follow what that class is doing, hard to tell whether the root problem is in Maven integration code or not.
Comment 4 sworisbreathing 2012-11-01 02:10:47 UTC
If I saw both wicket-1.5.1.jar and wicket-1.5.2.jar in Window->Debugging->Sources, could that somehow be related to this issue?
Comment 5 Jesse Glick 2012-11-02 18:57:51 UTC
Might be related to bug #216448.
Comment 6 Martin Balin 2015-09-17 11:16:07 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.