Skip to content

Commit 516616d

Browse files
committed
Fixes unregistering of android/ios nodes from hub due too strict checking of result /wd/hub/status. Returning by node 200 response code (or 404 for RC) is enough for understanding that node is alive.
1 parent 2f2cdf3 commit 516616d

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Diff for: java/server/src/org/openqa/grid/internal/BaseRemoteProxy.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,17 @@ public JSONObject getStatus() throws GridException {
507507
int code = response.getStatusLine().getStatusCode();
508508

509509
if (code == 200) {
510-
JSONObject status = extractObject(response);
510+
JSONObject status = new JSONObject();
511+
try {
512+
status = extractObject(response);
513+
} catch (Exception e) {
514+
// ignored due it's not required from node to return anything. Just 200 code is enough.
515+
}
511516
EntityUtils.consume(response.getEntity());
512517
return status;
513518
} else if (code == 404) { // selenium RC case
514519
JSONObject status = new JSONObject();
520+
EntityUtils.consume(response.getEntity());
515521
return status;
516522
} else {
517523
EntityUtils.consume(response.getEntity());

Diff for: java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,7 @@ public HtmlRenderer getHtmlRender() {
125125

126126
public boolean isAlive() {
127127
try {
128-
JSONObject o = getStatus();
129-
return o.getString("state").equals("success");
130-
} catch (JSONException e) {
131-
// suppose that if json exception is raised
132-
// it's selenium RC case
128+
getStatus();
133129
return true;
134130
} catch (Exception e) {
135131
log.warning("Failed to check status of node: " + e.getMessage());

0 commit comments

Comments
 (0)