Fix Bug 10467 - Carbide features cannot be used if SBS hangs or is corrupt RCL_2_4
authortimkelly
Thu, 11 Feb 2010 11:31:22 -0600
branchRCL_2_4
changeset 931 c6f86d0867c2
parent 923 bbee10bb6733
child 932 9eff68f52ec6
Fix Bug 10467 - Carbide features cannot be used if SBS hangs or is corrupt
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Wed Feb 10 15:19:41 2010 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Thu Feb 11 11:31:22 2010 -0600
@@ -981,10 +981,26 @@
 				BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
 				String overallOutput = null;
 				String stdErrLine = null;
-				try { 
-					while ((stdErrLine = br.readLine()) != null) { 
-						overallOutput += stdErrLine; 
+				try {
+
+					// Only try for 10 seconds then bail in case Raptor hangs
+					int maxTries = 20;
+					int numTries = 0;
+					while (numTries < maxTries) {
+						try {
+							Thread.sleep(500);
+						} catch (InterruptedException e) {
+							// ignore
+						}
+						if (br.ready()) {
+							while ((stdErrLine = br.readLine()) != null) {
+								overallOutput += stdErrLine;
+							}
+							break;
+						}
+						numTries++;
 					}
+
 				} catch (IOException e) { 
 					e.printStackTrace();
 				}