Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Deprecated class org.apache.sling.commons.osgi.OsgiUtil

Avatar

Level 3

Hello,

 

the class org.apache.sling.commons.osgi.OsgiUtil is deprected. But which class should I use instead of OsgiUtil?

 

regards

Reini

1 Accepted Solution

Avatar

Correct answer by
Level 2

Hi Reinhard:

You can use PropertiesUtil and ServiceUtil that contain all methods that are now deprecated in OsgiUtil. Both are located in the org.apache.sling.commons.osgi package.

E.g.:

The call to OsgiUtil:

String myProperty = OsgiUtil.toString(propValue, defaultValue);

...can be simply replaced with:

String myProperty = PropertiesUtil.toString(propValue, defaultValue);

 

Hope this helps,

Gregor

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

Hi Reinhard:

You can use PropertiesUtil and ServiceUtil that contain all methods that are now deprecated in OsgiUtil. Both are located in the org.apache.sling.commons.osgi package.

E.g.:

The call to OsgiUtil:

String myProperty = OsgiUtil.toString(propValue, defaultValue);

...can be simply replaced with:

String myProperty = PropertiesUtil.toString(propValue, defaultValue);

 

Hope this helps,

Gregor