Community
Participate
Working Groups
The following code throws a ResourceException when the default encoding is UTF-8 (for example on Fedora Core Linux 4 and 5) ICompilationUnit unit = a compilation unit corresponding to a file that does not exist ICompilationUnit working_copy = (ICompilationUnit) unit.getWorkingCopy ( null, null, null); IBuffer buffer = working_copy.getBuffer(); buffer.setContents("blah blah"); buffer.save(null, true); This throws a ResourceException at Buffer.java line 361 The problem is that IFile.getContentDescription throws the exception when the file does not exist. The obvious fix is to skip the enclosing if block if the file does not exist, but the if block is there to fix another bug, so I am not sure if this is the right fix.
Should not you create the unit instead of creating a working copy on a unit that doesn't have an underlying file? For me this looks like it works as expected. Closing as INVALID. Please reopen if I misunderstood what you want to do.
Verified for 3.6M1