Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering unqualified Stacktraces #115 #547

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

SougandhS
Copy link
Contributor

@SougandhS SougandhS commented Oct 22, 2024

using method name to filter unqualified stacktraces generated in java stacktrace console.

Fixes #115
Includes handling for #544

What it does

How to test

Author checklist

@SougandhS
Copy link
Contributor Author

Hi @iloveeclipse & @jukzi
I wrote the code changes again like you suggested. Also handled additional cases in #544. Could you pls check on this ?

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to write code that "fits on the screen".
Methods that have nesting level like here and if blocks that need to be scrolled down to see where it ends are "no go". The code is impossible to review / maintain.

See my proposals in code how the code should be improved.

@SougandhS
Copy link
Contributor Author

Please try to write code that "fits on the screen". Methods that have nesting level like here and if blocks that need to be scrolled down to see where it ends are "no go". The code is impossible to review / maintain.

See my proposals in code how the code should be improved.

Thanks for the proposals @iloveeclipse, now I have decoupled it into many like you suggested and it is more readable than previous.

@iloveeclipse
Copy link
Member

I'm away from PC till next week, code looks much better now, thanks.

@SougandhS
Copy link
Contributor Author

I'm away from PC till next week, code looks much better now, thanks.

Thank you @iloveeclipse

@jukzi
Copy link
Contributor

jukzi commented Oct 28, 2024

I have tested this pr with a hundret random stacktraces and did not run into any error. @iloveeclipse please finish review.

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from 8f84fea to 8e6f576 Compare October 28, 2024 08:30
@SougandhS
Copy link
Contributor Author

Hi @iloveeclipse, could u pls check this again ?

@SougandhS
Copy link
Contributor Author

Hi @iloveeclipse

Hi @iloveeclipse, could u pls check this again ?

@iloveeclipse
Copy link
Member

Hi @iloveeclipse

Hi @iloveeclipse, could u pls check this again ?

I will. Please squash two commits into one & force push this PR.

@SougandhS
Copy link
Contributor Author

Hi @iloveeclipse

Hi @iloveeclipse, could u pls check this again ?

I will. Please squash two commits into one & force push this PR.

Thanks @iloveeclipse, will do it now

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from 8e6f576 to 60d19e6 Compare October 29, 2024 06:58
@SougandhS
Copy link
Contributor Author

Hi @iloveeclipse , I have squashed the commits to one now.

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from 60d19e6 to 3a15766 Compare October 29, 2024 09:00
Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please check the coverage of the new code, it suggests that the code either not needed or there are no tests added:

image

  1. For this line at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109) I get an error in the log and a selection dialog for two types, one of them is bin.org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher:
Java Model Exception: Error in Java Model (code 969): bin.org.eclipse.core.runtime.internal.adaptor [in /data/git/equinox/bundles/org.eclipse.osgi/bin] does not exist
	at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:556)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:234)
	at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:508)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:228)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:569)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:292)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:278)
	at org.eclipse.jdt.internal.core.BinaryType.getClassFileInfo(BinaryType.java:232)
	at org.eclipse.jdt.internal.core.BinaryType.getChildren(BinaryType.java:195)
	at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType(JavaElement.java:247)
	at org.eclipse.jdt.internal.core.BinaryType.getMethods(BinaryType.java:494)
	at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink.extractFromResults(JavaStackTraceHyperlink.java:316)
	at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink.filterClasses(JavaStackTraceHyperlink.java:245)
	at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink$3.runInUIThread(JavaStackTraceHyperlink.java:208)
	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:148)

On master, I don't get an error (but still see unexpected bin.org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher type proposed in a list with the "right" one.

@SougandhS
Copy link
Contributor Author

  1. Please check the coverage of the new code, it suggests that the code either not needed or there are no tests added:

image

  1. For this line at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109) I get an error in the log and a selection dialog for two types, one of them is bin.org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher:
Java Model Exception: Error in Java Model (code 969): bin.org.eclipse.core.runtime.internal.adaptor [in /data/git/equinox/bundles/org.eclipse.osgi/bin] does not exist
	at org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:556)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:234)
	at org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:508)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:228)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:569)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:292)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:278)
	at org.eclipse.jdt.internal.core.BinaryType.getClassFileInfo(BinaryType.java:232)
	at org.eclipse.jdt.internal.core.BinaryType.getChildren(BinaryType.java:195)
	at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType(JavaElement.java:247)
	at org.eclipse.jdt.internal.core.BinaryType.getMethods(BinaryType.java:494)
	at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink.extractFromResults(JavaStackTraceHyperlink.java:316)
	at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink.filterClasses(JavaStackTraceHyperlink.java:245)
	at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink$3.runInUIThread(JavaStackTraceHyperlink.java:208)
	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:148)

