RestconfDocumentedExceptionMapper not returning json 83/72583/1
authorTom Pantelis <tompantelis@gmail.com>
Fri, 1 Jun 2018 20:16:47 +0000 (16:16 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Fri, 1 Jun 2018 20:16:47 +0000 (16:16 -0400)
The media types returned from HttpHeaders returns wildcard type "/"
which we were incorrectly filtering out. So it was defaulting to
xml instead of json.

Change-Id: I2f64840ca4bbc48651c2a8bbe72fdbbc666024a2
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java

index b4b2890954284b42da9d46bbeda7192f9cbaeabb..aa6b7c0b697b80a8e4d7dd9371e29fa91aa05729 100644 (file)
@@ -100,7 +100,8 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
         LOG.debug("In toResponse: {}", exception.getMessage());
 
         final MediaType mediaType = headers.getAcceptableMediaTypes().stream()
-                .filter(type -> type != MediaType.WILDCARD_TYPE).findFirst().orElse(MediaType.APPLICATION_JSON_TYPE);
+                .filter(type -> !type.equals(MediaType.WILDCARD_TYPE)).findFirst()
+                        .orElse(MediaType.APPLICATION_JSON_TYPE);
 
         LOG.debug("Using MediaType: {}", mediaType);