Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 550620

Summary: Fix style range override in TextConsoleViewer
Product: [Eclipse Project] Platform Reporter: Paul Pazderski <paul-eclipse>
Component: DebugAssignee: Paul Pazderski <paul-eclipse>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: sarika.sinha
Version: 4.11   
Target Milestone: 4.14 M1   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/148660
https://bugs.eclipse.org/bugs/show_bug.cgi?id=197958
https://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=1ddf37c93b738dd018118935b7b762dae28db788
Whiteboard:
Bug Depends on:    
Bug Blocks: 552030    
Attachments:
Description Flags
Test with problematic inputs none

Description Paul Pazderski CLA 2019-08-30 17:57:11 EDT
Created attachment 279729 [details]
Test with problematic inputs

The TextConsoleViewer.override method yields wrong results for some inputs. At this point I wanted to write that there is luckily at the moment almost no situation where such a problematic input occur. But Bugzilla's duplicate finder lead me to bug 197958 which is caused by this buggy method.

A sample input which can produce a visible styling error is
    System.err.print("Exception in thread main java.lang.UnsupportedOperationException: ##");
The first '#' is rendered red but the second is black. There must be no error output before or after (and no newline). If there is more than one line of error output this bug is fortuitously circumvented by the wrong style calculation in IOConsolePartitioner (see bug 550618).

Another error is that 'override' does not add the style if it has no overlapping with any existing style. That led to bug 111256 which was fixed by adding an empty dummy style before override.

Also this implementation can add a new style more than once sometimes or in one branch it may delete an element but does not adjust the loop counter therefore skipping the next element and I think the last branch is unreachable (at least I found no combination to reach it).

I attached a small test class with some inputs which are all failing at the moment. (the TextConsoleViewer.override method must be made static)
Comment 1 Eclipse Genie CLA 2019-08-30 18:02:06 EDT
New Gerrit change created: https://git.eclipse.org/r/148660
Comment 3 Sarika Sinha CLA 2019-10-09 05:20:31 EDT
Version: 2019-12 (4.14)
Build id: I20191008-1800