{"action":"created","issue":{"url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/94","repository_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java","labels_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/94/comments","events_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/94/events","html_url":"https://github.com/Azure/azure-iot-sdk-java/issues/94","id":227579942,"number":94,"title":"SASToken Expired Exception was not getting thrown by the Device Client Open or Send","user":{"login":"jkriba","id":21360594,"avatar_url":"https://avatars1.githubusercontent.com/u/21360594?v=4","gravatar_id":"","url":"https://api.github.com/users/jkriba","html_url":"https://github.com/jkriba","followers_url":"https://api.github.com/users/jkriba/followers","following_url":"https://api.github.com/users/jkriba/following{/other_user}","gists_url":"https://api.github.com/users/jkriba/gists{/gist_id}","starred_url":"https://api.github.com/users/jkriba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkriba/subscriptions","organizations_url":"https://api.github.com/users/jkriba/orgs","repos_url":"https://api.github.com/users/jkriba/repos","events_url":"https://api.github.com/users/jkriba/events{/privacy}","received_events_url":"https://api.github.com/users/jkriba/received_events","type":"User","site_admin":false},"labels":[{"id":461741541,"url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/labels/bug","name":"bug","color":"ee0701","default":true},{"id":520577774,"url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/labels/fix%20checked%20in","name":"fix checked in","color":"c2e0c6","default":false}],"state":"closed","locked":false,"assignee":{"login":"prmathur-microsoft","id":20328314,"avatar_url":"https://avatars3.githubusercontent.com/u/20328314?v=4","gravatar_id":"","url":"https://api.github.com/users/prmathur-microsoft","html_url":"https://github.com/prmathur-microsoft","followers_url":"https://api.github.com/users/prmathur-microsoft/followers","following_url":"https://api.github.com/users/prmathur-microsoft/following{/other_user}","gists_url":"https://api.github.com/users/prmathur-microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/prmathur-microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prmathur-microsoft/subscriptions","organizations_url":"https://api.github.com/users/prmathur-microsoft/orgs","repos_url":"https://api.github.com/users/prmathur-microsoft/repos","events_url":"https://api.github.com/users/prmathur-microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/prmathur-microsoft/received_events","type":"User","site_admin":false},"assignees":[{"login":"prmathur-microsoft","id":20328314,"avatar_url":"https://avatars3.githubusercontent.com/u/20328314?v=4","gravatar_id":"","url":"https://api.github.com/users/prmathur-microsoft","html_url":"https://github.com/prmathur-microsoft","followers_url":"https://api.github.com/users/prmathur-microsoft/followers","following_url":"https://api.github.com/users/prmathur-microsoft/following{/other_user}","gists_url":"https://api.github.com/users/prmathur-microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/prmathur-microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prmathur-microsoft/subscriptions","organizations_url":"https://api.github.com/users/prmathur-microsoft/orgs","repos_url":"https://api.github.com/users/prmathur-microsoft/repos","events_url":"https://api.github.com/users/prmathur-microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/prmathur-microsoft/received_events","type":"User","site_admin":false},{"login":"timtay-microsoft","id":28789848,"avatar_url":"https://avatars0.githubusercontent.com/u/28789848?v=4","gravatar_id":"","url":"https://api.github.com/users/timtay-microsoft","html_url":"https://github.com/timtay-microsoft","followers_url":"https://api.github.com/users/timtay-microsoft/followers","following_url":"https://api.github.com/users/timtay-microsoft/following{/other_user}","gists_url":"https://api.github.com/users/timtay-microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/timtay-microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timtay-microsoft/subscriptions","organizations_url":"https://api.github.com/users/timtay-microsoft/orgs","repos_url":"https://api.github.com/users/timtay-microsoft/repos","events_url":"https://api.github.com/users/timtay-microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/timtay-microsoft/received_events","type":"User","site_admin":false}],"milestone":null,"comments":25,"created_at":"2017-05-10T06:34:39Z","updated_at":"2017-12-05T18:05:39Z","closed_at":"2017-12-05T18:05:39Z","author_association":"NONE","body":"Hi Support,\r\nWe are using Android Version 7.1 for developing a Cloud connector for our business application in the mobile device. Unlike the Azure IoT  Device Client provided by the .Net SDK , in case of  using an expired SAS token to Open / Send  events to IoTHub the device client of Java SDK is not throwing any exceptions and still trying to send the message which is eventually resulting in UN Authorization of the packet.\r\n\r\n- **OS and version used:** <VERSION> Android 7.1\r\n\r\n- **Java runtime used:** <VERSION> JDK \"1.8.0_45\"\r\n\r\n- **SDK version used:** <VERSION> IoT Device Client 1.1.26 for Java\r\n\r\n\r\n# Description of the issue:\r\nAzure IoT DeviceClient for Java is not throwing an exception when it uses an Expired SAS token to send an event to the Azure IoTHub. This was working perfect with the Microsoft .Net SDK i.e. DeviceClient . We were not able to manage the state of the application SAS Token without this exception handling.\r\n\r\n# Code sample exhibiting the issue:\r\nvoid CreateDeviceClient() throws TokenExpiredException, Exception\r\n{\r\n   try\r\n   {\r\n      _logger.LogDebug(GetConnectionString());\r\n\r\n      //Connection string with expired SAS Token       \r\n      deviceClient = new DeviceClient(GetConnectionString(),_protocol); \r\n\r\n     _logger.LogDebug(\"CreateDeviceClient() - created \");\r\n   }\r\n   catch (Exception e)\r\n   {\r\n      //Here the exception is not get caught like the .Net SDK for an Expired SAS Token\r\n      throw e;\r\n   }\r\n}\r\n\r\n\r\n# Console log of the issue:\r\nD/AndroidLog: 05/10/2017 11:55:37 AM :: IoTHubTransportEx.java:CreateDeviceClient:223 :: CreateDeviceClient() - created \r\nD/AndroidLog: 05/10/2017 11:55:37 AM :: IoTHubTransportEx.java:OpenDeviceClientAsync:258 :: OpenDeviceClientAsync() - opened \r\nV/AndroidLog: 05/10/2017 11:55:37 AM :: ConnectionMonitor.java:SendHeartBeat:311 :: Enter\r\nI/AndroidLog: 05/10/2017 11:55:37 AM :: ConnectionMonitor.java:SendHeartBeat:314 :: SendHeartbeatAsync() Sending heartbeat\r\nV/AndroidLog: 05/10/2017 11:55:37 AM :: IotHubConnectionPlugin.java:Send:188 :: Enter\r\nD/AndroidLog: 05/10/2017 11:55:37 AM :: IotHubConnectionPlugin.java:InternalSendAsync:228 :: D/AndroidLog: 05/10/2017 11:55:38 AM :: IoTHubTransportEx.java:execute:272 :: IoT Hub responded to message : HeartbeatRequest : 7f38d512-7918-4268-bfe6-07b13257843d with status UNAUTHORIZED\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/comments/349389560","html_url":"https://github.com/Azure/azure-iot-sdk-java/issues/94#issuecomment-349389560","issue_url":"https://api.github.com/repos/Azure/azure-iot-sdk-java/issues/94","id":349389560,"user":{"login":"timtay-microsoft","id":28789848,"avatar_url":"https://avatars0.githubusercontent.com/u/28789848?v=4","gravatar_id":"","url":"https://api.github.com/users/timtay-microsoft","html_url":"https://github.com/timtay-microsoft","followers_url":"https://api.github.com/users/timtay-microsoft/followers","following_url":"https://api.github.com/users/timtay-microsoft/following{/other_user}","gists_url":"https://api.github.com/users/timtay-microsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/timtay-microsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timtay-microsoft/subscriptions","organizations_url":"https://api.github.com/users/timtay-microsoft/orgs","repos_url":"https://api.github.com/users/timtay-microsoft/repos","events_url":"https://api.github.com/users/timtay-microsoft/events{/privacy}","received_events_url":"https://api.github.com/users/timtay-microsoft/received_events","type":"User","site_admin":false},"created_at":"2017-12-05T18:05:39Z","updated_at":"2017-12-05T18:05:39Z","author_association":"CONTRIBUTOR","body":"@sruthi06 The fix for that bug has been released:\r\n\r\nhttps://github.com/Azure/azure-iot-sdk-java/releases/tag/2017-12-2\r\n\r\nI'm closing this issue for now, feel free to re-open if it something else comes up. Sorry for the delay."}}
{"actor":{"display_login":"timtay-microsoft"}}