Buggy code:
public class StateImpl implements IState { private JavaDevelopmentContextImpl fDevelopmentContext ; private IImageContext fBuildContext ; private IProject fProject ; private String fProjectName ; private IPackageFragmentRoot [ ] fPackageFragmentRootsInClassPath ; private BinaryOutput fBinaryOutput ; private PackageMap fPackageMap ; private PathMap fPathMap ; private SourceElementTable fSourceElementTable ; private Hashtable fPrincipalStructureTable ; private Hashtable fPrincipalStructureByPackageTable ; private IProblemReporter fProblemReporter ; private DependencyGraph fGraph = null ; private Hashtable fSubtypesTable ; private IImageContext fSubtypesTableImageContext ; private IImage fImage ; private int fStateNumber ; private byte [ ] fFingerprint ; final IType fVoidType ; final IType fIntType ; final IType fByteType ; final IType fCharType ; final IType fDoubleType ; final IType fFloatType ; final IType fLongType ; final IType fShortType ; final IType fBooleanType ; private static int fgStateCounter = 0 ; private static final int F_HAS_PARSE_ERROR = 268435456 ; private static final String UNKNOWN_DEPENDENCIES = "$UNKNOWN_DEPENDENCIES$" ; private static final Random fgRandom = new Random ( ) ; protected StateImpl ( JavaDevelopmentContextImpl dc , IProject project ) { } protected StateImpl ( JavaDevelopmentContextImpl dc , IProject project , IImageContext buildContext ) { } public IImageBuilder applySourceDelta ( IProject newProject , IResourceDelta projectDelta , IImageContext buildContext ) { } protected void buildInitialPackageMap ( ) { } protected void buildPrincipalStructureByPackageTable ( ) { } protected TypeStructureEntry buildTypeStructureEntry ( IType handle ) throws NotPresentException { } protected IPackage canonicalize ( IPackage pkg ) { } protected IType canonicalize ( IType type ) { } protected void canonicalizeBuildContext ( ) { } protected IImageContext canonicalizeBuildContext ( IImageContext oldContext ) { } protected void cleanUp ( ) { } protected void collectBinaryBrokerKeys ( Hashtable keysInUse ) { } protected boolean contains ( SourceEntry sEntry ) { } protected ConvertedCompilationResult convertCompilationResult ( CompilationResult result , IPackage defaultPackage ) { } protected StateImpl copy ( IProject newProject , IImageContext context ) { } protected IPackage defaultPackageFor ( IPackage pkg ) { } protected IPackage defaultPackageForProject ( ) { } protected IBinaryType forceBinaryType ( TypeStructureEntry tsEntry , boolean lazyBuildCU ) { } protected static byte [ ] generateFingerprint ( ) { } protected IPackage [ ] getAllPackagesAsArray ( ) { } protected TypeStructureEntry [ ] getAllTypesForPackage ( IPackage pkg ) { } protected byte [ ] getBinary ( IType type , boolean lazyBuildCU ) throws NotPresentException { } protected BinaryOutput getBinaryOutput ( ) { } protected IBinaryType getBinaryType ( TypeStructureEntry tsEntry ) throws NotPresentException { } protected IBinaryType getBinaryTypeOrNull ( TypeStructureEntry tsEntry ) { } public IImageContext getBuildContext ( ) { } public IProject [ ] getClassPathProjects ( ) { } protected PackageElement getCompilationUnitFromName ( String name , IPackage defaultPackage ) { } protected TypeStructureEntry [ ] getDeclaredTypesForPackage ( IPackage pkg ) { } public IDependencyGraph getDependencyGraph ( ) { } public IDevelopmentContext getDevelopmentContext ( ) { } protected byte [ ] getElementContentBytes ( SourceEntry entry ) { } protected char [ ] getElementContentCharArray ( SourceEntry entry ) { byte [ ] bytes = getElementContentBytes ( entry ) ; InputStream stream = null ; try { stream = new ByteArrayInputStream ( bytes ) ; <START_BUG> return Util . getInputStreamAsCharArray ( stream , bytes . length ) ; <END_BUG> } catch ( IOException e ) { return new char [ 0 ] ; } finally { if ( stream != null ) { try { stream . close ( ) ; } catch ( IOException ioe ) { } } } } protected IFile getFile ( IPath path ) { } protected IFile getFile ( SourceEntry sEntry ) { } public byte [ ] getFingerprint ( ) { } protected IFolder getFolder ( IPath path ) { } public IImage getImage ( ) { } protected DependencyGraph getInternalDependencyGraph ( ) { } protected IJavaElement getJavaElement ( SourceEntry sEntry ) { } protected IJavaProject getJavaProject ( ) { } protected INode getNode ( String qualifiedNameWithSuffix ) { } protected IPath getOutputLocation ( ) { } static Comparator getPackageComparator ( ) { } protected PackageElement getPackageElement ( String qualifiedNameWithSuffix ) { } protected IPackageFragmentRoot [ ] getPackageFragmentRootsInClassPath ( ) { } protected PackageMap getPackageMap ( ) { } static Comparator getPathComparator ( ) { } protected PathMap getPathMap ( ) { } protected Hashtable getPrincipalStructureByPackageTable ( ) { } protected Hashtable getPrincipalStructureTable ( ) { } protected IProblemReporter getProblemReporter ( ) { } protected Enumeration getProblems ( ) { } protected Vector getProblems ( String qualifiedNameWithSuffix ) { } public IProject getProject ( ) { } protected String getProjectName ( ) { } protected IPackage [ ] getReferencedPackages ( IPackage pkgHandle ) { } protected ReferenceInfo getReferencesForPackageElement ( PackageElement builderUnit ) { } protected IPackage [ ] getReferencingPackages ( IPackage pkgHandle , IImageContext context ) { } public IReportCard getReportCard ( IImageContext imageContext ) { } protected void getSourceElementEntries ( IPackage pkg , IPath path , LookupTable entryTable ) { } protected SourceElementTable getSourceElementTable ( ) { } protected SourceEntry [ ] getSourceEntries ( IPackage pkg ) { } protected SourceEntry getSourceEntry ( String qualifiedNameWithSuffix ) { } protected SourceEntry getSourceEntry ( PackageElement element ) { } protected SourceEntry getSourceEntry ( IType type ) { } protected Hashtable getSubtypesTable ( IImageContext imageContext ) { } protected Hashtable getTableOfReferencedPackages ( IPackage pkgHandle ) { } protected TypeStructureEntry getTypeStructureEntry ( String qualifiedNameWithoutSuffix ) { } protected TypeStructureEntry getTypeStructureEntry ( IType handle , boolean lazyBuildCU ) { } protected IPackage getUnknownDependenciesNamespace ( ) { } protected RuntimeException internalException ( String message ) { } protected RuntimeException internalException ( Throwable t ) { } protected static boolean isZipElement ( IPath path ) { } protected IPath makeAbsolute ( IPath path ) { } public IDelta newNaiveDeltaWith ( IState oldState , IImageContext imgCtx ) { } protected PackageElement packageElementFromSourceEntry ( SourceEntry entry ) { } protected IPackage packageFromSourceEntry ( SourceEntry entry ) { } protected void putCompilationResult ( ConvertedCompilationResult result ) { } protected void putCompilationResults ( ConvertedCompilationResult [ ] results ) { } public void putSourceEntry ( IPackage pkg , SourceEntry sourceEntry ) { } protected void readClassPath ( ) { }

Fix:
return Util . getInputStreamAsCharArray ( stream , bytes . length , null ) ;