Fixed handling JSON mapping exception.

Change-Id: Ic0d3f9253316ab85d3d55b43fd419784223dfbf9


Change-Id: Ic0d3f9253316ab85d3d55b43fd419784223dfbf9
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/utils/JsonExceptionMapper.java b/core/src/main/java/de/ids_mannheim/korap/web/utils/JsonExceptionMapper.java
new file mode 100644
index 0000000..1136dd1
--- /dev/null
+++ b/core/src/main/java/de/ids_mannheim/korap/web/utils/JsonExceptionMapper.java
@@ -0,0 +1,28 @@
+package de.ids_mannheim.korap.web.utils;
+
+import javax.annotation.Priority;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+import com.fasterxml.jackson.databind.JsonMappingException;
+
+import de.ids_mannheim.korap.exceptions.StatusCodes;
+import de.ids_mannheim.korap.web.CoreResponseHandler;
+
+@Priority(value=1)
+@Provider
+public class JsonExceptionMapper
+        implements ExceptionMapper<JsonMappingException> {
+
+
+    @Override
+    public Response toResponse (JsonMappingException exception) {
+        String entity = CoreResponseHandler.buildNotification(
+                StatusCodes.DESERIALIZATION_FAILED, exception.getMessage(),
+                null);
+        return Response.status(Response.Status.BAD_REQUEST).entity(entity)
+                .build();
+    }
+
+}
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/AnnotationConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/AnnotationConverter.java
index 0e6cf13..c049c2a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/AnnotationConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/AnnotationConverter.java
@@ -5,7 +5,7 @@
 import java.util.List;
 import java.util.Map;
 
-import org.springframework.stereotype.Service;
+import org.springframework.stereotype.Component;
 
 import de.ids_mannheim.korap.dto.FoundryDto;
 import de.ids_mannheim.korap.dto.FoundryDto.Layer;
@@ -21,7 +21,7 @@
  * @author margaretha
  *
  */
