Don't log exception to console when sbs[.bat] cannot be found.
authorEd Swartz <ed.swartz@nokia.com>
Tue, 05 Jan 2010 18:36:01 -0600
changeset 745 51d63d83aad1
parent 743 78fd666a897a
child 746 df006c3379d5
Don't log exception to console when sbs[.bat] cannot be found.
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java	Tue Jan 05 11:23:50 2010 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java	Tue Jan 05 18:36:01 2010 -0600
@@ -18,6 +18,7 @@
 import java.io.InputStreamReader;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -636,17 +637,29 @@
 			sbsV2Version = new Version(0, 0, 0);
 			
 			Runtime rt=Runtime.getRuntime();
+			IPath sbsPath = SBSv2Utils.getSBSPath();
+			Process p = null;
 			try {
-				IPath sbsPath = SBSv2Utils.getSBSPath();
-				Process p = rt.exec(new String[] { sbsPath.toOSString(), "-v" });
-				
+				p = rt.exec(new String[] { sbsPath.toOSString(), "-v" });
+			} catch (IOException e) {
+				// no such process, SBSv2 not available
+				Logging.log(SDKCorePlugin.getDefault(), Logging.newSimpleStatus(
+						0, IStatus.WARNING, 
+						MessageFormat.format(
+							"Could not find or launch Raptor script ''{0}''; SBSv2 support will not be available",
+							sbsPath), e));
+			}
+			if (p != null) {
 				BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
 				String overallOutput = null;
 				String stdErrLine = null;
-				while ((stdErrLine = br.readLine()) != null) {
-					overallOutput += stdErrLine;
+				try {
+					while ((stdErrLine = br.readLine()) != null) {
+						overallOutput += stdErrLine;
+					}
+				} catch (IOException e) {
+					e.printStackTrace();
 				}
-				
 				if (overallOutput != null) {
 				{
 					String[] tokens = overallOutput.split(" ");
@@ -674,14 +687,9 @@
 						}
 					
 					p.destroy();
+					}
 				}
 			}
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-			
-			
-			
 		}
 		return sbsV2Version;
 	}