Print

Print


Commit in lcsim/src/org/lcsim/conditions on MAIN
ConditionsReader.java+12-61.12 -> 1.13
slight improvement to a few conditions system error mesg

lcsim/src/org/lcsim/conditions
ConditionsReader.java 1.12 -> 1.13
diff -u -r1.12 -r1.13
--- ConditionsReader.java	20 Aug 2008 01:00:45 -0000	1.12
+++ ConditionsReader.java	30 Mar 2009 22:49:07 -0000	1.13
@@ -112,6 +112,11 @@
 				if (url.getProtocol().equals("file") && (url.getHost() == null || url.getHost().length() == 0))
 				{					
 					File file = new File(url.getPath());
+					// Check if exists.
+					if (!file.exists())
+					{
+						throw new RuntimeException("The URL " + url.toString() + " used by detector " + name + " does not exist.");
+					}
 					if (file.isDirectory()) return new DirectoryConditionsReader(file);
 					else return new ZipConditionsReader(file);
 				}
@@ -128,12 +133,14 @@
 				File zipFile = new File(detectorDir,name+".zip");
 				if (zipFile.exists()) return new ZipConditionsReader(zipFile);
 				File dirFile = new File(detectorDir,name);
-				if (dirFile.exists() && dirFile.isDirectory()) {
+				if (dirFile.exists() && dirFile.isDirectory()) 
+				{
 					return new DirectoryConditionsReader(dirFile);
 				}
 
 				// Search the classpath from the base package.
-				try { 					
+				try 
+				{ 					
 					return new BaseClasspathConditionsReader(name);
 				}
 				catch (IOException x)
@@ -267,7 +274,7 @@
 		InputStream open(String name, String type) throws IOException
 		{
 			File file = new File(dir,name+"."+type);
-			if (!file.exists()) throw new IOException("Conditions "+name+"."+type+" not found");
+			if (!file.exists()) throw new IOException("Conditions "+name+"."+type+" not found, because directory " + file.getAbsolutePath() + " does not exist.");
 			return new BufferedInputStream(new FileInputStream(file));
 		}
 		void close() throws IOException
@@ -277,7 +284,7 @@
 
 	/**
 	 * This ConditionsReader finds detector conditions with the assumption that the conditions are located in a package called <code>detectorName</code>.
-	 * This ConditionsReader will work if lcsim-detector jar from the LCDetectors project is on the classpath.
+	 * This ConditionsReader will work if the lcsim-detector jar from the LCDetectors project is on the classpath.
 	 */
 	private static class BaseClasspathConditionsReader extends ConditionsReader
 	{
@@ -307,7 +314,6 @@
 		}
 
 		void close() throws IOException
-		{
-		}
+		{}
 	}
 }
CVSspam 0.2.8