Bug 530736 - "la" does not return the latest content instance
Summary: "la" does not return the latest content instance
Status: UNCONFIRMED
Alias: None
Product: OM2M
Classification: IoT
Component: Platform (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 8
: P3 normal
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-05 09:02 EST by Nobody - feel free to take it CLA
Modified: 2018-02-05 09:02 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2018-02-05 09:02:07 EST
I wrote a short program that creates 100 content instances:
//example code
Cnt cnt = new Cnt();
cnt.setRn("test-java");
this.manager.createResource("", false, cnt);
for (Integer i = 0; i < 100; ++i) {
  this.manager.createContentInstance01("test-java", i.toString(), true);
}

The resource name of each content instance corresponds to its index. Moreover, the method createContentInstance01 synchronously creates a content instance. As a result, the container "test-java" contains many content instances with the resource names "0", "1", "2",..., "97", "98", and "99".

When I use the HTTP-Rest-Service to get the latest content instance ("http://localhost:8080/in-name/test-java/la"), I expect to get the content instance with the resource name "99". 

Unfortunately, in most cases I get a different content instance, e.g. "93". I guess one reason for this problem is that "la" triggers the following code (LatestOldestController.java):
cinEntity = containerEntity.getChildContentInstances().get(containerEntity.getChildContentInstances().size()-1);
It seems that this code does not accurately resemble the creation order of content instances?

Remark: I'm on the master branch.