Buggy code:
public class CompilationUnit extends Openable implements ICompilationUnit , org . eclipse . jdt . internal . compiler . env . ICompilationUnit , SuffixConstants { static final int JLS2_INTERNAL = AST . JLS2 ; protected String name ; public WorkingCopyOwner owner ; protected CompilationUnit ( PackageFragment parent , String name , WorkingCopyOwner owner ) { } public void accept ( ASTVisitor visitor ) throws JavaModelException { } public void becomeWorkingCopy ( IProblemRequestor problemRequestor , IProgressMonitor monitor ) throws JavaModelException { } protected boolean buildStructure ( OpenableElementInfo info , final IProgressMonitor pm , Map newElements , IResource underlyingResource ) throws JavaModelException { } public boolean canBeRemovedFromCache ( ) { } public boolean canBufferBeRemovedFromCache ( IBuffer buffer ) { } public void close ( ) throws JavaModelException { } protected void closing ( Object info ) { } public void codeComplete ( int offset , ICompletionRequestor requestor ) throws JavaModelException { } public void codeComplete ( int offset , ICompletionRequestor requestor , WorkingCopyOwner workingCopyOwner ) throws JavaModelException { } public void codeComplete ( int offset , final ICodeCompletionRequestor requestor ) throws JavaModelException { } public void codeComplete ( int offset , CompletionRequestor requestor ) throws JavaModelException { } public void codeComplete ( int offset , CompletionRequestor requestor , WorkingCopyOwner workingCopyOwner ) throws JavaModelException { } public IJavaElement [ ] codeSelect ( int offset , int length ) throws JavaModelException { } public IJavaElement [ ] codeSelect ( int offset , int length , WorkingCopyOwner workingCopyOwner ) throws JavaModelException { } public void commit ( boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void commitWorkingCopy ( boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void copy ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected Object createElementInfo ( ) { } public IImportDeclaration createImport ( String importName , IJavaElement sibling , IProgressMonitor monitor ) throws JavaModelException { } public IImportDeclaration createImport ( String importName , IJavaElement sibling , int flags , IProgressMonitor monitor ) throws JavaModelException { } public IPackageDeclaration createPackageDeclaration ( String pkg , IProgressMonitor monitor ) throws JavaModelException { } public IType createType ( String content , IJavaElement sibling , boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void delete ( boolean force , IProgressMonitor monitor ) throws JavaModelException { } public void destroy ( ) { } public void discardWorkingCopy ( ) throws JavaModelException { } public boolean equals ( Object obj ) { } public boolean exists ( ) { } public IJavaElement [ ] findElements ( IJavaElement element ) { } public IType findPrimaryType ( ) { } public IJavaElement findSharedWorkingCopy ( IBufferFactory factory ) { } public ICompilationUnit findWorkingCopy ( WorkingCopyOwner workingCopyOwner ) { } public IType [ ] getAllTypes ( ) throws JavaModelException { } public ICompilationUnit getCompilationUnit ( ) { } public char [ ] getContents ( ) { try { IBuffer buffer = this . getBuffer ( ) ; <START_BUG> return buffer == null ? null : buffer . getCharacters ( ) ; <END_BUG> } catch ( JavaModelException e ) { return CharOperation . NO_CHAR ; } } public IResource getCorrespondingResource ( ) throws JavaModelException { } public IJavaElement getElementAt ( int position ) throws JavaModelException { } public String getElementName ( ) { } public int getElementType ( ) { } public char [ ] getFileName ( ) { } public IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner workingCopyOwner ) { } protected char getHandleMementoDelimiter ( ) { } public IImportDeclaration getImport ( String importName ) { } public IImportContainer getImportContainer ( ) { } public IImportDeclaration [ ] getImports ( ) throws JavaModelException { } public char [ ] getMainTypeName ( ) { } public IJavaElement getOriginal ( IJavaElement workingCopyElement ) { } public IJavaElement getOriginalElement ( ) { } public WorkingCopyOwner getOwner ( ) { } public IPackageDeclaration getPackageDeclaration ( String pkg ) { } public IPackageDeclaration [ ] getPackageDeclarations ( ) throws JavaModelException { } public char [ ] [ ] getPackageName ( ) { } public IPath getPath ( ) { } public JavaModelManager . PerWorkingCopyInfo getPerWorkingCopyInfo ( ) { } public ICompilationUnit getPrimary ( ) { } public IJavaElement getPrimaryElement ( boolean checkOwner ) { } public IResource getResource ( ) { } public String getSource ( ) throws JavaModelException { } public ISourceRange getSourceRange ( ) throws JavaModelException { } public IType getType ( String typeName ) { } public IType [ ] getTypes ( ) throws JavaModelException { } public IResource getUnderlyingResource ( ) throws JavaModelException { } public IJavaElement getSharedWorkingCopy ( IProgressMonitor pm , IBufferFactory factory , IProblemRequestor problemRequestor ) throws JavaModelException { } public IJavaElement getWorkingCopy ( ) throws JavaModelException { } public ICompilationUnit getWorkingCopy ( IProgressMonitor monitor ) throws JavaModelException { } public IJavaElement getWorkingCopy ( IProgressMonitor monitor , IBufferFactory factory , IProblemRequestor problemRequestor ) throws JavaModelException { } public ICompilationUnit getWorkingCopy ( WorkingCopyOwner workingCopyOwner , IProblemRequestor problemRequestor , IProgressMonitor monitor ) throws JavaModelException { } protected boolean hasBuffer ( ) { } public boolean hasResourceChanged ( ) { } public boolean isBasedOn ( IResource resource ) { } public boolean isConsistent ( ) { } public boolean isPrimary ( ) { } protected boolean isSourceElement ( ) { } protected IStatus validateCompilationUnit ( IResource resource ) { } public boolean isWorkingCopy ( ) { } public void makeConsistent ( IProgressMonitor monitor ) throws JavaModelException { } public org . eclipse . jdt . core . dom . CompilationUnit makeConsistent ( boolean createAST , int astLevel , IProgressMonitor monitor ) throws JavaModelException { } public void move ( IJavaElement container , IJavaElement sibling , String rename , boolean force , IProgressMonitor monitor ) throws JavaModelException { } protected IBuffer openBuffer ( IProgressMonitor pm , Object info ) throws JavaModelException { } protected void openParent ( Object childInfo , HashMap newElements , IProgressMonitor pm ) throws JavaModelException { } public IMarker [ ] reconcile ( ) throws JavaModelException { }

Fix:
return buffer == null ? CharOperation . NO_CHAR : buffer . getCharacters ( ) ;