-@Service
+@Component
 public class AnnotationConverter {
 
     /**
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/ResourceConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/ResourceConverter.java
index 8e22249..03f00b3 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/ResourceConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/ResourceConverter.java
@@ -5,13 +5,13 @@
 import java.util.List;
 import java.util.Map;
 
-import org.springframework.stereotype.Service;
+import org.springframework.stereotype.Component;
 
 import de.ids_mannheim.korap.dto.ResourceDto;
 import de.ids_mannheim.korap.entity.AnnotationPair;
 import de.ids_mannheim.korap.entity.Resource;
 
-@Service
+@Component
 public class ResourceConverter {
 
     public List<ResourceDto> convertToResourcesDto (List<Resource> resources) {
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
index de8b46a..8925d20 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/UserGroupConverter.java
@@ -3,7 +3,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.springframework.stereotype.Service;
+import org.springframework.stereotype.Component;
 
 import de.ids_mannheim.korap.dto.UserGroupDto;
 import de.ids_mannheim.korap.dto.UserGroupMemberDto;
@@ -11,7 +11,7 @@
 import de.ids_mannheim.korap.entity.UserGroup;
 import de.ids_mannheim.korap.entity.UserGroupMember;
 
-@Service
+@Component
 public class UserGroupConverter {
 
     public UserGroupDto createUserGroupDto (UserGroup group,
diff --git a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
index c4920e8..8aa7a6e 100644
--- a/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/dto/converter/VirtualCorpusConverter.java
@@ -1,6 +1,6 @@
 package de.ids_mannheim.korap.dto.converter;
 
-import org.springframework.stereotype.Service;
+import org.springframework.stereotype.Component;
 
 import com.fasterxml.jackson.databind.JsonNode;
 
@@ -9,7 +9,7 @@
 import de.ids_mannheim.korap.exceptions.KustvaktException;
 import de.ids_mannheim.korap.utils.JsonUtils;
 
-@Service
+@Component
 public class VirtualCorpusConverter {
 
     public VirtualCorpusDto createVirtualCorpusDto (VirtualCorpus vc,
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
index 8f51287..e625414 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
@@ -22,20 +22,19 @@
 
 import de.ids_mannheim.korap.dto.UserGroupDto;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.service.UserGroupService;
 import de.ids_mannheim.korap.user.TokenContext;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.web.FullResponseHandler;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
-import de.ids_mannheim.korap.web.filter.DemoUserFilter;
+import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
 import de.ids_mannheim.korap.web.input.UserGroupJson;
 
 @Controller
 @Path("group")
 @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-@ResourceFilters({ AuthenticationFilter.class, DemoUserFilter.class,
+@ResourceFilters({ AuthenticationFilter.class, BlockingFilter.class,
         PiwikFilter.class })
 public class UserGroupController {
 
@@ -50,25 +49,17 @@
     @GET
     @Path("list")
     public Response getUserGroup (@Context SecurityContext securityContext) {
-        String result;
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
-            if (context.isDemo()) {
-                throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                        "Operation is not permitted for user: "
-                                + context.getUsername(),
-                        context.getUsername());
-            }
-
             List<UserGroupDto> dtos =
                     service.retrieveUserGroup(context.getUsername());
-            result = JsonUtils.toJSON(dtos);
+            String result = JsonUtils.toJSON(dtos);
+            return Response.ok(result).build();
         }
         catch (KustvaktException e) {
             throw responseHandler.throwit(e);
         }
-        return Response.ok(result).build();
     }
 
 
@@ -99,19 +90,12 @@
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
-            if (context.isDemo()) {
-                throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                        "Operation is not permitted for user: "
-                                + context.getUsername(),
-                        context.getUsername());
-            }
-
             service.createUserGroup(group, context.getUsername());
+            return Response.ok().build();
         }
         catch (KustvaktException e) {
             throw responseHandler.throwit(e);
         }
-        return Response.ok().build();
     }
 
 
@@ -123,19 +107,12 @@
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
-            if (context.isDemo()) {
-                throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                        "Operation is not permitted for user: "
-                                + context.getUsername(),
-                        context.getUsername());
-            }
-
             service.subscribe(groupId, context.getUsername());
+            return Response.ok().build();
         }
         catch (KustvaktException e) {
             throw responseHandler.throwit(e);
         }
-        return Response.ok().build();
     }
 
     @POST
@@ -147,18 +124,11 @@
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
-            if (context.isDemo()) {
-                throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                        "Operation is not permitted for user: "
-                                + context.getUsername(),
-                        context.getUsername());
-            }
-
             service.unsubscribe(groupId, context.getUsername());
+            return Response.ok().build();
         }
         catch (KustvaktException e) {
             throw responseHandler.throwit(e);
         }
-        return Response.ok().build();
     }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
index f6b460c..5f193c6 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
@@ -23,20 +23,19 @@
 
 import de.ids_mannheim.korap.dto.VirtualCorpusDto;
 import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.exceptions.StatusCodes;
 import de.ids_mannheim.korap.service.VirtualCorpusService;
 import de.ids_mannheim.korap.user.TokenContext;
 import de.ids_mannheim.korap.utils.JsonUtils;
 import de.ids_mannheim.korap.web.FullResponseHandler;
 import de.ids_mannheim.korap.web.filter.AuthenticationFilter;
-import de.ids_mannheim.korap.web.filter.DemoUserFilter;
+import de.ids_mannheim.korap.web.filter.BlockingFilter;
 import de.ids_mannheim.korap.web.filter.PiwikFilter;
 import de.ids_mannheim.korap.web.input.VirtualCorpusJson;
 
 @Controller
 @Path("vc")
 @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-@ResourceFilters({ AuthenticationFilter.class, DemoUserFilter.class,
+@ResourceFilters({ AuthenticationFilter.class, BlockingFilter.class,
         PiwikFilter.class })
 public class VirtualCorpusController {
 
@@ -59,12 +58,6 @@
             // get user info
             TokenContext context =
                     (TokenContext) securityContext.getUserPrincipal();
-            if (context.isDemo()) {
-                throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                        "Operation is not permitted for user: "
-                                + context.getUsername(),
-                        context.getUsername());
-            }
 
             service.storeVC(vc, context.getUsername());
         }
@@ -82,13 +75,6 @@
         TokenContext context =
                 (TokenContext) securityContext.getUserPrincipal();
         try {
-            if (context.isDemo()) {
-                throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                        "Operation is not permitted for user: "
-                                + context.getUsername(),
-                        context.getUsername());
-            }
-
             List<VirtualCorpusDto> dtos =
                     service.retrieveUserVC(context.getUsername());
             result = JsonUtils.toJSON(dtos);
@@ -127,15 +113,9 @@
     @Path("delete")
     public Response deleteVC (@Context SecurityContext securityContext,
             @QueryParam("vcId") int vcId) {
+        TokenContext context =
+                (TokenContext) securityContext.getUserPrincipal();
         try {
-            TokenContext context =
-                    (TokenContext) securityContext.getUserPrincipal();
-            if (context.isDemo()) {
-                throw new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                        "Operation is not permitted for user: "
-                                + context.getUsername(),
-                        context.getUsername());
-            }
             service.deleteVC(context.getUsername(), vcId);
         }
         catch (KustvaktException e) {
@@ -143,7 +123,4 @@
         }
         return Response.ok().build();
     }
-    
-    
-
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java b/full/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
index 6dc2bc2..758baf8 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/filter/BlockingFilter.java
@@ -42,11 +42,9 @@
         }
 
         if (context == null || context.isDemo()) {
-            throw kustvaktResponseHandler.throwit(
-                    new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                            "Operation is not permitted for user: "
-                                    + context.getUsername(),
-                            context.getUsername()));
+            throw kustvaktResponseHandler.throwit(new KustvaktException(
+                    StatusCodes.AUTHORIZATION_FAILED,
+                    "Operation is not permitted for user: guest", "guest"));
         }
 
 
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/filter/NonDemoBlockingFilter.java b/full/src/main/java/de/ids_mannheim/korap/web/filter/NonDemoBlockingFilter.java
index 004d796..3efa619 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/filter/NonDemoBlockingFilter.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/filter/NonDemoBlockingFilter.java
@@ -16,6 +16,8 @@
 import de.ids_mannheim.korap.web.FullResponseHandler;
 
 /**
+ * EM: pretty much identical to {@link BlockingFilter}, should be deleted? 
+ * 
  * @author hanl
  * @date 11/12/2014
  *       <p/>
@@ -42,8 +44,9 @@
         }
 
         if (context == null || context.isDemo()) {
-            new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
-                    "Operation is not permitted for guest users");
+            throw kustvaktResponseHandler.throwit(
+                    new KustvaktException(StatusCodes.AUTHORIZATION_FAILED,
+                            "Operation is not permitted for guest users"));
         }
         return request;
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
index d2b7d95..98828da 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
@@ -208,7 +208,7 @@
         assertTrue(handler.add(FoundryInject.class));
         String result = handler.processQuery(s.toJSON(), null);
         JsonNode node = JsonUtils.readTree(result);
-        System.out.println("NODDE "+ node);
+//        System.out.println("NODDE "+ node);
         assertNotNull(node);
         assertEquals("koral:termGroup", node.at("/query/wrap/@type").asText());
         assertFalse(node.at("/query/wrap/operands/0/foundry")
@@ -229,7 +229,7 @@
         assertTrue(handler.add(FoundryInject.class));
         String result = handler.processQuery(s.toJSON(), null);
         JsonNode node = JsonUtils.readTree(result);
-        System.out.println("NODDE "+ node);
+//        System.out.println("NODDE "+ node);
         assertNotNull(node);
         assertEquals("koral:termGroup", node.at("/query/wrap/@type").asText());
         assertFalse(node.at("/query/wrap/operands/0/operands/0/foundry")
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
index f5ddb0d..c1a187e 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
@@ -1,5 +1,7 @@
 package de.ids_mannheim.korap.web.service;
 
+import java.util.concurrent.ThreadLocalRandom;
+
 import org.junit.Before;
 
 import de.ids_mannheim.korap.config.ContextHolder;
@@ -44,7 +46,8 @@
     @Before
     public void startServerBeforeFirstTestRun () {
         if (testContainer == null) {
-            initServer(PORT, classPackages);
+            int port = ThreadLocalRandom.current().nextInt(5000, 8000 + 1);
+            initServer(port, classPackages);
             startServer();
         }
     }
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
index 60e36ef..ec5657e 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
@@ -249,7 +249,7 @@
                 response.getStatus());
 
         String ent = response.getEntity(String.class);
-        System.out.println(ent);
+//        System.out.println(ent);
         JsonNode node = JsonUtils.readTree(ent);
         assertEquals(402, node.at("/errors/0/0").asInt());
         assertEquals("Unsupported operation for the given resource type.",
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
index 376bcfb..0ede615 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/SearchServiceTest.java
@@ -58,7 +58,7 @@
 //        assertEquals(ClientResponse.Status.OK.getStatusCode(),
 //                response.getStatus());
         String ent = response.getEntity(String.class);
-        System.out.println(ent);
+//        System.out.println(ent);
         JsonNode node = JsonUtils.readTree(ent);
         assertNotNull(node);
         assertEquals("koral:doc", node.at("/collection/@type").asText());
@@ -468,7 +468,7 @@
         s.setCollection("corpusSigle=GOE");
 
         s.setQuery("Wasser", "poliqarp");
-        System.out.println(s.toJSON());
+//        System.out.println(s.toJSON());
         ClientResponse response = resource()
                 .path("search").post(ClientResponse.class, s.toJSON());
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
index 64f7c35..4dd4fb9 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/StatisticsServiceTest.java
@@ -130,7 +130,7 @@
         assertEquals(ClientResponse.Status.BAD_REQUEST.getStatusCode(),
                 response.getStatus());
         String ent = response.getEntity(String.class);
-        System.out.println(ent);
+//        System.out.println(ent);
         JsonNode node = mapper.readTree(ent);
         assertEquals(node.at("/errors/0/0").asInt(), 105);
         assertEquals(node.at("/errors/0/1").asText(),
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserGroupServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserGroupServiceTest.java
index a0db38b..7f1d390 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserGroupServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/UserGroupServiceTest.java
@@ -89,7 +89,7 @@
                 .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
                 .get(ClientResponse.class);
         String entity = response.getEntity(String.class);
-        //        System.out.println(entity);
+//                System.out.println(entity);
         JsonNode node = JsonUtils.readTree(entity);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
diff --git a/full/src/test/java/de/ids_mannheim/korap/web/service/full/VirtualCorpusServiceTest.java b/full/src/test/java/de/ids_mannheim/korap/web/service/full/VirtualCorpusServiceTest.java
index b487099..e467180 100644
--- a/full/src/test/java/de/ids_mannheim/korap/web/service/full/VirtualCorpusServiceTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/web/service/full/VirtualCorpusServiceTest.java
@@ -35,7 +35,7 @@
 
     @Autowired
     private HttpAuthorizationHandler handler;
-    
+
     private void checkWWWAuthenticateHeader (ClientResponse response) {
         Set<Entry<String, List<String>>> headers =
                 response.getHeaders().entrySet();
@@ -87,7 +87,7 @@
                 node.at("/errors/0/0").asInt());
         assertEquals("Operation is not permitted for user: guest",
                 node.at("/errors/0/1").asText());
-        
+
         checkWWWAuthenticateHeader(response);
     }
 
@@ -105,7 +105,7 @@
                 .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
                 .post(ClientResponse.class, json);
         String entity = response.getEntity(String.class);
-        System.out.println(entity);
+//        System.out.println(entity);
         assertEquals(Status.OK.getStatusCode(), response.getStatus());
 
         // retrieve user VC
@@ -168,8 +168,9 @@
                 .header(Attributes.AUTHORIZATION,
                         AuthenticationScheme.API.displayName() + " "
                                 + authToken)
-                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32").entity(json)
-                .post(ClientResponse.class);
+                .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
+                .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
+                .entity(json).post(ClientResponse.class);
         String entity = response.getEntity(String.class);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -178,7 +179,7 @@
         assertEquals(StatusCodes.EXPIRED, node.at("/errors/0/0").asInt());
         assertEquals("Authentication token is expired",
                 node.at("/errors/0/1").asText());
-        
+
         checkWWWAuthenticateHeader(response);
     }
 
@@ -189,6 +190,7 @@
                         + "\"test class\",\"collectionQuery\": \"pubDate eq 1982\"}";
 
         ClientResponse response = resource().path("vc").path("store")
+                .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
                 .entity(json).post(ClientResponse.class);
 
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
@@ -199,7 +201,7 @@
                 node.at("/errors/0/0").asInt());
         assertEquals("Operation is not permitted for user: guest",
                 node.at("/errors/0/1").asText());
-        
+
         checkWWWAuthenticateHeader(response);
     }
 
@@ -210,9 +212,13 @@
                         + "\"test class\",\"collectionQuery\": \"pubDate eq 1982\"}";
 
         ClientResponse response = resource().path("vc").path("store")
+                .header(Attributes.AUTHORIZATION,
+                        handler.createBasicAuthorizationHeaderValue(
+                                "test class", "pass"))
+                .header(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON)
                 .entity(json).post(ClientResponse.class);
         String entity = response.getEntity(String.class);
-        //        System.out.println(entity);
+//        System.out.println(entity);
         assertEquals(Status.BAD_REQUEST.getStatusCode(), response.getStatus());
 
         JsonNode node = JsonUtils.readTree(entity);
@@ -234,16 +240,16 @@
                         .header(HttpHeaders.X_FORWARDED_FOR, "149.27.0.32")
 
                         .delete(ClientResponse.class);
-        
+
         String entity = response.getEntity(String.class);
         JsonNode node = JsonUtils.readTree(entity);
-        
+
         assertEquals(Status.UNAUTHORIZED.getStatusCode(), response.getStatus());
         assertEquals(StatusCodes.AUTHORIZATION_FAILED,
                 node.at("/errors/0/0").asInt());
         assertEquals("Unauthorized operation for user: test class",
                 node.at("/errors/0/1").asText());
-        
+
         checkWWWAuthenticateHeader(response);
     }
 }
diff --git a/lite/src/test/java/de/ids_mannheim/korap/web/service/LightServiceTest.java b/lite/src/test/java/de/ids_mannheim/korap/web/service/LightServiceTest.java
index 99312ec..39213a7 100644
--- a/lite/src/test/java/de/ids_mannheim/korap/web/service/LightServiceTest.java
+++ b/lite/src/test/java/de/ids_mannheim/korap/web/service/LightServiceTest.java
@@ -55,7 +55,7 @@
         assertEquals(ClientResponse.Status.OK.getStatusCode(),
                 response.getStatus());
         String query = response.getEntity(String.class);
-        System.out.println(query);
+//        System.out.println(query);
         JsonNode node = JsonUtils.readTree(query);
         assertNotNull(node);
         assertEquals("orth", node.at("/query/wrap/layer").asText());