Skip to main content
Har_Khandelwal
New Participant
May 31, 2016

tagmanager.findByTitle() not working for special characters like "&"

  • May 31, 2016
  • 12 replies
  • 6006 views

Hi,

I am writing a piece of code that uses the title to fetch the corresponding Tag. I am facing issues for tags with & sign.

 

Example:

        String tagTtitle = "Celebrations & Holidays";
        FindResults result = tagManager.findByTitle(tagTtitle)

       Tag[] tagArr = result.tags;

        for(Tag tag : tagArr){
               tagList.add(tag);
         }
 

This is a title under Stock Photography, but returns an empty result. Works fine for tags with regular titles. 

 

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

12 replies

kautuk_sahni
Employee
June 1, 2016

I have asked internally.

Would get back to you soon.

 

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
Har_Khandelwal
New Participant
June 1, 2016

Hi,

 

Can anyone please explain why tagManager.resolveByTitle("Celebrations & Holidays"); not working? The API states that it uses Title Path property. Can you please explain what it is?

 

Thanks in advance.

Ratna_Kumar
New Participant
June 1, 2016

Hi,

I too agree with Scott statement. Special character might cause the issue. Otherwise it should work.

This is a bug. Create support ticket here for the same: https://helpx.adobe.com/marketing-cloud/contact-support.html

Thanks,
Ratna Kumar.

kautuk_sahni
Employee
June 1, 2016

Ratna Kumar wrote...

Hi,

I too agree with Scott statement. Special character might cause the issue. Otherwise it should work.

This is a bug. Create support ticket here for the same: https://helpx.adobe.com/marketing-cloud/contact-support.html

Thanks,
Ratna Kumar.

 

The argument of the Function is String Type (resolveByTitle(String tagTitlePath) ), i doubt that this would be a bug. It could be asDesigned, that these special characters need some Escaping.

I would Recommend you to Create support ticket here for the same: https://helpx.adobe.com/marketing-cloud/contact-support.html 

Whenever you get the answer, please share it with the community for community's benefit.

 

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
smacdonald2008
New Participant
May 31, 2016

You are correct - i was able to reproduce your results: 

  TagManager tMgr = tmf.getTagManager(session);
  //String myTag =  "properties:style/color"; 
  String myTag =  "Celebrations & Holidays"; 
                      
 log.info("**** ABOUT TO FIND TAGS");
 RangeIterator<Resource> tagsIt = tMgr.findByTitle(myTag).resources;

Special chars seem to be an issue.

This is a bug.  Please log a  ticket here so Eng and SUpport are made aware: 

https://helpx.adobe.com/marketing-cloud/contact-support.html

New Participant
November 28, 2017

scott i am trying to find the dam asset path with below sample code in 6.3 and getting null value

Map<String, Object> param = new HashMap<String, Object>();

        param.put(ResourceResolverFactory.SUBSERVICE, "allegionCorpService");   

        ResourceResolver resolver = null;

        Session session = null;

try {

//ResourceResolver resourceResolver = resolverFactory.getAdministrativeResourceResolver(null);

//session = repository.loginService("allegionCorpService", null);       

        resolver = resolverFactory.getServiceResourceResolver(param);

            session = resolver.adaptTo(Session.class);            

            log.error("####### session ######### : " + session.getUserID());

TagManager tMgr = tmf.getTagManager(session);

String myTag = tagID; //

RangeIterator<Resource> tagsIt = tMgr.find(myTag); - getting null pointer exception means tagIt is null

error log

28.11.2017 16:43:05.694 *ERROR* [198.102.128.6 [1511905385664] GET /content/allegion-us-2/en/home/products/detail.html HTTP/1.1] com.allegionus2.americas.serviceImpl.HelloServiceImpl ####### session ######### : allesysuser

28.11.2017 16:43:05.695 *ERROR* [198.102.128.6 [1511905385664] GET /content/allegion-us-2/en/home/products/detail.html HTTP/1.1] com.allegionus2.americas.serviceImpl.HelloServiceImpl ####### Before Tag ID ######### : allegion-us-2:Products::com.day.cq.tagging.impl.JcrTagManagerImpl@7ec199dc

28.11.2017 16:43:05.696 *ERROR* [198.102.128.6 [1511905385664] GET /content/allegion-us-2/en/home/products/detail.html HTTP/1.1] com.allegionus2.americas.serviceImpl.HelloServiceImpl ####### After Tag ID ######### : null

28.11.2017 16:43:05.696 *ERROR* [198.102.128.6 [1511905385664] GET /content/allegion-us-2/en/home/products/detail.html HTTP/1.1] com.allegionus2.americas.serviceImpl.HelloServiceImpl *** COUNT ERROR: java.lang.NullPointerException

kautuk_sahni
Employee
May 31, 2016

Hi

-----------------------------------

Not Sure but you can try

------------------------------------

You can try %encoding the string.

Eg. let say for "admin@123" we could write admin%40123. //@ has hex value of 40 so we escaped it as %40. This is the technique use by many browsers for handling Unicode characters.

So for, 

&=> %26

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
Har_Khandelwal
New Participant
May 31, 2016

Hi Kautuk,

Thanks for the help. But even this is not working.