/**
  * Gets a service descriptor by ID, returning null if no such service exists.
  *
  * @param serviceId the service ID.
  * @return the service descriptor, or null.
  */
 private ServiceDescriptor getServiceDescriptor(String serviceId) {
   try {
     return serviceDescriptors.getDescriptor(Locale.getDefault(), serviceId);
   } catch (IllegalStateException e) {
     return null;
   }
 }
 /**
  * Gets the map of service descriptors by service ID->descriptor.
  *
  * @return the service descriptor mapping.
  */
 private Map<String, ServiceDescriptor> getServiceDescriptors() {
   Map<String, ServiceDescriptor> descriptors = new HashMap<>();
   for (ServiceDescriptor descriptor : serviceDescriptors.listDescriptors(Locale.getDefault())) {
     descriptors.put(descriptor.getServiceId(), descriptor);
   }
   return descriptors;
 }
  public ServiceDescriptor getServiceDescriptor(String serviceId) {

    if (serviceId == null) {
      return null;
    }

    return serviceDescriptors.getDescriptor(Locale.getDefault(), serviceId);
  }