{"action":"closed","issue":{"url":"https://api.github.com/repos/Azure/azure-iot-sdks/issues/1017","repository_url":"https://api.github.com/repos/Azure/azure-iot-sdks","labels_url":"https://api.github.com/repos/Azure/azure-iot-sdks/issues/1017/labels{/name}","comments_url":"https://api.github.com/repos/Azure/azure-iot-sdks/issues/1017/comments","events_url":"https://api.github.com/repos/Azure/azure-iot-sdks/issues/1017/events","html_url":"https://github.com/Azure/azure-iot-sdks/issues/1017","id":193695968,"number":1017,"title":"[Java] Device-to-Cloud message property value cannot contain '/' (and other symbols)","user":{"login":"dluc","id":371009,"avatar_url":"https://avatars.githubusercontent.com/u/371009?v=3","gravatar_id":"","url":"https://api.github.com/users/dluc","html_url":"https://github.com/dluc","followers_url":"https://api.github.com/users/dluc/followers","following_url":"https://api.github.com/users/dluc/following{/other_user}","gists_url":"https://api.github.com/users/dluc/gists{/gist_id}","starred_url":"https://api.github.com/users/dluc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dluc/subscriptions","organizations_url":"https://api.github.com/users/dluc/orgs","repos_url":"https://api.github.com/users/dluc/repos","events_url":"https://api.github.com/users/dluc/events{/privacy}","received_events_url":"https://api.github.com/users/dluc/received_events","type":"User","site_admin":false},"labels":[{"id":356336017,"url":"https://api.github.com/repos/Azure/azure-iot-sdks/labels/CSS","name":"CSS","color":"e99695","default":false},{"id":369924804,"url":"https://api.github.com/repos/Azure/azure-iot-sdks/labels/investigation-required","name":"investigation-required","color":"d93f0b","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-06T06:46:18Z","updated_at":"2017-01-12T19:10:05Z","closed_at":"2017-01-12T19:10:05Z","body":"While it's fine to set properties with values containing symbols like \"/\" for C2D messages, the same doesn't work for D2C messages:\r\n\r\nThe code below throws an exception on `d2c.setProperty(key,value)`:\r\n\r\n```\r\nException in thread \"main\" java.lang.IllegalArgumentException: \r\n/root/sub is not a valid IoT Hub message property value.\r\n```\r\n\r\nThe property value validation in `com.microsoft.azure.iothub.MessageProperty` ctor is, I think, too strict (and not consistent with the validation used for C2D messages).\r\n\r\n```\r\npublic class Test\r\n{\r\n    public static void main(String[] args)\r\n    {\r\n        String key = \"location\";\r\n        String value = \"/root/sub\";\r\n\r\n        // Service message\r\n        com.microsoft.azure.iot.service.sdk.Message c2d = new com.microsoft.azure.iot.service.sdk.Message();\r\n        java.util.HashMap<String, String> properties = new java.util.HashMap<>();\r\n        properties.put(key, value);\r\n        c2d.setProperties(properties);\r\n\r\n        // so far so good ...\r\n\r\n        // Device message\r\n        com.microsoft.azure.iothub.Message d2c = new com.microsoft.azure.iothub.Message();\r\n        d2c.setProperty(key, value); // <-- exception here\r\n    }\r\n}\r\n```"}}
{"actor":{"display_login":"tameraw"}}