=== modified file 'dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java' --- dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-02-04 18:03:10 +0000 +++ dhis-2/dhis-web/dhis-web-api-fred/src/main/java/org/hisp/dhis/web/webapi/v1/controller/FacilityController.java 2013-02-05 06:51:24 +0000 @@ -65,6 +65,7 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.client.HttpServerErrorException; import javax.servlet.http.HttpServletRequest; import javax.validation.ConstraintViolation; @@ -325,6 +326,12 @@ HttpServletRequest request ) { OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( id ); + + if ( organisationUnit == null ) + { + throw new HttpServerErrorException( HttpStatus.NOT_FOUND ); + } + List organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels(); Facility facility = conversionService.convert( organisationUnit, Facility.class );