I am working on code refactoring, following the document Deprecated APIs | Adobe Experience Manager.
The documentation states that org.apache.commons.lang.text is deprecated and instead, Commons Lang 3 should be used.
Code Snippet
import org.apache.commons.lang.text.StrLookup;
import org.apache.commons.mail.Email;
import com.day.cq.commons.mail.MailTemplate;
Email email = mailTemplate.getEmail(StrLookup.mapLookup(emailParams), HtmlEmail.class);
Here emailParams is a map of key and value both as string. "Map<String, String> emailParams".
This getEmail method needs "StrLookup" which is only returned by "mapLookup" method provided by "org.apache.commons.lang.text.StrLookup".
The "mapLookup" method provided by "org.apache.commons.lang3.text.StrLookup" returns StrLookup<V>. https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/text/StrLookup.html
and is not suitable for getEmail method.
I looked into org.apache.commons.text.lookup.StringLookupFactory as well but there is no method which just returns StrLookup.
Is there any alternative ? What can be used here ? Please suggest.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @vikalps98363233 ,
AFAIK, no updates have been made to https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/commons/ma... to adapt to it.
You may have to keep using this "org.apache.commons.lang.text" only. Also, please raise a support ticket so that if similar cases exist this can be reported.
Regards,
Nitesh
Hi @vikalps98363233 ,
AFAIK, no updates have been made to https://developer.adobe.com/experience-manager/reference-materials/6-5/javadoc/com/day/cq/commons/ma... to adapt to it.
You may have to keep using this "org.apache.commons.lang.text" only. Also, please raise a support ticket so that if similar cases exist this can be reported.
Regards,
Nitesh
Hi @vikalps98363233,
https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/text/StrLookup.html
Deprecated.
as of 3.6, use commons-text StringLookupFactory instead
What about mapStringLookup?
Thanks,
Ram
Views
Likes
Replies
Views
Likes
Replies