Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Tiede2014-10-07 13:04:16 +0000
committerMarkus Tiede2014-10-07 13:04:36 +0000
commit0c84e3732bce90ef186e55ae26a6d7376d6a8c7e (patch)
tree3af772be1c6911d93f0f451ceb5bcb61eb7d8224 /org.eclipse.jubula.client.api
parentfe1035e2db0b6fb698c1fda86836cb1f7b658d06 (diff)
downloadorg.eclipse.jubula.core-0c84e3732bce90ef186e55ae26a6d7376d6a8c7e.tar.gz
org.eclipse.jubula.core-0c84e3732bce90ef186e55ae26a6d7376d6a8c7e.tar.xz
org.eclipse.jubula.core-0c84e3732bce90ef186e55ae26a6d7376d6a8c7e.zip
Non-sprint task - added type checking for thread synchronization points.
Diffstat (limited to 'org.eclipse.jubula.client.api')
-rw-r--r--org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java28
1 files changed, 22 insertions, 6 deletions
diff --git a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java
index 444924254..a66c55d23 100644
--- a/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java
+++ b/org.eclipse.jubula.client.api/src/org/eclipse/jubula/client/internal/impl/AUTAgentImpl.java
@@ -23,9 +23,14 @@ import org.eclipse.jubula.tools.internal.constants.AUTStartResponse;
import org.eclipse.jubula.tools.internal.constants.AutConfigConstants;
import org.eclipse.jubula.tools.internal.constants.ToolkitConstants;
import org.eclipse.jubula.tools.internal.registration.AutIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/** @author BREDEX GmbH */
public class AUTAgentImpl implements AUTAgent {
+ /** the logger */
+ private static Logger log = LoggerFactory.getLogger(AUTAgentImpl.class);
+
/** the hosts name */
private String m_hostname;
/** the port */
@@ -82,9 +87,15 @@ public class AUTAgentImpl implements AUTAgent {
autConfigMap, toolkitID);
m_agent.send(startAUTMessage);
-
- int startResponse = (Integer) Synchronizer.instance().exchange(null);
- return handleResponse(startResponse);
+
+ Object genericStartResponse = Synchronizer.instance().exchange(null);
+ if (genericStartResponse instanceof Integer) {
+ int startResponse = (Integer) genericStartResponse;
+ return handleResponse(startResponse);
+ }
+ log.error("Unexpected start response code received: " //$NON-NLS-1$
+ + String.valueOf(genericStartResponse));
+ return null;
}
/**
@@ -94,11 +105,16 @@ public class AUTAgentImpl implements AUTAgent {
*/
private AutIdentifier handleResponse(int startResponse)
throws Exception {
- if (startResponse != AUTStartResponse.OK) {
- return null;
+ if (startResponse == AUTStartResponse.OK) {
+ Object autIdentifier = Synchronizer.instance().exchange(null);
+ if (autIdentifier instanceof AutIdentifier) {
+ return (AutIdentifier) autIdentifier;
+ }
+ log.error("Unexpected AUT identifier received: " //$NON-NLS-1$
+ + String.valueOf(autIdentifier));
}
- return (AutIdentifier) Synchronizer.instance().exchange(null);
+ return null;
}

Back to the top