RE: read values from portlet.properties file

Jamie Sammons, modified 3 Years ago. New Member Posts: 17 Join Date: 12/17/15 Recent Posts

Hi

I was able to read values from portlet.properties file defined in custom portlet by using the code 
 Configuration configuration = ConfigurationFactoryUtil.getConfiguration(PortalClassLoaderUtil.getClassLoader(), "portlet");
System.out.println("value is"+configuration.get("xxxx"));

where xxxx is varaiable deined in portlet.properties file.

This code is working until 7.4 ga54. But from 7.4 ga55 configuration intialization is giving a null pointer exception and i am not able to read values from portlet.propeties file. Is this a bug or is there any other way to read values from portlet.properties file?

thumbnail
Jamie Sammons, modified 3 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

You can use com.liferay.portal.kernel.util.PropsUtil's get Property("name.of.the.property") method (extra space as we're currently fixing the over-eager firewall blocking some content)