connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java
branchRCL_2_4
changeset 916 6743933eec70
parent 60 9d2210c8eed2
child 1560 2b3cd56e1090
--- a/connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java	Wed Feb 10 13:45:43 2010 -0600
+++ b/connectivity/com.nokia.tcf/src/com/nokia/tcf/impl/TCAPIConnection.java	Wed Feb 10 14:32:22 2010 -0600
@@ -46,7 +46,12 @@
 			} catch (UnsatisfiedLinkError e) {
 				// if Carbide DLL is not found in DE, 
 				// try to load one from the plugin itself
-				System.loadLibrary("TCFClient");
+				try {
+					System.loadLibrary("TCFClient");
+				} catch (UnsatisfiedLinkError e2) {
+					// no native TCF, e.g., not on Windows or in a misconfigured dev layout
+					e2.printStackTrace();
+				}
 			}
 		}
 	}
@@ -354,6 +359,23 @@
 				this.cookie.setConnected(true);
 				this.connection = inConnection;
 				this.messageOptions = inMessageOptions;
+			} else if (ret == TCErrorConstants.TCAPI_ERR_COMM_SERVER_RESPONSE_TIMEOUT){
+				// TCFServer may have died, attempt to restart it
+				ret = nativeStartServer();
+				if (ret == TCErrorConstants.TCAPI_ERR_NONE) {
+					// now try connecting again
+					ret = nativeConnect(type, options, settings, moptions, filePath, clientId);
+					if (ret == TCErrorConstants.TCAPI_ERR_NONE) {
+						this.cookie.setClientId(clientId[0]);
+						this.cookie.setConnected(true);
+						this.connection = inConnection;
+						this.messageOptions = inMessageOptions;
+					} else {
+						status = new Status(Status.ERROR, Activator.PLUGIN_ID, (int)ret, TCErrorConstants.getErrorMessage(ret), null);
+					}
+				} else {
+					status = new Status(Status.ERROR, Activator.PLUGIN_ID, (int)ret, TCErrorConstants.getErrorMessage(ret), null);
+				}
 			} else {
 				status = new Status(Status.ERROR, Activator.PLUGIN_ID, (int)ret, TCErrorConstants.getErrorMessage(ret), null);
 			}