neilcsmith-net commented on code in PR #8568:
URL: https://github.com/apache/netbeans/pull/8568#discussion_r3006237985


##########
java/maven.junit.ui/src/org/netbeans/modules/maven/junit/ui/MavenJUnitNodeOpener.java:
##########
@@ -186,18 +188,18 @@ public void openCallstackFrame(Node node, @NonNull String 
frameInfo) {
         FileObject file = UIJavaUtils.getFile(frameInfo, lineNumStorage, 
locator);
         //lineNumStorage -1 means no regexp for stacktrace was matched.
         if (testfo != null && file == null && 
methodNode.getTestcase().getTrouble() != null && lineNumStorage[0] == -1) {
-                //213935 we could not recognize the stack trace line and map 
it to known file
+            //213935 we could not recognize the stack trace line and map it to 
known file
             //if it's a failure text, grab the testcase's own line from the 
stack.
             String[] st = 
methodNode.getTestcase().getTrouble().getStackTrace();
-            if ((st != null) && (st.length > 0)) {
-                int index = st.length - 1;
-                    //213935 we need to find the testcase linenumber to jump 
to.
-                // and ignore the infrastructure stack lines in the process
-                while (!testfo.equals(file) && index != -1) {
+            for (int index = 0; !testfo.equals(file) && index < st.length; 
index++) {
+                String trimmed = JavaRegexpUtils.specialTrim(st[index]);
+                if 
(trimmed.startsWith(JavaRegexpUtils.CALLSTACK_LINE_PREFIX_CATCH)
+                        || 
trimmed.startsWith(JavaRegexpUtils.CALLSTACK_LINE_PREFIX)) {
                     file = UIJavaUtils.getFile(st[index], lineNumStorage, 
locator);
-                    index -= 1;
+                    break;
                 }
             }
+
         }

Review Comment:
   Is line 180-182 the cause of the actual issue seen?  It will match a sibling 
of the test file before the test file itself?
   
   Anyway, few old links that might be of use to consider why the code is how 
it is -
   
   - https://bz.apache.org/netbeans/show_bug.cgi?id=213935
   - https://bz.apache.org/netbeans/show_bug.cgi?id=236056
   - 
https://github.com/codelerity/netbeans-releases/commit/076b1599e8adf85ac3e0ba3880d978b94c10153d
   - 
https://github.com/codelerity/netbeans-releases/commit/74a230ded2fbb9cc608f421c0739cba66d45f05d
   - 
https://github.com/codelerity/netbeans-releases/commit/f2a3522854977a6364abfed47799ddf3c761a2c1



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to