Improve error handling while loading standard metadata files
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java
index 90aaf22..d7c63ae 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/PluginRelativeStandardMetaDataSourceFileLocator.java
@@ -12,6 +12,7 @@
 
 package org.eclipse.jst.jsf.common.metadata.internal;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
@@ -42,7 +43,10 @@
 		if (url != null) {
 			return url.openStream();
 		}
-		return null;
+		else {
+			String  fileName = fileInfo.getBundleId()+"/"+ Path.fromOSString(fileInfo.getLocation()).toString();
+			throw new FileNotFoundException("Metadata file not found: "+ fileName);
+		}
 	}
 
 	
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardAnnotationFilesTranslator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardAnnotationFilesTranslator.java
index a60ae49..701877d 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardAnnotationFilesTranslator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardAnnotationFilesTranslator.java
@@ -35,7 +35,8 @@
 		else {
 			//for each entity and trait call "add".   assistant will handle merge.
 			Model mk = (Model)assistant.getSourceModelProvider().getSourceModel();
-			traverseAndAdd(assistant, mk);
+			if (mk != null)//possible that model was not loaded
+				traverseAndAdd(assistant, mk);
 		}			
 	}
 	
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java
index 139641e..c43ddc6 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataFileRegistry.java
@@ -13,6 +13,7 @@
  *******************************************************************************/
 package org.eclipse.jst.jsf.common.metadata.internal;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
@@ -118,14 +119,9 @@
 		return fileLocator;
 	}
 	
-	private InputStream getInputStream() {				
+	private InputStream getInputStream() throws IOException {				
 		if (getFileLocator() != null){
-			try {
-				return	getFileLocator().getInputStream();
-			} catch (IOException e) {
-				JSFCommonPlugin.log(IStatus.ERROR, "IOException: StandardMetaDataFilesProvider.getInputStream()", e);				
-
-			}
+			return	getFileLocator().getInputStream();			
 		}
 		return null;
 		
@@ -138,8 +134,9 @@
 		if (model != null)
 			return model;
 		
-		InputStream inputStream = getInputStream();
+		InputStream inputStream = null;
 		try {
+			inputStream = getInputStream();
 			if (inputStream != null){
 				EList contents = StandardModelFactory.getInstance().loadStandardFileResource(inputStream, this);
 				//check to see if this is a Model
@@ -148,6 +145,8 @@
 					((Model)model).setSourceModelProvider(this);
 				}
 			}
+		} catch (FileNotFoundException e){
+			JSFCommonPlugin.log(IStatus.ERROR,e.getLocalizedMessage(), e);
 		} catch (IOException e) {
 			JSFCommonPlugin.log(IStatus.ERROR,"IOException(1): StandardMetaDataFilesProvider.getSourceModel()", e);
 		} finally {
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java
index 239e937..cc578a4 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/common/metadata/internal/StandardMetaDataSourceFileLocator.java
@@ -12,6 +12,7 @@
 
 package org.eclipse.jst.jsf.common.metadata.internal;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.MissingResourceException;
@@ -48,7 +49,7 @@
 	 * @return InputStream
 	 * @throws IOException
 	 */
-	public abstract InputStream getInputStream() throws IOException;
+	public abstract InputStream getInputStream() throws IOException, FileNotFoundException;
 	
 	/**
 	 * Return ResourceBundle for the property files if there are any.  Return null if not.