diff --git a/src/main/java/com/rtds/svc/CaptureTypeService.java b/src/main/java/com/rtds/svc/CaptureTypeService.java index 52bdea3..be6c346 100644 --- a/src/main/java/com/rtds/svc/CaptureTypeService.java +++ b/src/main/java/com/rtds/svc/CaptureTypeService.java @@ -52,12 +52,16 @@ public class CaptureTypeService CaptureType type = em.find( CaptureType.class, url_suffix ); - if( type != null ) + if( type == null ) { - return type.getCaptureFilter(); + throw new IllegalArgumentException( "The url_suffix must exist in the database." ); } - return null; + // It is okay for the capture filter itself to be null, but the CaptureType + // must be in the database, otherwise the user could effectively forge + // a capture filter for "all" just by requesting a non-existent filter. + + return type.getCaptureFilter(); } public CaptureType find( String url_suffix )