import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.dom.api.DOMActionResult;
import org.opendaylight.yangtools.concepts.Immutable;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
@Beta
this.output = output;
}
+ public SimpleDOMActionResult(final ContainerNode output) {
+ errors = ImmutableList.of();
+ this.output = requireNonNull(output);
+ }
+
@SuppressFBWarnings("NP_NULL_PARAM_DEREF_NONVIRTUAL")
public SimpleDOMActionResult(final Collection<RpcError> errors) {
this(errors, null);
this(errors, requireNonNull(output));
}
+ // As per RFC7950 page 80 (top)
+ public static SimpleDOMActionResult ofMalformedMessage(final Exception cause) {
+ return new SimpleDOMActionResult(ImmutableList.of(RpcResultBuilder.newError(ErrorType.RPC,
+ ErrorTag.MALFORMED_MESSAGE, cause.getMessage(), null, null, requireNonNull(cause))), null);
+ }
+
@Override
public Collection<RpcError> getErrors() {
return errors;
}
return helper.toString();
}
-}
\ No newline at end of file
+}