Bug 287462 - [formatter] new failures in last 2 nightly builds
Summary: [formatter] new failures in last 2 nightly builds
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-24 13:30 EDT by Olivier Thomann CLA
Modified: 2009-09-15 16:00 EDT (History)
2 users (show)

See Also:


Attachments
Proposed patch (2.42 KB, patch)
2009-08-24 14:30 EDT, Frederic Fusier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2009-08-24 13:30:26 EDT
Recent nightly builds show a failure in the formatter tests.
> org.eclipse.jdt.core.tests.model_linux.gtk.x86
> org.eclipse.jdt.core.tests.model_linux.gtk.x86_6.0
> org.eclipse.jdt.core.tests.model_macosx.cocoa.x86_5.0

The failure is located in:
org.eclipse.jdt.core.tests.formatter.FormatterRegressionTests.testBug201022
Comment 1 Frederic Fusier CLA 2009-08-24 14:08:19 EDT
This is a consequence of fix for bug 286912. The problem is in method Scribe.getCurrentIndentation(int), which behaves differently when line ends is only one character as in Linux. I copied it from getCurrentCommentOffset(int), but it seems that the binary search does not give correct results when the start position matches a line end...

I'll continue my investigation deeper tomorrow and currently disable the offending test...
Comment 2 Frederic Fusier CLA 2009-08-24 14:30:28 EDT
Created attachment 145466 [details]
Proposed patch

The usage of the binary search method in getCurrentCommentOffset(int) method was correct as the start position is never supposed matching and line end. In getCurrentIndentation(int) it's possible, hence the return value must be tested and replaced accordingly if it's negative...

Note that the test also needed to be changed as the indentation delta for each broken line is kept and was only 4 characters...
Comment 3 Frederic Fusier CLA 2009-08-25 03:46:59 EDT
Released for 3.6M2 in HEAD stream.
Comment 4 Satyam Kandula CLA 2009-09-15 09:04:27 EDT
Verified for 3.6M2 using I20090914-1800
Comment 5 Olivier Thomann CLA 2009-09-15 16:00:51 EDT
Verified.