From 4667afc28ccec7dad6f9b8917d441db975a7d51b Mon Sep 17 00:00:00 2001
From: Florian Hoelzl <hoelzl@fortiss.org>
Date: Mon, 27 Jun 2011 09:50:35 +0000
Subject: [PATCH] added error logging for exceptions during workspace scanning

---
 .../EclipseResourceStorageProvider.java       | 34 +++++++++++++------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageProvider.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageProvider.java
index 7623c604b..714adc85d 100644
--- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageProvider.java
+++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EclipseResourceStorageProvider.java
@@ -51,7 +51,7 @@ import org.osgi.framework.Bundle;
  * @author hoelzlf
  * @author $Author$
  * @version $Rev$
- * @ConQAT.Rating YELLOW Hash: 9FBC1CF2E10E3E2AB1E12642A139F7C3
+ * @ConQAT.Rating YELLOW Hash: B8363ADD63E4E6D34D97577B26670CEB
  */
 public class EclipseResourceStorageProvider implements IResourceChangeListener,
 		IResourceDeltaVisitor, IStorageProvider {
@@ -92,18 +92,32 @@ public class EclipseResourceStorageProvider implements IResourceChangeListener,
 				for (IResource res : project.members()) {
 					if (res instanceof IFile) {
 						IFile file = (IFile) res;
-						for (IEclipseResourceStorageLocationProvider provider : storageProviderList) {
-							if (provider.isStorageLocation(file)) {
-								loadContext(file);
-								break;
-							}
-						}
+						checkLocationProviderAndLoadContext(file);
 					}
 				}
 			} catch (CoreException e) {
-				// ignore
-			} catch (IOException ioex) {
-				// ignore
+				LoggingUtils.error(ToolingKernelActivator.getDefault(),
+						"Core Exception while scanning Eclipse workspace", e);
+			}
+		}
+	}
+
+	/**
+	 * Searches all location providers and loads the model context if some
+	 * location provider validates the given file as model storage file.
+	 */
+	private void checkLocationProviderAndLoadContext(IFile file) {
+		for (IEclipseResourceStorageLocationProvider provider : storageProviderList) {
+			if (provider.isStorageLocation(file)) {
+				try {
+					loadContext(file);
+				} catch (IOException ioex) {
+					LoggingUtils.error(
+							ToolingKernelActivator.getDefault(),
+							"IO Exception while loading model file: "
+									+ file.getName(), ioex);
+				}
+				break;
 			}
 		}
 	}
-- 
GitLab