Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jatin Puri
com.liferay.portal.LayoutFriendlyURLException
October 15, 2012 3:32 AM
Answer

Jatin Puri

Rank: New Member

Posts: 19

Join Date: July 12, 2012

Recent Posts

Hey,

This exception occurs when i am dynamically trying to add a page using the code below .I am trying to add from inside a portlet.

public void init() {
ServiceContext serviceContext = new ServiceContext();
serviceContext.setUserId(14303);
long UserId = serviceContext.getUserId();
System.out.println(a);
long GroupId = 10157;

long c= 0;
try {
LayoutLocalServiceUtil.addLayout(UserId,GroupId,false,c, "<?xml version='1.0' encoding='UTF-8'?><root available-locales='en_US' default-locale='en_US'><name language-id='en_US'>Page6s</name></root>", "", "", "portlet", false, "/Page6", 0,serviceContext);

} catch (PortalException e) {
com.liferay.portal.LayoutFriendlyURLException f = (com.liferay.portal.LayoutFriendlyURLException)e;
System.out.println(f.getType());
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}



Exception type is 6 which is Keyword conflict.

How to rectify this






}
Bart Simpson
RE: com.liferay.portal.LayoutFriendlyURLException
October 15, 2012 5:41 AM
Answer

Bart Simpson

Rank: Liferay Master

Posts: 524

Join Date: August 29, 2011

Recent Posts

Could you give it a try by changing
1 "/Page6"
to just
1 "page6"
or
1"/page6"

Also before passing this value try and get it normalized via
1String com.liferay.portal.kernel.util.FriendlyURLNormalizerUtil.normalize(String friendlyURL)