Fórum

Set variable not working

andres digiovanni, modificado 11 Anos atrás.

Set variable not working

New Member Postagens: 14 Data de Entrada: 18/09/12 Postagens Recentes
Hi,

I'm trying to set a variable with the value of a method. But it doesn't work. I get this error:

java.lang.NullPointerException

#set ($assetLinkLocalService = $serviceLocator.findService("com.liferay.portlet.asset.service.AssetLinkLocalService"))
#set ($assetlinks = $assetLinkLocalService.getDirectLinks( $ae.getEntryId() ))

#set ($siz = $assetlinks.size())


But if I use this code, it print the correct value:

#set ($assetLinkLocalService = $serviceLocator.findService("com.liferay.portlet.asset.service.AssetLinkLocalService"))
#set ($assetlinks = $assetLinkLocalService.getDirectLinks( $ae.getEntryId() ))

$assetlinks.size()


Why I can't set a variable with the value?
I'm using a template web content.

Regards,
Andrés