diff --git a/build.gradle b/build.gradle index 211da3c..b36f57f 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ dependencies { compile 'io.github.bonigarcia:webdrivermanager:1.5.0' compile 'org.seleniumhq.selenium:selenium-java:2.47.1' compile 'commons-net:commons-net:3.5' - compile 'org.reflections:reflections:0.9.10' + compile 'org.reflections:reflections:0.9.9-RC1' compile 'org.glassfish.tyrus:tyrus-client:1.13.1' compile 'org.glassfish.tyrus:tyrus-container-grizzly-client:1.13.1' diff --git a/src/main/java/com/musala/atmosphere/agent/websocket/AgentDispatcher.java b/src/main/java/com/musala/atmosphere/agent/websocket/AgentDispatcher.java index 2de1d27..5e53a8e 100644 --- a/src/main/java/com/musala/atmosphere/agent/websocket/AgentDispatcher.java +++ b/src/main/java/com/musala/atmosphere/agent/websocket/AgentDispatcher.java @@ -156,14 +156,14 @@ public void run() { try { deviceWrapper.route(requestAction, arguments); } catch (CommandFailedException e) { - sendErrorResponseMessage(e, session, request.getSessionId()); + sendErrorResponseMessage(e, session, request); LOGGER.error(ACTION_FAILD_MESSAGE, e); } } }) {}.start(); } - } catch (CommandFailedException e) { - sendErrorResponseMessage(e, session, request.getSessionId()); + } catch (CommandFailedException | IllegalArgumentException e) { + sendErrorResponseMessage(e, session, request); LOGGER.error(ACTION_FAILD_MESSAGE, e); } } @@ -217,9 +217,10 @@ public void setDeviceManager(DeviceManager deviceManager) { this.deviceManager = deviceManager; } - private void sendErrorResponseMessage(Exception ex, Session session, String requestSessionId) { + private void sendErrorResponseMessage(Exception ex, Session session, RequestMessage request) { ResponseMessage errorResponse = new ResponseMessage(MessageAction.ERROR, null, null); - errorResponse.setSessionId(requestSessionId); + errorResponse.setSessionId(request.getSessionId()); + errorResponse.setDeviceId(request.getDeviceId()); errorResponse.setException(ex); sendText(jsonUtil.serialize(errorResponse), session);