← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15633: removed unused exception

 

------------------------------------------------------------
revno: 15633
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-06-11 21:13:57 +0200
message:
  removed unused exception
removed:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/exception/NotFoundForQueryException.java
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java	2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/CrudControllerAdvice.java	2014-06-11 19:13:57 +0000
@@ -28,13 +28,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import javax.validation.ConstraintViolationException;
-
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.common.IllegalQueryException;
 import org.hisp.dhis.webapi.controller.exception.NotAuthenticatedException;
 import org.hisp.dhis.webapi.controller.exception.NotFoundException;
-import org.hisp.dhis.webapi.controller.exception.NotFoundForQueryException;
-import org.hisp.dhis.common.DeleteNotAllowedException;
-import org.hisp.dhis.common.IllegalQueryException;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
@@ -45,6 +42,8 @@
 import org.springframework.web.client.HttpServerErrorException;
 import org.springframework.web.client.HttpStatusCodeException;
 
+import javax.validation.ConstraintViolationException;
+
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
@@ -57,16 +56,16 @@
         HttpHeaders headers = new HttpHeaders();
         headers.add( "Content-Type", MediaType.TEXT_PLAIN_VALUE );
 
-        return new ResponseEntity<String>( ex.getMessage(), headers, HttpStatus.UNAUTHORIZED );
+        return new ResponseEntity<>( ex.getMessage(), headers, HttpStatus.UNAUTHORIZED );
     }
 
-    @ExceptionHandler( { NotFoundException.class, NotFoundForQueryException.class } )
+    @ExceptionHandler( { NotFoundException.class } )
     public ResponseEntity<String> notFoundExceptionHandler( Exception ex )
     {
         HttpHeaders headers = new HttpHeaders();
         headers.add( "Content-Type", MediaType.TEXT_PLAIN_VALUE );
 
-        return new ResponseEntity<String>( ex.getMessage(), headers, HttpStatus.NOT_FOUND );
+        return new ResponseEntity<>( ex.getMessage(), headers, HttpStatus.NOT_FOUND );
     }
 
     @ExceptionHandler( { HttpClientErrorException.class, HttpServerErrorException.class } )
@@ -75,7 +74,7 @@
         HttpHeaders headers = new HttpHeaders();
         headers.add( "Content-Type", MediaType.TEXT_PLAIN_VALUE );
 
-        return new ResponseEntity<String>( ex.getStatusText(), headers, ex.getStatusCode() );
+        return new ResponseEntity<>( ex.getStatusText(), headers, ex.getStatusCode() );
     }
 
     @ExceptionHandler( ConstraintViolationException.class )
@@ -84,33 +83,33 @@
         HttpHeaders headers = new HttpHeaders();
         headers.add( "Content-Type", MediaType.TEXT_PLAIN_VALUE );
 
-        return new ResponseEntity<String>( ex.getMessage(), headers, HttpStatus.UNPROCESSABLE_ENTITY );
+        return new ResponseEntity<>( ex.getMessage(), headers, HttpStatus.UNPROCESSABLE_ENTITY );
     }
 
-    @ExceptionHandler(DeleteNotAllowedException.class)
+    @ExceptionHandler( DeleteNotAllowedException.class )
     public ResponseEntity<String> deleteNotAllowedExceptionHandler( DeleteNotAllowedException ex )
     {
         HttpHeaders headers = new HttpHeaders();
         headers.add( "Content-Type", MediaType.TEXT_PLAIN_VALUE );
-        
-        return new ResponseEntity<String>( ex.getMessage(), headers, HttpStatus.CONFLICT );
+
+        return new ResponseEntity<>( ex.getMessage(), headers, HttpStatus.CONFLICT );
     }
 
-    @ExceptionHandler(IllegalQueryException.class)
+    @ExceptionHandler( IllegalQueryException.class )
     public ResponseEntity<String> handleError( IllegalQueryException ex )
     {
         HttpHeaders headers = new HttpHeaders();
         headers.add( "Content-Type", MediaType.TEXT_PLAIN_VALUE );
-        
-        return new ResponseEntity<String>( ex.getMessage(), headers, HttpStatus.CONFLICT );
+
+        return new ResponseEntity<>( ex.getMessage(), headers, HttpStatus.CONFLICT );
     }
 
-    @ExceptionHandler(IllegalArgumentException.class)
+    @ExceptionHandler( IllegalArgumentException.class )
     public ResponseEntity<String> handleError( IllegalArgumentException ex )
     {
         HttpHeaders headers = new HttpHeaders();
         headers.add( "Content-Type", MediaType.TEXT_PLAIN_VALUE );
-        
-        return new ResponseEntity<String>( ex.getMessage(), headers, HttpStatus.CONFLICT );
+
+        return new ResponseEntity<>( ex.getMessage(), headers, HttpStatus.CONFLICT );
     }
 }

=== removed file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/exception/NotFoundForQueryException.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/exception/NotFoundForQueryException.java	2014-05-22 12:40:24 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/exception/NotFoundForQueryException.java	1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-package org.hisp.dhis.webapi.controller.exception;
-
-/*
- * Copyright (c) 2004-2014, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class NotFoundForQueryException extends Exception
-{
-    public NotFoundForQueryException()
-    {
-        super( "Object not found." );
-    }
-
-    public NotFoundForQueryException( String query )
-    {
-        super( "Object not found for query: " + query );
-    }
-}