Buggy code:
public class PropertiesUtil { protected static final List osgiProperties = Arrays . asList ( new String [ ] { Constants . OBJECTCLASS , Constants . SERVICE_ID , RemoteConstants . ENDPOINT_FRAMEWORK_UUID , RemoteConstants . ENDPOINT_ID , RemoteConstants . ENDPOINT_SERVICE_ID , RemoteConstants . REMOTE_CONFIGS_SUPPORTED , RemoteConstants . REMOTE_INTENTS_SUPPORTED , RemoteConstants . SERVICE_EXPORTED_CONFIGS , RemoteConstants . SERVICE_EXPORTED_INTENTS , RemoteConstants . SERVICE_EXPORTED_INTENTS_EXTRA , RemoteConstants . SERVICE_EXPORTED_INTERFACES , RemoteConstants . SERVICE_IMPORTED , RemoteConstants . SERVICE_IMPORTED_CONFIGS , RemoteConstants . SERVICE_INTENTS } ) ; protected static final List ecfProperties = Arrays . asList ( new String [ ] { RemoteConstants . DISCOVERY_DEFAULT_SERVICE_NAME_PREFIX , RemoteConstants . DISCOVERY_NAMING_AUTHORITY , RemoteConstants . DISCOVERY_PROTOCOLS , RemoteConstants . DISCOVERY_SCOPE , RemoteConstants . DISCOVERY_SERVICE_NAME , RemoteConstants . ENDPOINT_CONNECTTARGET_ID , RemoteConstants . ENDPOINT_CONTAINER_ID_NAMESPACE , RemoteConstants . ENDPOINT_IDFILTER_IDS , RemoteConstants . ENDPOINT_REMOTESERVICE_FILTER , RemoteConstants . ENDPOINT_SERVICE_IMPORTED_CONFIGS_VALUE , RemoteConstants . SERVICE_EXPORTED_CONTAINER_CONNECT_CONTEXT , RemoteConstants . SERVICE_EXPORTED_CONTAINER_FACTORY_ARGS , RemoteConstants . SERVICE_EXPORTED_CONTAINER_ID , RemoteConstants . SERVICE_TYPE } ) ; public static String verifyStringProperty ( Map properties , String propName ) { } public static Object convertToStringPlusValue ( List < String > values ) { } public static String [ ] getStringArrayFromPropertyValue ( Object value ) { } public static String [ ] getExportedInterfaces ( ServiceReference serviceReference ) { } public static String [ ] getServiceIntents ( ServiceReference serviceReference ) { List results = new ArrayList ( ) ; String [ ] intents = PropertiesUtil . getStringArrayFromPropertyValue ( serviceReference . getProperty ( SERVICE_INTENTS ) ) ; if ( intents != null ) results . addAll ( Arrays . asList ( intents ) ) ; String [ ] exportedIntents = PropertiesUtil . getStringArrayFromPropertyValue ( serviceReference . getProperty ( SERVICE_EXPORTED_INTENTS ) ) ; if ( exportedIntents != null ) results . addAll ( Arrays . asList ( exportedIntents ) ) ; String [ ] extraIntents = PropertiesUtil . getStringArrayFromPropertyValue ( serviceReference . getProperty ( SERVICE_EXPORTED_INTENTS_EXTRA ) ) ; if ( extraIntents != null ) results . addAll ( Arrays . asList ( extraIntents ) ) ; if ( ( results . size ( ) ) == 0 ) return null ; <START_BUG> return ( ( String [ ] ) ( results . toArray ( new String [ ] { } ) ) ) ; <END_BUG> } public static List getStringPlusProperty ( Map properties , String key ) { } public static Object getPropertyValue ( ServiceReference serviceReference , String key ) { } public static Object getPropertyValue ( ServiceReference serviceReference , Map < String , Object > overridingProperties , String key ) { } public static boolean isOSGiProperty ( String key ) { } public static boolean isECFProperty ( String key ) { } public static boolean isReservedProperty ( String key ) { } public static Map createMapFromDictionary ( Dictionary input ) { } public static Dictionary createDictionaryFromMap ( Map propMap ) { } public static Long getLongWithDefault ( Map props , String key , Long def ) { } public static String [ ] getStringArrayWithDefault ( Map < String , Object > properties , String key , String [ ] def ) { } public static String getStringWithDefault ( Map props , String key , String def ) { } public static Map < String , Object > copyProperties ( IRemoteServiceRegistration rsRegistration , Map < String , Object > target ) { } public static Map < String , Object > copyProperties ( Map < String , Object > source , Map < String , Object > target ) { } public static Map < String , Object > copyNonECFProperties ( Map < String , Object > source , Map < String , Object > target ) { } public static Map < String , Object > copyNonReservedProperties ( Map < String , Object > source , Map < String , Object > target ) { } public static Map < String , Object > copyNonECFProperties ( ServiceReference serviceReference , Map < String , Object > target ) { } public static Map < String , Object > copyNonReservedProperties ( ServiceReference serviceReference , Map < String , Object > target ) { } public static Map < String , Object > copyNonReservedProperties ( IRemoteServiceReference rsReference , Map < String , Object > target ) { } }

Fix:
return ( ( String [ ] ) ( results . toArray ( new String [ results . size ( ) ] ) ) ) ;