File tree Expand file tree Collapse file tree
main/java/org/apache/ranger/rest
test/java/org/apache/ranger/rest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1292,12 +1292,16 @@ public void removeSharedResource(@PathParam("id") Long resourceId) {
12921292 @ DELETE
12931293 @ Path ("/resources" )
12941294 @ PreAuthorize ("@rangerPreAuthSecurityHandler.isAPIAccessible(\" " + RangerAPIList .REMOVE_SHARED_RESOURCES + "\" )" )
1295- public void removeSharedResources (List <Long > resourceIds ) {
1296- LOG .debug ("==> GdsREST.removeSharedResources({})" , resourceIds );
1295+ public void removeSharedResources (@ QueryParam ( "resourceIds" ) List <Long > resourceIds ) {
1296+ LOG .debug ("==> GdsREST.removeSharedResources(resourceIds= {})" , resourceIds );
12971297
12981298 RangerPerfTracer perf = null ;
12991299
13001300 try {
1301+ if (resourceIds == null ) {
1302+ throw new Exception ("resourceIds must not be null" );
1303+ }
1304+
13011305 if (resourceIds .size () > SHARED_RESOURCES_MAX_BATCH_SIZE ) {
13021306 throw new Exception ("removeSharedResources batch size exceeded the configured limit: Maximum allowed is " + SHARED_RESOURCES_MAX_BATCH_SIZE );
13031307 }
@@ -1317,7 +1321,7 @@ public void removeSharedResources(List<Long> resourceIds) {
13171321 RangerPerfTracer .log (perf );
13181322 }
13191323
1320- LOG .debug ("<== GdsREST.removeSharedResources({})" , resourceIds );
1324+ LOG .debug ("<== GdsREST.removeSharedResources(resourceIds= {})" , resourceIds );
13211325 }
13221326
13231327 @ GET
Original file line number Diff line number Diff line change @@ -962,6 +962,13 @@ public void testRemoveSharedResourcesBatchSizeExceeded() {
962962 assertThrows (WebApplicationException .class , () -> gdsREST .removeSharedResources (resourceIds ));
963963 }
964964
965+ @ Test
966+ public void testRemoveSharedResourcesNullResourceIds () {
967+ Mockito .when (restErrorUtil .createRESTException (Mockito .anyString ())).thenReturn (new WebApplicationException ());
968+
969+ assertThrows (WebApplicationException .class , () -> gdsREST .removeSharedResources (null ));
970+ }
971+
965972 @ Test
966973 public void testGetSharedResource () {
967974 Long resourceId = 1L ;
You can’t perform that action at this time.
0 commit comments