Expand my Community achievements bar.

SOLVED

AEM 6.5 Tags reordered after saving in page properties dialog

Avatar

Community Advisor

Hello All,

We are noticing that when we add tags in page properties and save. On reopening the page properties, we see that the order of the tags has changed. This new order is just a random order and does not seem to follow any specific logic. The order in jcr node however seems to be saved in order which we added the tags while authoring.

This was not the case for AEM 6.2 (6.2.0.SP1-CFP20) We are only seeing this for AEM 6.5.8.

 

Has anyone faced this and knows how to fix this display order in the page properties dialog?

Anyone from Adobe has an idea how internally the tags are ordered for the page properties view?

Update: This is a prod issue for us and becoming an issue. @arunpatidar @kautuk_sahni and other experts Any insights on this? 

PS, we are soon looking to initiate Adobe ticket as well

1 Accepted Solution

Avatar

Correct answer by
Administrator

I would recommed you sharing this with AEM support team. They can create a ticket for this.

-Kautuk



Kautuk Sahni

View solution in original post

4 Replies

Avatar

Community Advisor

Digging deeper, this is what we think is happening.

For page properties view the following call goes 

http://localhost:4502/content/project/path/to/page/jcr:content.tags.json?count=false&replicationStateRequired=false&cq_ck=1634827988430

 

The TagListServlet seems to be using JcrTagManagerImpl to get a Tag[] and following code snippet is seen

 

Property prop = node.getProperty("cq:tags");
Value[] values = prop.getValues();
Set<Tag> tags = new HashSet(values.length);
for (Value val : values) {
Tag tag = resolve(val.getString());
if (tag != null) {
 tags.add(tag);
  }
      }
return (Tag[])tags.toArray(new Tag[0]);

Use of HashSet does not guarantee the input order. (tried doing similar in local as well)

 

 It makes no guarantees as to the iteration order of the set; in particular, it does not guarantee that the order will remain constant over time. see - https://docs.oracle.com/javase/8/docs/api/java/util/HashSet.html

 

I believe use of LinkedHashSet  may not cause this issue (performance impacts to be considered).

 

Can this be called as a bug or an enhancement that can be considered?

Avatar

Correct answer by
Administrator

I would recommed you sharing this with AEM support team. They can create a ticket for this.

-Kautuk



Kautuk Sahni