On master, I don't get an error (but still see unexpected bin.org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher type proposed in a list with the "right" one.

  1. Done - Added more tests to cover those areas.

  2. Provided additional check and removed "bin" starting results.

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from 3a15766 to f595ab8 Compare October 31, 2024 16:29
@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from b8fc106 to 0f2ebc7 Compare November 1, 2024 12:48
@SougandhS
Copy link
Contributor Author

Hi @iloveeclipse
I have made the code changes as per review

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no time left today for the review due other duties, and will be back at the keyboard next Monday again, sorry.

I saw the coverage is increased, this is good. However, I also see the hack for handling broken "bin" types and that should be removed / fixed properly in a different PR.

Please note, you have again two commits on the branch - it should be one.

@SougandhS
Copy link
Contributor Author

I have no time left today for the review due other duties, and will be back at the keyboard next Monday again, sorry.

I saw the coverage is increased, this is good. However, I also see the hack for handling broken "bin" types and that should be removed / fixed properly in a different PR.

Please note, you have again two commits on the branch - it should be one.

No problem.. will clean up everything 👍

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from be2ed34 to e1efb4f Compare November 6, 2024 04:16
@SougandhS
Copy link
Contributor Author

I have no time left today for the review due other duties, and will be back at the keyboard next Monday again, sorry.
I saw the coverage is increased, this is good. However, I also see the hack for handling broken "bin" types and that should be removed / fixed properly in a different PR.
Please note, you have again two commits on the branch - it should be one.

No problem.. will clean up everything 👍

I have done the changes and squashed the commits to one now.

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from e1efb4f to 7e367e3 Compare November 19, 2024 03:44
@SougandhS
Copy link
Contributor Author

I saw the coverage is increased, this is good. However, I also see the hack for handling broken "bin" types and that should be removed / fixed properly in a different PR.

Hi @iloveeclipse, for the additional bin file pickup in results I wasn't able to reproduce the same in my local, I'm always getting results without bin. Can you check that again ?

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from 7e367e3 to 139e5d6 Compare November 27, 2024 02:01
@eclipse-jdt-bot
Copy link
Contributor

eclipse-jdt-bot commented Nov 27, 2024

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
org.eclipse.jdt.debug.ui/pom.xml

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From fce97a299bbf7d079e7b433ef308faa255b4c5c3 Mon Sep 17 00:00:00 2001
From: Eclipse JDT Bot <jdt-bot@eclipse.org>
Date: Thu, 28 Nov 2024 04:18:41 +0000
Subject: [PATCH] Version bump(s) for 4.35 stream


diff --git a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
index e651afa8a..06269ace2 100644
--- a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.debug.ui; singleton:=true
-Bundle-Version: 3.13.600.qualifier
+Bundle-Version: 3.13.700.qualifier
 Bundle-Activator: org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.debug.ui/pom.xml b/org.eclipse.jdt.debug.ui/pom.xml
index dceebf96d..597b96d81 100644
--- a/org.eclipse.jdt.debug.ui/pom.xml
+++ b/org.eclipse.jdt.debug.ui/pom.xml
@@ -18,7 +18,7 @@
   </parent>
   <groupId>org.eclipse.jdt</groupId>
   <artifactId>org.eclipse.jdt.debug.ui</artifactId>
-  <version>3.13.600-SNAPSHOT</version>
+  <version>3.13.700-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
   <properties>
   	<defaultSigning-excludeInnerJars>true</defaultSigning-excludeInnerJars>
-- 
2.47.0

Further information are available in Common Build Issues - Missing version increments.

Copy link
Member

@iloveeclipse iloveeclipse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest patch has 78% test coverage and all but one new methods seem to be tested, this is good. Also I've tested few stack traces without errors - for the first time :-) Also good.
So if @jukzi is OK with this patch, let's merge.

@iloveeclipse iloveeclipse dismissed their stale review December 3, 2024 16:02

Patch looks better now

@jukzi
Copy link
Contributor

jukzi commented Dec 3, 2024

since there have been some changes since my last test, i would like to test this tomorrow once more.

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from fd75f82 to 600dc85 Compare December 4, 2024 05:41
@SougandhS
Copy link
Contributor Author

