Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 44985 Details for
Bug 146331
Java Editor won't save file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
146331.txt (text/plain), 3.40 KB, created by
Jerome Lanneluc
on 2006-06-21 06:07:51 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2006-06-21 06:07:51 EDT
Size:
3.40 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/CompilationUnit.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java,v >retrieving revision 1.231 >diff -u -r1.231 CompilationUnit.java >--- model/org/eclipse/jdt/internal/core/CompilationUnit.java 20 Jun 2006 11:33:14 -0000 1.231 >+++ model/org/eclipse/jdt/internal/core/CompilationUnit.java 21 Jun 2006 10:09:53 -0000 >@@ -1021,43 +1021,50 @@ > protected IBuffer openBuffer(IProgressMonitor pm, Object info) throws JavaModelException { > > // create buffer >+ BufferManager bufManager = getBufferManager(); > boolean isWorkingCopy = isWorkingCopy(); > IBuffer buffer = > isWorkingCopy > ? this.owner.createBuffer(this) >- : BufferManager.getDefaultBufferManager().createBuffer(this); >+ : bufManager.createBuffer(this); > if (buffer == null) return null; > >- // set the buffer source >- if (buffer.getCharacters() == null) { >- if (isWorkingCopy) { >- ICompilationUnit original; >- if (!isPrimary() >- && (original = new CompilationUnit((PackageFragment)getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY)).isOpen()) { >- buffer.setContents(original.getSource()); >- } else { >- IFile file = (IFile)getResource(); >- if (file == null || !file.exists()) { >- // initialize buffer with empty contents >- buffer.setContents(CharOperation.NO_CHAR); >+ // synchronize to ensure that 2 threads are not putting 2 different buffers at the same time >+ // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=146331 >+ synchronized(bufManager) { >+ IBuffer existingBuffer = bufManager.getBuffer(this); >+ if (existingBuffer != null) >+ return existingBuffer; >+ >+ // set the buffer source >+ if (buffer.getCharacters() == null) { >+ if (isWorkingCopy) { >+ ICompilationUnit original; >+ if (!isPrimary() >+ && (original = new CompilationUnit((PackageFragment)getParent(), getElementName(), DefaultWorkingCopyOwner.PRIMARY)).isOpen()) { >+ buffer.setContents(original.getSource()); > } else { >- buffer.setContents(Util.getResourceContentsAsCharArray(file)); >+ IFile file = (IFile)getResource(); >+ if (file == null || !file.exists()) { >+ // initialize buffer with empty contents >+ buffer.setContents(CharOperation.NO_CHAR); >+ } else { >+ buffer.setContents(Util.getResourceContentsAsCharArray(file)); >+ } > } >+ } else { >+ IFile file = (IFile)this.getResource(); >+ if (file == null || !file.exists()) throw newNotPresentException(); >+ buffer.setContents(Util.getResourceContentsAsCharArray(file)); > } >- } else { >- IFile file = (IFile)this.getResource(); >- if (file == null || !file.exists()) throw newNotPresentException(); >- buffer.setContents(Util.getResourceContentsAsCharArray(file)); > } >- } >- >- // add buffer to buffer cache >- BufferManager bufManager = getBufferManager(); >- bufManager.addBuffer(buffer); >- >- // listen to buffer changes >- buffer.addBufferChangedListener(this); > >+ // add buffer to buffer cache >+ bufManager.addBuffer(buffer); >+ >+ // listen to buffer changes >+ buffer.addBufferChangedListener(this); >+ } > return buffer; > } > protected void openParent(Object childInfo, HashMap newElements, IProgressMonitor pm) throws JavaModelException {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 146331
:
44278
|
44279
| 44985