cloud-of-things / cot-java-rest-sdk

Cloud of Things Java Rest SDK (Cloud der Dinge Java Rest SDK)
MIT License
8 stars 10 forks source link

Wrong Http-status = 0 in Java-class --> CotSdkException.java for exception-handling in case of "Measurement not found" --> Java-Sdk version 1.0.0 #52

Closed mifreudi closed 6 years ago

mifreudi commented 6 years ago

For all HTTP-responses unequal to "Measurement Id not found" the HTTP-status code is set corrcetly unequal to '0'.

In case of "Measurement Id not found" the HTTP-response status code is set always to '0' (reason: wrong constructor selected)

Test for measurement not found: valid DeviceId = 4471037 in CoT-Tenant

CloudOfThingsPlatform cotPlatform = new CloudOfThingsPlatform("url", new CotCredentials("tenant", "user", "password"));

try { Measurement cotDevice4471037 = cotPlatform.getMeasurementApi().getMeasurement("4471037"); System.out.println("cotDevice4471037 = " + cotDevice4471037); return "cotDevice4471037 = " + cotDevice4471037; } catch(CotSdkException e){ System.out.println(e.getMessage()); return "error: status=" + e.getHttpStatus() + " message=" + e.getMessage(); }

TestResult: error: status=0 message=Measurement not found (id='4471037')

rokkbert commented 6 years ago

You're correct. The status is not set. It should be 404. We will need to investigate why that is the case and if we can change it without side effects. Thanks for reporting this inconsistency.

Andyck commented 6 years ago

Is fixed. Will be contained in next release.

Andyck commented 6 years ago

Bugfix has been released in 1.0.5