1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-25 18:05:33 +02:00

Fixed a compiler warning.

This commit is contained in:
Sergey Prigogin 2012-04-16 20:47:52 -07:00
parent 0e6e83e1cb
commit 9475940089

View file

@ -20,7 +20,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@ -1206,42 +1205,41 @@ public class PDOMManager implements IWritableIndexManager, IListener {
if (!deleted) {
throw new IllegalArgumentException(
MessageFormat.format(Messages.PDOMManager_ExistingFileCollides,
new Object[] {targetLocation})
);
targetLocation ));
}
}
try {
// copy it
// Copy it.
PDOM pdom= getOrCreatePDOM(cproject);
pdom.acquireReadLock();
String oldID= null;
try {
oldID= pdom.getProperty(IIndexFragment.PROPERTY_FRAGMENT_ID);
pdom.flush();
FileChannel to = new FileOutputStream(targetLocation).getChannel();
pdom.getDB().transferTo(to);
to.close();
FileOutputStream stream = new FileOutputStream(targetLocation);
pdom.getDB().transferTo(stream.getChannel());
stream.close();
} finally {
pdom.releaseReadLock();
}
// overwrite internal location representations
// Overwrite internal location representations.
final WritablePDOM newPDOM = new WritablePDOM(targetLocation, pdom.getLocationConverter(), getLinkageFactories());
newPDOM.acquireWriteLock();
try {
newPDOM.rewriteLocations(newConverter);
// ensure fragment id has a sensible value, in case callee's do not
// overwrite their own values
newPDOM.setProperty(IIndexFragment.PROPERTY_FRAGMENT_ID, "exported."+oldID); //$NON-NLS-1$
// Ensure that fragment id has a sensible value, in case callee's do not
// overwrite with their own values.
newPDOM.setProperty(IIndexFragment.PROPERTY_FRAGMENT_ID, "exported." + oldID); //$NON-NLS-1$
newPDOM.close();
} finally {
newPDOM.releaseWriteLock();
}
} catch (IOException ioe) {
throw new CoreException(CCorePlugin.createStatus(ioe.getMessage()));
} catch (InterruptedException ie) {
throw new CoreException(CCorePlugin.createStatus(ie.getMessage()));
} catch (IOException e) {
throw new CoreException(CCorePlugin.createStatus(e.getMessage()));
} catch (InterruptedException e) {
throw new CoreException(CCorePlugin.createStatus(e.getMessage()));
}
}