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.
Here are 2 test projects. Both of them contain classes with the same absolute name (e.g. including package names). There are fake exceptions in code. While running first attached app there's an exception with link to Project1.java:line 19 and while testing it the same code is called and the same exception is reported. But by clicking on trace in output it jupms to project2. If it doesn't reproduce try vise verca.
Created attachment 145210 [details] test projects
-J-Dlogger.max.line.length=2000
Jarda, line with classpath is skipped due to: JavaAntLogger.messageLogged if (line.length() >= LOGGER_MAX_LINE_LENGTH) { // too long message, probably coming from user, so do not check for stacktrace return null; } LOGGER_MAX_LINE_LENGTH is 1000 by default while for empty project during test run it is 1324 symbols shouldn't we rise default to i.e.
caused by http://hg.netbeans.org/cnd-main/rev/b4fa9a93fca1 1000 symbols is too short for line where class path is printed
I am on jdk7 at home but I will have a look also on Monday at the office where I have jdk8 installed. with jdk7 I cannot reproduce from Test Results Window. Tried the following: tested project1 tried clicking the failing method node in TRW or any of the stack trace nodes and I am correctly navigated to the respective files of Project1 tested project2 tried clicking the failing method node in TRW or any of the stack trace nodes and I am correctly navigated to the respective files of Project2 There were issues though, like the one you describe in comment 1, when trying to navigate to the files from the output window. For now setting some higher number 2000 or 3000 for the LOGGER_MAX_LINE_LENGTH I believe solves the issue. I will investigate a little bit more on Monday and if there are no more complications I can change the default value.
Created attachment 145303 [details] patch It seems to me that this is not an issue with the size of the LOGGER_MAX_LINE_LENGTH. If I change project1 package name to say project2 in Project2 then I can 100% correctly navigate to the desired file from output window. The problem is in the way GlobalPathRegistry tries to find a specific resource. "... In case more than one source root contains the resource, one is chosen arbitrarily. ..." so because project1.*.java is present in both projects one is randomly returned and so some times you can navigate to the correct file and some times not. I believe the patch solved the issue. Could you please verify before I push it? Thank you
Since this is not my area Martin, Milos any comments on that?
Fanis, when I debug the test case I clear see that current class path stored in getCurrentSourceRootsForClasspath(data) is not found, so the following is not executed. When I increase LOGGER_MAX_LINE_LENGTH then Matcher m2 = CLASSPATH_ARGS.matcher(line); if (m2.find()) { String cp = m2.group(1); data.setClasspath(cp); } start to work and getCurrentSourceRootsForClasspath(data) has needed info
May be your fix for GlobalPathRegistry is needed as well, but to have fast coloring I think data.setClasspath(cp); should be executed
(In reply to Vladimir Voskresensky from comment #9) > May be your fix for GlobalPathRegistry is needed as well, well with the provided projects it is obvious that the specific testcase is not covered and probably my or some other patch needs to be pushed > but to have fast > coloring I think data.setClasspath(cp); should be executed so there is a line of message that is logged and is more than 1000 characters long and you need to color it or something IIUC? Could you provide such message that is logged so that I understand what we are dealing with? If I am not mistaken the stacktraces are logged line by line. The problem I was trying to solve and I introduced this max limit was that the matcher throws exception if it tries to match against a huge string, thus 1000 characters set as max. I took as granted that such long string would probably be something the user is printing and so no need to hyperlink or color it. If no-one has any objections I could increase this to 2000 or 3000 characters.
(In reply to Theofanis Oikonomou from comment #10) > (In reply to Vladimir Voskresensky from comment #9) > > May be your fix for GlobalPathRegistry is needed as well, > > well with the provided projects it is obvious that the specific testcase is > not covered and probably my or some other patch needs to be pushed > > > but to have fast > > coloring I think data.setClasspath(cp); should be executed > > so there is a line of message that is logged and is more than 1000 > characters long and you need to color it or something IIUC? Could you > provide such message that is logged so that I understand what we are dealing > with? If I am not mistaken the stacktraces are logged line by line. When I debug I see the following: there is a log event of verbose level with content "-classpath ....." and this line is 1324 symbols long. It is not user's line, it is ant verbose message. This is the line analyzed by code: Matcher m2 = CLASSPATH_ARGS.matcher(line); if (m2.find()) { String cp = m2.group(1); data.setClasspath(cp); } and it is not analyzed by default due to if (line.length() >= LOGGER_MAX_LINE_LENGTH) { // too long message return null; } If it would be analyzed => data.setClasspath(cp); is called and fast classpathc check is initialized => later on when stack trace lines are analyzed it is tried to be be colored as hyperlinkable with the code: if (parse != null) { // Check to see if the class is listed in our per-task sourcepath. // XXX could also look for -Xbootclasspath etc., but probably less important for (FileObject root : getCurrentSourceRootsForClasspath(data)) { if getCurrentSourceRootsForClasspath(data) is not initialized before by data.setClasspath(cp); => this fast path is not executed and slow GlobalPathRegistry path is used as fallback.
Changeset: dfc79aa09a87 Author: Theofanis Oikonomou <theofanis@netbeans.org> Date: 2014-02-18 12:10 Message:
updated default LOGGER_MAX_LINE_LENGTH value to 3000 as requested and documented the system property in arch description of both ant and java.project modules.
Integrated into 'main-silver', will be available in build *201402190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/dfc79aa09a87 User: Theofanis Oikonomou <theofanis@netbeans.org> Log: Task #241884 - [regression] Incorrect navigation for exception from tests