Buggy code:
public static final char JEM_ANNOTATION = '}' ; protected JavaElement parent ; protected static final JavaElement [ ] NO_ELEMENTS = new JavaElement [ 0 ] ; protected static final Object NO_INFO = new Object ( ) ; protected JavaElement ( JavaElement parent ) throws IllegalArgumentException { } public void close ( ) throws JavaModelException { } protected abstract void closing ( Object info ) throws JavaModelException { } protected abstract Object createElementInfo ( ) { } public boolean equals ( Object o ) { } protected void escapeMementoName ( StringBuffer buffer , String mementoName ) { } public boolean exists ( ) { } public ASTNode findNode ( CompilationUnit ast ) { } protected abstract void generateInfos ( Object info , HashMap newElements , IProgressMonitor pm ) throws JavaModelException { } public IJavaElement getAncestor ( int ancestorType ) { } public IJavaElement [ ] getChildren ( ) throws JavaModelException { } public ArrayList getChildrenOfType ( int type ) throws JavaModelException { } public IClassFile getClassFile ( ) { } public ICompilationUnit getCompilationUnit ( ) { } public Object getElementInfo ( ) throws JavaModelException { } public Object getElementInfo ( IProgressMonitor monitor ) throws JavaModelException { } public String getElementName ( ) { } public abstract IJavaElement getHandleFromMemento ( String token , MementoTokenizer memento , WorkingCopyOwner owner ) { } public IJavaElement getHandleFromMemento ( MementoTokenizer memento , WorkingCopyOwner owner ) { } public String getHandleIdentifier ( ) { } public String getHandleMemento ( ) { } protected void getHandleMemento ( StringBuffer buff ) { } protected abstract char getHandleMementoDelimiter ( ) { } public IJavaModel getJavaModel ( ) { } public IJavaProject getJavaProject ( ) { } public IOpenable getOpenable ( ) { } public IOpenable getOpenableParent ( ) { } public IJavaElement getParent ( ) { } public IJavaElement getPrimaryElement ( ) { } public IJavaElement getPrimaryElement ( boolean checkOwner ) { } public IResource getResource ( ) { } public abstract IResource resource ( ) { } protected IJavaElement getSourceElementAt ( int position ) throws JavaModelException { } public SourceMapper getSourceMapper ( ) { } public ISchedulingRule getSchedulingRule ( ) { } public boolean hasChildren ( ) throws JavaModelException { } public int hashCode ( ) { } public boolean isAncestorOf ( IJavaElement e ) { } public boolean isReadOnly ( ) { } public JavaModelException newNotPresentException ( ) { } protected JavaModelStatus newDoesNotExistStatus ( ) { } public JavaModelException newJavaModelException ( IStatus status ) { } protected Object openWhenClosed ( Object info , IProgressMonitor monitor ) throws JavaModelException { } public String readableName ( ) { } public JavaElement resolved ( Binding binding ) { } public JavaElement unresolved ( ) { } protected String tabString ( int tab ) { } public String toDebugString ( ) { } public String toString ( ) { } protected void toString ( int tab , StringBuffer buffer ) { } public String toStringWithAncestors ( ) { } public String toStringWithAncestors ( boolean showResolvedInfo ) { } protected void toStringAncestors ( StringBuffer buffer ) { } protected void toStringChildren ( int tab , StringBuffer buffer , Object info ) { } public Object toStringInfo ( int tab , StringBuffer buffer ) { } protected void toStringInfo ( int tab , StringBuffer buffer , Object info , boolean showResolvedInfo ) { } protected void toStringName ( StringBuffer buffer ) { } protected URL getJavadocBaseLocation ( ) throws JavaModelException { } private static IClasspathEntry getRealClasspathEntry ( IJavaProject jproject , IPath containerPath , IPath libPath ) throws JavaModelException { } protected static URL getLibraryJavadocLocation ( IClasspathEntry entry ) throws JavaModelException { } public String getAttachedJavadoc ( IProgressMonitor monitor ) throws JavaModelException { } int getIndexOf ( byte [ ] array , byte [ ] toBeFound , int start ) { } protected String getURLContents ( String docUrlValue ) throws JavaModelException { InputStream stream = null ; JarURLConnection connection2 = null ; try { URL docUrl = new URL ( docUrlValue ) ; URLConnection connection = docUrl . openConnection ( ) ; if ( connection instanceof JarURLConnection ) { connection2 = ( ( JarURLConnection ) ( connection ) ) ; connection . setUseCaches ( false ) ; } stream = new BufferedInputStream ( connection . getInputStream ( ) ) ; String encoding = connection . getContentEncoding ( ) ; byte [ ] contents = Util . getInputStreamAsByteArray ( stream , connection . getContentLength ( ) ) ; if ( encoding == null ) { int index = getIndexOf ( contents , JavaElement . CONTENT_TYPE , 0 ) ; if ( index != ( - 1 ) ) { index = getIndexOf ( contents , JavaElement . CONTENT , index ) ; if ( index != ( - 1 ) ) { int offset = index + ( JavaElement . CONTENT . length ) ; int index2 = getIndexOf ( contents , JavaElement . CLOSING_DOUBLE_QUOTE , offset ) ; if ( index2 != ( - 1 ) ) { final int charsetIndex = getIndexOf ( contents , JavaElement . CHARSET , offset ) ; if ( charsetIndex != ( - 1 ) ) { int start = charsetIndex + ( JavaElement . CHARSET . length ) ; <START_BUG> encoding = new String ( contents , start , ( index2 - start ) , "UTF-8" ) ; <END_BUG> } } } } } try { if ( encoding == null ) { encoding = this . getJavaProject ( ) . getProject ( ) . getDefaultCharset ( ) ; } } catch ( CoreException e ) { } if ( contents != null ) { if ( encoding != null ) { return new String ( contents , encoding ) ; } else { return new String ( contents ) ; } } } catch ( MalformedURLException e ) { throw new JavaModelException ( new JavaModelStatus ( IJavaModelStatusConstants . CANNOT_RETRIEVE_ATTACHED_JAVADOC , this ) ) ; } catch ( FileNotFoundException e ) { } catch ( IOException e ) { StringWriter stringWriter = new StringWriter ( ) ; PrintWriter writer = new PrintWriter ( stringWriter ) ; e . printStackTrace ( writer ) ; writer . flush ( ) ; writer . close ( ) ;

Fix:
encoding = new String ( contents , start , ( index2 - start ) , Util . UTF_8 ) ;