Community
Participate
Working Groups
N20060427 org.eclipse.jdt.internal.core.CompilationUnit#getContents() currently returns an empty char array in the following cases: - the CU is in working copy mode and the working copy's buffer is being closed - the CU is in compilation unit mode and the underlying file is being deleted - the CU is in compilation unit mode and there is an encoding problem leading to an IOException We should surface this kind of problem during search, reconcile, etc... so as to not create unexpected errors. The batch compiler does surface this kind of problem (see org.eclipse.jdt.ineternal.compiler.batch.CompilationUnit#getContents())
see bug 130980 for context near surfacing the encoding issues
also see bug 192880
Created attachment 86948 [details] Proposed fix and regression tests This fix reports problem to read the working copy/compilation unit's contents to the problem requestor if reconciling, otherwise it logs the problem to the .log file. Note that there is no regression test for the encoding problem case since on Windows encoding problems are not reported. Thus this test would be Linux specific . It means that a developer running on Windows only would not see that s/he broke the test. This could cause integration builds failures.
Fix and tests released for 3.4M5
Verified in the code for 3.4M5 using build I20080204-0010