diff --git a/core/src/main/java/org/fourthline/cling/model/meta/Service.java b/core/src/main/java/org/fourthline/cling/model/meta/Service.java index a7be218b7..7b2f0a53a 100644 --- a/core/src/main/java/org/fourthline/cling/model/meta/Service.java +++ b/core/src/main/java/org/fourthline/cling/model/meta/Service.java @@ -15,6 +15,12 @@ package org.fourthline.cling.model.meta; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + import org.fourthline.cling.model.ServiceReference; import org.fourthline.cling.model.ValidationError; import org.fourthline.cling.model.ValidationException; @@ -22,11 +28,6 @@ import org.fourthline.cling.model.types.ServiceId; import org.fourthline.cling.model.types.ServiceType; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * The metadata of a service, with actions and state variables. * @@ -34,6 +35,8 @@ */ public abstract class Service { + final private static Logger log = Logger.getLogger(Service.class.getName()); + final private ServiceType serviceType; final private ServiceId serviceId; @@ -110,7 +113,7 @@ public Action getAction(String name) { } public StateVariable getStateVariable(String name) { - // Some magic necessary for the deprected 'query state variable' action stuff + // Some magic necessary for the deprecated 'query state variable' action stuff if (QueryStateVariableAction.VIRTUAL_STATEVARIABLE_INPUT.equals(name)) { return new StateVariable( QueryStateVariableAction.VIRTUAL_STATEVARIABLE_INPUT, @@ -178,7 +181,18 @@ public List validate() { if (hasActions()) { for (Action action : getActions()) { - errors.addAll(action.validate()); + + // Instead of bailing out here, we try to continue if an action is invalid + // errors.addAll(action.validate()); + + List actionErrors = action.validate(); + if(actionErrors.size() > 0) { + actions.remove(action.getName()); // Remove it + log.warning("Discarding invalid action of service '" + getServiceId() + "': " + action.getName()); + for (ValidationError actionError : actionErrors) { + log.warning("Invalid action '" + action.getName() + "': " + actionError); + } + } } }