Merge "Switch from config-parent in pom files"
[netconf.git] / restconf / sal-rest-docgen / src / main / java / org / opendaylight / netconf / sal / rest / doc / impl / ApiDocServiceImpl.java
index ea70f2655170981a9ffa084765595ef312beb3e8..f5002e03714f36dce76c32778202972b3a2965b8 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.netconf.sal.rest.doc.impl;
 
+import com.fasterxml.jackson.core.JsonFactory;
+import com.fasterxml.jackson.core.JsonGenerator;
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStreamWriter;
 import java.nio.charset.StandardCharsets;
 import java.util.Map.Entry;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriInfo;
-import org.json.JSONWriter;
 import org.opendaylight.netconf.sal.rest.doc.api.ApiDocService;
 import org.opendaylight.netconf.sal.rest.doc.mountpoints.MountPointSwagger;
 import org.opendaylight.netconf.sal.rest.doc.swagger.ApiDeclaration;
@@ -81,20 +82,21 @@ public class ApiDocServiceImpl implements ApiDocService {
         return Response.seeOther(uriInfo.getBaseUriBuilder().path("../explorer/index.html").build()).build();
     }
 
+    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public synchronized Response getListOfMounts(final UriInfo uriInfo) {
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try (OutputStreamWriter streamWriter = new OutputStreamWriter(baos, StandardCharsets.UTF_8)) {
-            final JSONWriter writer = new JSONWriter(streamWriter);
-            writer.array();
+            JsonGenerator writer = new JsonFactory().createGenerator(streamWriter);
+            writer.writeStartArray();
             for (final Entry<String, Long> entry : MountPointSwagger.getInstance().getInstanceIdentifiers()
                     .entrySet()) {
-                writer.object();
-                writer.key("instance").value(entry.getKey());
-                writer.key("id").value(entry.getValue());
-                writer.endObject();
+                writer.writeStartObject();
+                writer.writeObjectField("instance", entry.getKey());
+                writer.writeObjectField("id", entry.getValue());
+                writer.writeEndObject();
             }
-            writer.endArray();
+            writer.writeEndArray();
         } catch (final Exception e) {
             return Response.status(500).entity(e.getMessage()).build();
         }