public static Policy createPolicy ( final String resourceName ) { if ( StringUtils . isBlank ( resourceName ) ) { throw new SystemException ( "AntiSamy Policy resourceName cannot be null " ) ; } URL resource = HtmlSanitizerUtil . class . getClassLoader ( ) . getResource ( resourceName ) ; if ( resource == null ) { throw new SystemException ( "Could not find AntiSamy Policy XML resource." ) ; } try { return Policy . getInstance ( resource ) ; } catch ( PolicyException ex ) { throw new SystemException ( "Could not create AntiSamy Policy" + ex . getMessage ( ) , ex ) ; } }
Create a Policy from a named local resource .