Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333056 - CharsetManager#getCharsetFor can't return null, if 'recurse' is true
Summary: CharsetManager#getCharsetFor can't return null, if 'recurse' is true
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Szymon Brandys CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 333416
  Show dependency tree
 
Reported: 2010-12-22 00:28 EST by Deepak Azad CLA
Modified: 2011-01-25 11:38 EST (History)
3 users (show)

See Also:


Attachments
The simples patch (2.01 KB, patch)
2010-12-22 17:20 EST, Szymon Brandys CLA
no flags Details | Diff
Fix v02 (5.22 KB, patch)
2010-12-28 09:19 EST, Szymon Brandys CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2010-12-22 00:28:29 EST
http://download.eclipse.org/eclipse/downloads/drops/I20101221-1019/testResults.php

The same tests have been failing since N20101216-2000. 

In the console log the last few messages are
-----------------------------------------------------------------------------
org.eclipse.jdt.ui.tests.refactoring.RenameTypeTests::testFail47 disabled (obscuring)

org.eclipse.jdt.ui.tests.refactoring.RenameTypeTests::testFail86 disabled (native method with A as parameter (same CU))

org.eclipse.jdt.ui.tests.refactoring.RenameTypeTests::testFail87 disabled (native method with A as parameter (same CU))
running testLocalVarName()

org.eclipse.jdt.ui.tests.refactoring.ChangeTypeRefactoringTests::test4TypeParameters disabled (core bug)
----------------------------------------------------------------------------

However when I run the tests locally and they pass, and there are more messages on the console
---------------------------------------------------------------------------
org.eclipse.jdt.ui.tests.refactoring.RenameTypeTests::testFail46 disabled (obscuring)

org.eclipse.jdt.ui.tests.refactoring.RenameTypeTests::testFail47 disabled (obscuring)

org.eclipse.jdt.ui.tests.refactoring.RenameTypeTests::testFail86 disabled (native method with A as parameter (same CU))

org.eclipse.jdt.ui.tests.refactoring.RenameTypeTests::testFail87 disabled (native method with A as parameter (same CU))

