-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
CHE-15 - Java stacktrace support (From Platform to Che Workspace) #5396
Conversation
Can one of the admins verify this patch? |
@@ -39,23 +41,30 @@ | |||
/** Follow output when printing text */ | |||
private boolean followOutput = true; | |||
|
|||
private OutputCustomizer customizer = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hello, is that the indent is expected ?
view.setDelegate(this); | ||
|
||
view.hideCommand(); | ||
view.hidePreview(); | ||
view.setReRunButtonVisible(false); | ||
view.setStopButtonVisible(false); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line shouldn't be introduced
} | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line(spaces) shouldn't be introduced
@@ -89,7 +98,7 @@ public void printText(String text) { | |||
public void printText(String text, String color) { | |||
view.print(text, text.endsWith("\r"), color); | |||
|
|||
for (ActionDelegate actionDelegate : actionDelegates) { | |||
for (ActionDelegate actionDelegate : actionDelegates) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indent is with spaces, not with tabs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you've to check in the whole file as I see mainly only tabs while spaces are expected.
private static RegExp LINE_AT_EXCEPTION = compile("(\\s+at address:.+)"); | ||
|
||
private AppContext appContext; | ||
private EditorAgent editorAgent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the indent looks odd
import com.google.gwt.user.client.Timer; | ||
import com.google.inject.Inject; | ||
|
||
public class DefaultOutputCustomizer implements OutputCustomizer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is missing javadoc on the class. What it does, etc
public class DefaultOutputCustomizer implements OutputCustomizer { | ||
|
||
private static RegExp LINE_AT = compile("(\\s+at .+)"); | ||
private static RegExp LINE_AT_EXCEPTION = compile("(\\s+at address:.+)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is missing the final keyword for the constants.
*/ | ||
@Override | ||
public String customize(String text) { | ||
String customText = text; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the formatting looks like it is not the expected one
String customText = text; | ||
|
||
MatchResult matcher = LINE_AT.exec(text); | ||
if(matcher != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces around parenthesis
ci-build |
as this issue is not a fix, it should include changelog and the release notes section. |
@benoitf I've added a couple of words to Change log. However, I don't know what is to be placed for Release Notes (especially once it not released yet) |
@vrubezhny Changelog should be a one-line entry, so maybe move your "changelog" text as "Release notes" text and it should be ok |
Build # 2833 - FAILED Please check console output at https://ci.codenvycorp.com/job/che-pullrequests-build/2833/ to view the results. |
@vrubezhny also there was a compilation issue https://ci.codenvycorp.com/job/che-pullrequests-build/2833/ |
Hi @vrubezhny ! @benoitf is right, this PR introduces a new feature so we need the release note section and the documentation prior to the merge. I can help on that. Would you mind recording an animated gif to demo the new capability and attach it to the description of the PR? |
@benoitf The compilation is known: my two classes (intrf+impl) have "RedHat, Inc." in their headers instead of "Codenvy, S.A.". I don't feel like adding the whole che-core-ide-app as an exclusion to license-maven-plugin is a good approach. Is there a better solution? (Or I just have to use original CodeEnvy's header?) |
@slemeur I've copied text of ChangeLog to Release Notes. Please let me know if it's not enough. And I'll try to record an animated gif... (not sure if I can do it on Fedora, though) |
07f4354
to
7741e02
Compare
@benoitf I believe I've fixed formatting and other issues you pointed to, as well as the 'missing headers' issue with build. Thanks for the review. |
ci-build |
@vrubezhny as there is the use of regexp and parsing, IMHO a unit test should be added to cover the analysis of the stack trace. |
Build success. https://ci.codenvycorp.com/job/che-pullrequests-build/2834/ |
Adds the possibility to click on a stacktrace line in order to open a specified class in editor. Also fixes CHE-293 (eclipse-che#5001) - String Written to Dev-Machine stdout not Escaped Properly Issue: https://issues.jboss.org/browse/CHE-15 Issue: https://issues.jboss.org/browse/CHE-293 see: eclipse-che#5001 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
@vrubezhny Hello Victor. I'm not seing unit test as said yesterday. Also, could you add changes as adding a new commit (like using --fixup option) because, it's impossible to track what you changed between each review as we see only one commit even if you've done changes. Squashing/Rebasing can be done later when merging it. thanks. |
@benoitf Yep, I haven't made JUnit test yet - I'll work on it on Monday. Thanks for pointing me to '--fixup' option, I'll follow this policy. |
Hi @vrubezhny. Thanks for adding the animated gif, they are perfect. Looking at the code, I see that the regexp will properly cover java stacktraces. AFAIK it should also work for NodeJS but I'm bit worry that this might also create wrong interpretation for other type of stacktraces and bother the user. So to start the discussion, should we:
|
Hi @slemeur.
We can't do that, first of all because of the performance reasons: it takes quite a lot of time (and I suppose a several asynchronous IO requests) to perform such a check. If we make it synchronously the console output would tend to freeze. Otherwise the text would not be printed in FIFO manner. As far as I know, desktop eclipse doesn't check for a file existence when a stacktrace is being printed out to a console, it performs searching when a user clicks on a colorized line.
Not sure I understand right... Have an example of URLs appearance?
Do you mean like "to disable" the console text customization (turning it to a link) and as such, not to provide a user with the possibility to search for a class by a stacktrace line? Not sure. I didn't see such a preference before.
If you're going to process the other kinds of stacktraces (like the javascript ones) then you should have the other kind of detection and post-processing (like parsing the line for packages/classes/file name/line number and/or adding, probably, javascript-to-java mappings to your search algorithm). This is not something that easy to realize as something that can be configured by preference and, imho, we should rather provide different customizers for users and let them a possibility to enable/disable them. Or hardly set up different customizers depending on the kind of console it should work on.
As far as I understand, my change configures the terminal to use this customizer. So, if a java stacktrace would appear in terminal it will be customized as well. If it's not required I can try to disable/remove this behaviour from terminal. |
@benoitf I'm going to add a commit with JUnit test to this PR. Should I use that |
@vrubezhny it is up to you, in all cases it will add a new commit (fixup is generating a commit as well) |
Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
customText += text.substring(openBracket + "(".length(), closingBracket); | ||
customText += "</a>"; | ||
customText += text.substring(closingBracket); | ||
text = customText; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think that a String.format would be easier to read than concatenating tons of stuff ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so bad idea (mine) as GWT is not supporting formatting 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String.format/MessageFormat.format/Formatter.format are not available for GWT application and it doesn't look like a GWT replacement exists.
public List<File> apply(Resource[] children) throws FunctionException { | ||
final List<File> result = newArrayList(); | ||
|
||
for (Resource child : children) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be simpler to read with streams / filter/ Collectors.toList() ?
public void testNonStackTraceLines() throws Exception { | ||
testStackTraceLine(false, "[STDOUT] Listening for transport dt_socket at address: 4403", null); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an empty blank line is required at the end of the file
Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
…Workspace) Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
…Workspace) Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
@benoitf I've added fixups for:
|
…lipse-che#5396) * CHE-15 - Java stacktrace support (From Platform to Che Workspace) Adds the possibility to click on a stacktrace line in order to open a specified class in editor. Also fixes CHE-293 (eclipse-che#5001) - String Written to Dev-Machine stdout not Escaped Properly Issue: https://issues.jboss.org/browse/CHE-15 Issue: https://issues.jboss.org/browse/CHE-293 see: eclipse-che#5001 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Adds the possibility to click on a stacktrace line in order to open
a specified class in editor.
Example 1:
Example 2:
Also fixes CHE-293 (#5001) - String Written to Dev-Machine stdout not Escaped Properly
Issue: https://issues.jboss.org/browse/CHE-15
Issue: https://issues.jboss.org/browse/CHE-293
see: #5001
Signed-off-by: Victor Rubezhny vrubezhny@redhat.com
What does this PR do?
Adds the possibility to click on a stacktrace line in order to open
a specified class in editor.
Also fixes CHE-293 (#5001) - String Written to Dev-Machine stdout not Escaped Properly
What issues does this PR fix or reference?
Issue: https://issues.jboss.org/browse/CHE-15
Issue: https://issues.jboss.org/browse/CHE-293
(Issue: #5001)
Changelog
The fix adds the possibility to click on a stacktrace line withing a console in order to open an according java class in editor and reveal it to the line according to the info that in provided in stacktrace line.
Release Notes
This version introduces a smart selection for the console outputs. When having exceptions or errors in your stacktrace, you can now directly jump into the file by clicking on it from the outputs. The editor will open with the file and point to the line corresponding to the one provided in the stacktrace. This allows to quickly navigate to the code which is raising an issue.
[Animated Gif]
The smart selection capability is available for Java and NodeJS stacktrace at this moment.
Docs PR
Will need to be cover by: https://github.com/eclipse/che-docs/issues/249