Do not use WebApplicationException to report 204
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / RestconfInvokeOperationsServiceImpl.java
index 660a5b8a69fc073672fa8e6853f9138f2f11d8c1..cbd309685573490555203d39dd176db939bad968 100644 (file)
@@ -23,12 +23,11 @@ import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.container.AsyncResponse;
 import javax.ws.rs.container.Suspended;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.dom.api.DOMMountPoint;
@@ -184,9 +183,9 @@ public final class RestconfInvokeOperationsServiceImpl {
 
                 final ContainerNode resultData = response.value();
                 if (resultData == null || resultData.isEmpty()) {
-                    ar.resume(new WebApplicationException(Status.NO_CONTENT));
+                    ar.resume(Response.noContent().build());
                 } else {
-                    ar.resume(new NormalizedNodePayload(context.inference(), resultData));
+                    ar.resume(Response.ok().entity(new NormalizedNodePayload(context.inference(), resultData)).build());
                 }
             }