Bug 339508 - [sfs] SFS tests are failing for e4 0.11 Integration Build: I20110310-0100
diff --git a/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/internal/resources/semantic/cacheservice/CachingOutputStream.java b/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/internal/resources/semantic/cacheservice/CachingOutputStream.java
index 80e0039..265ba11 100644
--- a/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/internal/resources/semantic/cacheservice/CachingOutputStream.java
+++ b/bundles/org.eclipse.core.resources.semantic/src/org/eclipse/core/internal/resources/semantic/cacheservice/CachingOutputStream.java
@@ -27,6 +27,7 @@
 	private final ITemporaryContentHandle fileHandle;
 	private final ICacheUpdateCallback callback;
 	private final boolean appendMode;
+	private boolean closed;
 
 	protected CachingOutputStream(CacheService service, ITemporaryContentHandle tempHandle, boolean append, ICacheUpdateCallback callback) {
 
@@ -34,16 +35,22 @@
 		this.fileHandle = tempHandle;
 		this.appendMode = append;
 		this.callback = callback;
-
+		this.closed = false;
 	}
 
 	@Override
 	@SuppressWarnings("boxing")
 	public void close() throws IOException {
+		if (closed) {
+			return;
+		}
+
 		InputStream stream = null;
 		try {
 			long timestamp = System.currentTimeMillis();
 
+			closed = true;
+
 			this.cacheService.addFromTempHandle(this.fileHandle);
 
 			IPath path = this.fileHandle.getKey();