class WhitelistOptionParser {

    IResource parseResource(String resourceName)
    {
        try
        {
            return ResourceFactory.toResource(resourceName);
        }
        catch (IllegalArgumentException e)
        {
            throw Exceptions.appendCause(new InvalidRequestException(String.format("Unable to parse whitelisted resource [%s]: %s", resourceName, e.getMessage())), e);
        }
    }

}