Project: JDT
Bug 5183 Wrong return type for extract method
Reported: 2001-10-23 12:58:55 | Status: resolved fixed

protected ITextBuffer doCreate(IFile file) throws CoreException { FileEditorInput input= new FileEditorInput(file); IDocument document= fDocumentProvider.getDocument(input); if (document != null) { return new TextBuffer(document); } else { InputStreamReader in= null; /*]*/try { document= new Document(); in= new InputStreamReader(new BufferedInputStream(file.getContents())); StringBuffer buffer= new StringBuffer(); char[] readBuffer= new char[2048]; int n= in.read(readBuffer); while (n > 0) { buffer.append(readBuffer, 0, n); n= in.read(readBuffer); } document.set(buffer.toString()); return new TextBuffer(document); } catch (IOException x) { IStatus s= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), JavaStatusConstants.INTERNAL_ERROR, x.getMessage(), x); throw new CoreException(s); } finally { if (in != null) { try { in.close(); } catch (IOException x) { } } }/*[*/ } } Extracting a method from the code /*]*/.../*[*/ doesn't return the created text buffer.

Files changed in fix:
org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/core/refactoring/code/ExceptionAnalyzer.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/core/refactoring/code/ReturnAnalyzer.java