Summary: | JavaCore.getEncoding() fails when there is no workspace. | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Marcelo Paternostro <marcelop> | ||||||
Component: | Core | Assignee: | Frederic Fusier <frederic_fusier> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | Olivier_Thomann | ||||||
Version: | 3.4 | ||||||||
Target Milestone: | 3.4 M5 | ||||||||
Hardware: | PC | ||||||||
OS: | Windows XP | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Marcelo Paternostro
2008-01-28 15:44:52 EST
Created attachment 88126 [details] Proposed patch The proposed fix takes advantage of the fact that ResourcePlugin.getWorkspace() throws an IllegalStateException when there's no workspace. Then, bug 60687 should also be definitely fixed as well... No test case added as JDT/Core tests always have a workspace. To validate the fix, I run following simple class as a JUnit Test (no plug-in): import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.tests.junit.extension.TestCase; public class TestEncoding extends TestCase { public TestEncoding(String name) { super(name); } public void test01() { assertEquals("Cp1252", JavaCore.getEncoding()); } } Released for 3.4M5 in HEAD stream. Verified for 34M5 using I20080204-0010 build. However, I would suggest that a test be added to our test projects. (In reply to comment #3) > Verified for 34M5 using I20080204-0010 build. > > However, I would suggest that a test be added to our test projects. > Verifying that is definitely not possible as all Eclipse JUnit tests are run as 'JUnit Plug-in tests' and so ResourcePlugin.getWorkspace() will never return a null value or throw a CoreException (even for our compiler tests...). As this condition is necessary to reproduce the bug, we cannot add any regression test to verify this new correct behavior... |