You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2005/06/28 15:51:55 UTC

svn commit: r202180 - /forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java

Author: rgardler
Date: Tue Jun 28 06:51:54 2005
New Revision: 202180

URL: http://svn.apache.org/viewcvs?rev=202180&view=rev
Log:
spot when Forrest has not been built properly, also better config of log4j

Modified:
    forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java

Modified: forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java?rev=202180&r1=202179&r2=202180&view=diff
==============================================================================
--- forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java (original)
+++ forrest/trunk/tools/eclipse/plugins/org.apache.forrest/src/org/apache/forrest/eclipse/job/ForrestJob.java Tue Jun 28 06:51:54 2005
@@ -50,6 +50,8 @@
 	private static final String VALIDATION_ERROR_MESSAGE = "Could not validate document";
 	
 	private static final String PLUGIN_INSTALL_FAILURE = "Unable to install required plugins";
+    
+    private static final String BUILD_FORREST_ERROR_MESSAGE = "You must build forrest before you can run it.";
 
 	/**
 	 * Logger for this class
@@ -61,6 +63,8 @@
 	public static final int EXCEPTION_VALIDATION = 1010;
 
 	public static final int EXCEPTION_ANT_RUNNING = 1020;
+    
+    public static final int EXCEPTION_FORREST = 1030;
 	
 	protected String workingDir;
 
@@ -72,10 +76,13 @@
 		super(name);
 
 		ForrestPlugin plugin = ForrestPlugin.getDefault();
-		URL urlPluginDir = plugin.getBundle().getEntry("/");
-		Bundle bundle = Platform.getBundle(ForrestPlugin.ID);
-		URL log4jConf = Platform.find(bundle, new Path("conf/log4j.xml"));
-		DOMConfigurator.configure(log4jConf);
+		URL urlPluginDir = plugin.getBundle().getEntry("/conf/log4j.xml");		
+        try {
+            URL log4jConf = Platform.resolve(urlPluginDir);
+            DOMConfigurator.configure(log4jConf);
+        } catch (IOException e) {
+            // Unable to get log4j config continue anyway
+        }
 	}
 
 	/**
@@ -126,8 +133,12 @@
 					userMsg = "Unable to install required server plugins";
 					status = new Status(Status.ERROR, ForrestPlugin.ID,
 							EXCEPTION_ANT_RUNNING, userMsg, e);
-				} else {
-					userMsg = "Forrest Server Exception";
+				} else if (errMsg.contains(BUILD_FORREST_ERROR_MESSAGE)) {
+                    userMsg = "Your installation of Forrest, at " + fhome + ", has not been correctly built.";
+                    status = new Status(Status.ERROR, ForrestPlugin.ID,
+                            ForrestRunner.EXCEPTION_FORREST, userMsg, e);
+                } else {
+        			userMsg = "Forrest Server Exception";
 					status = new Status(Status.ERROR, ForrestPlugin.ID,
 							ForrestRunner.EXCEPTION_UNIDENTIFIED, userMsg, e);
 				}
@@ -166,7 +177,7 @@
 			vctURLs.add(classURL);
 			
 			// Add Plugin jars
-			URL installURL = Platform.getBundle(ForrestPlugin.ID).getEntry("/");
+			URL installURL = ForrestPlugin.getDefault().getBundle().getEntry("/");
 			String location = Platform.resolve(installURL).getFile();
 			fileList = ForrestManager.getLibFiles(location);
 			itr = fileList.listIterator();