org.eclipse.jdt.ui.tests.refactoring.RenameTypeTests::test50 disabled (https://bugs.eclipse.org/bugs/show_bug.cgi?id=54948)
running testLocalVarName()

org.eclipse.jdt.ui.tests.refactoring.ChangeTypeRefactoringTests::test4TypeParameters disabled (core bug)

org.eclipse.jdt.ui.tests.refactoring.RenamePackageTests::testHierarchical02 disabled (package can't be renamed to a package that already exists.)

org.eclipse.jdt.ui.tests.refactoring.RenamePackageTests::testFail1 disabled (needs revisiting)

org.eclipse.jdt.ui.tests.refactoring.RenamePackageTests::testFail7 disabled (corner case - name obscuring)

org.eclipse.jdt.ui.tests.refactoring.RenamePackageTests::testFail8 disabled (corner case - name obscuring)

org.eclipse.jdt.ui.tests.refactoring.RenamePackageTests::testFail9 disabled (corner case - qualified name used  as a parameter of a native method)

org.eclipse.jdt.ui.tests.refactoring.RenamePrivateFieldTests::test10 disabled (BUG_81084)

org.eclipse.jdt.ui.tests.refactoring.RenamePrivateFieldTests::test11 disabled (BUG_75642_GENERIC_METHOD_SEARCH)

org.eclipse.jdt.ui.tests.refactoring.RenameNonPrivateFieldTests::testGenerics3 disabled (BUG_79990_CORE_SEARCH_METHOD_DECL)

org.eclipse.jdt.ui.tests.refactoring.ccp.DeleteTest::testDeleteWithinCu16 disabled (testDeleteWithinCu16 disabled for bug#55221)

org.eclipse.jdt.ui.tests.refactoring.ccp.PasteActionTest::test0 disabled (not implemented yet)
Different assignment rule(capture-of ? super java.lang.Object[]= java.lang.Number[]): Bindings<true> TType<false>
Different assignment rule(capture-of ? super java.lang.Number[]= java.lang.Number[]): Bindings<true> TType<false>
Different assignment rule(capture-of ? super java.lang.Object[]= java.lang.Integer[]): Bindings<true> TType<false>
Different assignment rule(capture-of ? super java.lang.Number[]= java.lang.Integer[]): Bindings<true> TType<false>
---------------------------------------------------------------------------

I am not sure what is the cause of failure in the integration build
Comment 1 Markus Keller CLA 2010-12-22 12:01:21 EST
The suite already timed out earlier (N20101202-2000), see
http://dev.eclipse.org/mhonarc/lists/platform-releng-dev/msg17739.html , but in later builds, it worked again.

I've now downloaded the test framework and ran the tests like they are run at eclipse.org.

The test hangs in RenamePackageTests.test2 with an "Undo Problem" dialog.

I'm looking for a solution.


Error message:
'Rename Package' cannot be undone.
Reason: Cannot determine the character encoding of
'TestProject3272168128112312/src/r/A.java'.

Stacktrace:
"main" prio=6 tid=0x007aa000 nid=0x13bc runnable [0x0024e000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.swt.internal.win32.OS.WaitMessage(Native Method)
        at org.eclipse.swt.widgets.Display.sleep(Display.java:4576)
        at org.eclipse.jface.window.Window.runEventLoop(Window.java:826)
        at org.eclipse.jface.window.Window.open(Window.java:801)
        at org.eclipse.jface.dialogs.MessageDialog.open(MessageDialog.java:334)
        at org.eclipse.ui.internal.operations.AdvancedValidationUserApprover.reportAndInterpretStatus(AdvancedValidationUserApprover.java:385)
        at org.eclipse.ui.internal.operations.AdvancedValidationUserApprover.access$2(AdvancedValidationUserApprover.java:283)
        at org.eclipse.ui.internal.operations.AdvancedValidationUserApprover$1.run(AdvancedValidationUserApprover.java:211)
        at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:179)
        at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
        at org.eclipse.swt.widgets.Display.syncExec(Display.java:4607)
        at org.eclipse.ui.internal.operations.AdvancedValidationUserApprover.proceedWithOperation(AdvancedValidationUserApprover.java:201)
        at org.eclipse.ui.internal.operations.AdvancedValidationUserApprover.proceedUndoing(AdvancedValidationUserApprover.java:159)
        at org.eclipse.core.commands.operations.DefaultOperationHistory.getUndoApproval(DefaultOperationHistory.java:824)
        at org.eclipse.core.commands.operations.DefaultOperationHistory.doUndo(DefaultOperationHistory.java:413)
        at org.eclipse.core.commands.operations.DefaultOperationHistory.undoOperation(DefaultOperationHistory.java:1298)
        at org.eclipse.ltk.internal.core.refactoring.UndoManager2.performUndo(UndoManager2.java:188)
        at org.eclipse.jdt.ui.tests.refactoring.RenamePackageTests.performUndo(RenamePackageTests.java:439)
        at org.eclipse.jdt.ui.tests.refactoring.RenamePackageTests.test2(RenamePackageTests.java:1117)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at junit.framework.TestCase.runTest(TestCase.java:168)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
Comment 2 Markus Keller CLA 2010-12-22 12:22:05 EST
RenamePackageTests works fine with v20101213 of org.eclipse.core.resources but fails with HEAD.
Comment 3 Szymon Brandys CLA 2010-12-22 13:27:28 EST
The problem is caused by the fix for bug 207510. Szymon, please investigate.
Comment 4 Markus Keller CLA 2010-12-22 13:47:06 EST
The bug is in org.eclipse.core.internal.resources.CharsetManager.getCharsetFor(IPath, boolean):

The call to "workspace.getRoot().findMember(resourcePath)" is bad. If 'recurse' is true, the method must recurse up to the workspace root and must not return null.

Call stack from the test (we call "file.getCharset(true)"):

CharsetManager.getCharsetFor(IPath, boolean) line: 277	
File.getCharset(boolean) line: 214	
ModificationStampValidationState(BufferValidationState).<init>(IFile) line: 150	
...
Comment 5 Markus Keller CLA 2010-12-22 13:48:44 EST
> Call stack from the test (we call "file.getCharset(true)"):
... where 'file' does *not* exist.
Comment 6 Szymon Brandys CLA 2010-12-22 17:20:02 EST
Created attachment 185739 [details]
The simples patch
Comment 7 Szymon Brandys CLA 2010-12-28 09:19:48 EST
Created attachment 185858 [details]
Fix v02
Comment 8 Szymon Brandys CLA 2010-12-28 09:23:16 EST
The fix and test is in HEAD.
Comment 9 Szymon Brandys CLA 2011-01-25 11:38:41 EST
Verified by code inspection.