SougandhS commented Dec 4, 2024

The latest patch has 78% test coverage and all but one new methods seem to be tested, this is good. Also I've tested few stack traces without errors - for the first time :-) Also good. So if @jukzi is OK with this patch, let's merge.

image got 81% coverage now

@jukzi
Copy link
Contributor

jukzi commented Dec 4, 2024

Build repeatedly fails with Could not find artifact org.eclipse.jdt:ecj:jar:3.40.100-SNAPSHOT in eclipse-snapshots , need help @akurtakov @merks

00:01:35.806  Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin org.eclipse.tycho:tycho-compiler-plugin:4.0.10 or one of its dependencies could not be resolved:
00:01:35.806  	Could not find artifact org.eclipse.jdt:ecj:jar:3.40.100-SNAPSHOT in eclipse-snapshots (https://repo.eclipse.org/content/repositories/eclipse-snapshots/)

@akurtakov
Copy link
Contributor

It's infrastructure issue - I've opened https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/issues/5387 for another case but feel free to open a new one or comment to this one.

Copy link
Contributor

@jukzi jukzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested some stacktraces. Most work. But it fails on some (i used the stacktraces that failed the build of this PR :-) ):

00:01:35.805      at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
00:01:35.805      at java.lang.reflect.Method.invoke (Method.java:580)
00:01:35.805      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
00:01:35.805      at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
00:01:35.805      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
00:01:35.805      at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)

!ENTRY org.eclipse.ui.workbench 4 0 2024-12-04 09:09:04.873
!MESSAGE An internal error has occurred.
!STACK 0
java.lang.StringIndexOutOfBoundsException: Range [0, -1) out of bounds for length 9
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:55)
	at java.base/jdk.internal.util.Preconditions$1.apply(Preconditions.java:52)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
	at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckFromToIndex(Preconditions.java:112)
	at java.base/jdk.internal.util.Preconditions.checkFromToIndex(Preconditions.java:349)
	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4865)
	at java.base/java.lang.String.substring(String.java:2834)
	at org.eclipse.jdt.internal.debug.ui.console.JavaStackTraceHyperlink$3.runInUIThread(JavaStackTraceHyperlink.java:213)

instead of using low level methods like substring, indexof you would be better of using pattern matching as in org.eclipse.jdt.internal.debug.ui.actions.OpenFromClipboardAction

You may also want to improve error handling to add the text to the exception that could not be parsed.
image

@SougandhS
Copy link
Contributor Author

level

will check this 👍

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch 2 times, most recently from 4a53e8b to 17c4525 Compare December 4, 2024 17:11
@SougandhS SougandhS requested a review from jukzi December 4, 2024 17:14
@SougandhS
Copy link
Contributor Author

SougandhS commented Dec 4, 2024

Hi @jukzi , I have replaced all the indexof & substring in critical sections and handled new stack traces (those new traces wont give proper generatedLink)

You may also want to improve error handling to add the text to the exception that could not be parsed.

for this I should make changes in platform ui ?

jukzi
jukzi previously requested changes Dec 5, 2024
Copy link
Contributor

@jukzi jukzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the change again. I could not find any error anymore. potential multithreading issues have to be fixed, then its good to go from my side.

@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch 2 times, most recently from ecf4c77 to f84f53f Compare December 6, 2024 04:55
@SougandhS SougandhS requested a review from jukzi December 6, 2024 04:56
@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from f84f53f to a4afc35 Compare December 6, 2024 07:15
Using method name to filter unqualified stacktraces generated in java
stacktrace console to provide more accurate search results.

Fixes eclipse-jdt#115
@SougandhS SougandhS force-pushed the Java_Stack_Trace_Enhancement branch from a4afc35 to 249de72 Compare December 6, 2024 07:16
@SougandhS SougandhS requested a review from jukzi December 6, 2024 07:16
Copy link
Contributor

@jukzi jukzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, lets wait for the build

@SougandhS
Copy link
Contributor Author

LGTM, lets wait for the build

Build completed without issues.

@jukzi jukzi merged commit ddf0a0a into eclipse-jdt:master Dec 10, 2024
11 checks passed
@jukzi
Copy link
Contributor

jukzi commented Dec 10, 2024

Thanks for the reminder and contributions.

@SougandhS
Copy link
Contributor Author

Thank you @iloveeclipse & @jukzi for the detailed review.

@jukzi jukzi added the enhancement New feature or request label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

improvement: use method name to find unqualified Stacktraces
5 participants