Skip to content

I20200609-1800

@trancexpress trancexpress tagged this 09 Jun 19:41
CompilationUnit.getContents() and CompilationUnit.discardWorkingCopy()
can be called concurrently, causing the getContents() method to throw an
exception. This in turn can cause ASTParser.createBindings() to fail.

In particular, its possible for CompilationUnit.getContents() to
retrieve an open buffer via BufferManager.getBuffer(). This buffer can
then be closed, before CompilationUnit.getContents() calls
IBuffer.getCharacters(). As a result, getCharacters() returns null and
CompilationUnit.getContents() throws an exception.

With this change CompilationUnit.getContents() resorts to reading the
compilation unit file directly, in case the compilation unit buffer was
closed after obtaining it, but before the buffers characters were
retrieved.

Change-Id: I01772e638bf4160defc63196629a710f214181c5
Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Assets 2
Loading