Timout SBSv2 version check if sbs hangs (bug 10467)
authortimkelly
Wed, 10 Feb 2010 13:00:21 -0600
changeset 926 c6a84ca946e6
parent 925 8995c5d35623
child 927 a907fec05bb3
Timout SBSv2 version check if sbs hangs (bug 10467)
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	Wed Feb 10 11:48:54 2010 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java	Wed Feb 10 13:00:21 2010 -0600
@@ -654,8 +654,23 @@
 				String overallOutput = null;
 				String stdErrLine = null;
 				try {
-					while ((stdErrLine = br.readLine()) != null) {
-						overallOutput += stdErrLine;
+
+					// 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();