Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Patrick M
Getting Custom User Attributes (sometimes) returns null
May 2, 2011 7:37 AM
Answer

Patrick M

Rank: New Member

Posts: 16

Join Date: May 15, 2009

Recent Posts

Hallo!

I extended the liferay user by adding a custom attribute "test" which is an indexed textfield.

My portlet simply contains a button. When I click on it a servlet (behind the delegate servlet) is invoked which prints the attribute to the System.out. To access the custom attribute I use the following code:

String key = "test";
User user = user = PortalUtil.getUser(request);
Object result = user.getExpandoBridge().getAttribute(key);
System.out.println("Custom attribute: " + result);


The strange thing: sometimes it works, sometimes the result is null. By sometimes I mean: clicking the button -> works, again -> works again, anothertime -> null.

Any idea what could cause this problem?
Christian Knoop
RE: Getting Custom User Attributes (sometimes) returns null
August 28, 2012 4:46 AM
Answer

Christian Knoop

Rank: New Member

Posts: 3

Join Date: August 28, 2012

Recent Posts

/push

Same Problem. Running Liferay 5.2.3 in a JBoss 6.0.
Hitoshi Ozawa
RE: Getting Custom User Attributes (sometimes) returns null
August 28, 2012 4:52 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Probably a bug in Liferay 5 that was resolved in Liferay 6.
Christian Knoop
RE: Getting Custom User Attributes (sometimes) returns null
August 28, 2012 5:20 AM
Answer

Christian Knoop

Rank: New Member

Posts: 3

Join Date: August 28, 2012

Recent Posts

Hitoshi Ozawa:
Probably a bug in Liferay 5 that was resolved in Liferay 6.


Thank you for the fast answer! Do you have probably an idea how to fix this issue without updating Liferay?
Hitoshi Ozawa
RE: Getting Custom User Attributes (sometimes) returns null
August 28, 2012 5:33 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

Sorry no. The standard way to fix CE bugs is to upgrade.