Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

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 opened this issue Nov 21, 2017 · 3 comments
Labels

Comments

@mifreudi
Copy link

mifreudi commented Nov 21, 2017

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
Copy link
Contributor

rokkbert commented Nov 21, 2017

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.

@rokkbert rokkbert changed the title Wrong Http-status = 0 in Java-class --> CotSdkException.java for exception-handling in case of "Measurment not found" --> Java-Sdk version 1.0.0 Wrong Http-status = 0 in Java-class --> CotSdkException.java for exception-handling in case of "Measurement not found" --> Java-Sdk version 1.0.0 Nov 21, 2017
jogehl added a commit to jogehl/cot-java-rest-sdk that referenced this issue Mar 12, 2018
jogehl added a commit to jogehl/cot-java-rest-sdk that referenced this issue Mar 12, 2018
jogehl added a commit to jogehl/cot-java-rest-sdk that referenced this issue Mar 12, 2018
jogehl added a commit to jogehl/cot-java-rest-sdk that referenced this issue Mar 14, 2018
Andyck added a commit that referenced this issue Mar 28, 2018
@Andyck
Copy link
Collaborator

Andyck commented Mar 28, 2018

Is fixed. Will be contained in next release.

@Andyck Andyck added the bug label Mar 28, 2018
b00lduck added a commit that referenced this issue Apr 16, 2018
* develop:
  Upgraded smart-rest integration test. Upgraded version to 1.0.5-SNAPSHOT.
  remove unused imports
  revert version number
  [maven-release-plugin] prepare for next development iteration
  [maven-release-plugin] prepare release java-rest-client-1.0.4
  increase version number for release
  revert increased version number
  increase version number
  improve comment
  format code
  added http status code to throwing exception in getMeasurement revert code in CloudOfThingsRestClientTest
  Revert "changed getResponse for getting the http status code in Exception  #52"
  added test. Test is not running correctly  #52
  remove old code #52
  changed getResponse for getting the http status code in Exception  #52

# Conflicts:
#	src/main/java/com/telekom/m2m/cot/restsdk/smartrest/SmartRestApi.java
@Andyck
Copy link
Collaborator

Andyck commented Apr 17, 2018

Bugfix has been released in 1.0.5

@Andyck Andyck closed this as completed Apr 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants