MIGRATE from org.apache.commons.lang to org.apache.commons.lang3.(Strlookup not in org.apache.commons.lang3 version and is depracated) | Community
Skip to main content
Level 3
February 11, 2025
Solved

MIGRATE from org.apache.commons.lang to org.apache.commons.lang3.(Strlookup not in org.apache.commons.lang3 version and is depracated)

  • February 11, 2025
  • 3 replies
  • 828 views

Hi All,

 

As part of cloud migration we are planning to migrate import from org.apache.commons.lang to org.apache.commons.lang3.(lang3).

 

And to send a mail we are using Day common Mail template (com.day.cq.commons.mail.MailTemplate).

And we are using below mailTemplate.getEmail method and in one of the parameters we are using StringLookup which is part of org.apache.commons.lang.text.StrLookup (version1) as below.

import org.apache.commons.lang.text.StrLookup;

Email email = mailTemplate.getEmail(StrLookup.mapLookup(params), mail); 

 

How do we migrate to version3 as org.apache.commons.lang3.text.StrLookup is deprecated .Do we need to rewrite in some other way.?Thanks in Advance.

Best answer by narendiran_ravi

Upon checking the SDK documentation -https://developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/commons/mail/MailTemplate.html#getEmail(org.apache.commons.lang.text.StrLookup,java.lang.Class) , there are still using StrLookup from org.apache.commons.lang.

3 replies

narendiran_ravi
narendiran_raviAccepted solution
Level 6
February 11, 2025
Tethich
Community Advisor
Community Advisor
February 11, 2025

Hi @sb2512 

There is no replacement yet for this, so you may still need to use the existing org.apache.commons.lang.text.StrLookup class.

 

Neither AEM 6.5 not the cloud service version don't have this updated yet:
- https://developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/commons/mail/MailTemplate.html#getEmail(org.apache.commons.lang.text.StrLookup,java.lang.Class)

- https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/commons/mail/MailTemplate.html

 

Based on Apache docs on the deprecated stuff (https://commons.apache.org/proper/commons-lang/apidocs/deprecated-list.html), the StringLookupFactory should be used instead of StrLookup (https://commons.apache.org/proper/commons-text/javadocs/api-release/org/apache/commons/text/lookup/StringLookupFactory.html), but this is something Adobe would need to update.