code: public static void registerHandler(String key, PolicyContextHandler handler, boolean replace)
           throws PolicyContextException
     {
        if (key == null)
           throw new IllegalArgumentException("The key may not be null");
        if (handler == null)
           throw new IllegalArgumentException("The handler may not be null");
        SecurityManager sm = System.getSecurityManager();
        if (sm != null)
           sm.checkPermission(setPolicy);
        if (replace == false && handlerMap.containsKey(key) == true)
        {
           String msg = "Handler for key=" + key + ", exists, handler: " + handlerMap.get(key);
           throw new IllegalArgumentException(msg);
        }
        handlerMap.put(key, handler);
     }
docs: <p>
  Authorization protected method used to register a container specific {@code PolicyContext} handler. A handler may
  be registered to handle multiple keys, but at any time, at most one handler may be registered for a key.
  </p>
  
  @param key
  - a (case-sensitive) {@code String} that identifies the context object handled by the handler. The value
  of this parameter must not be null.
  @param handler
  - an object that implements the {@code PolicyContextHandler} interface. The value of this parameter must
  not be null.
  @param replace
  - this boolean value defines the behavior of this method if, when it is called, a {@code
  PolicyContextHandler} has already been registered to handle the same key. In that case, and if the value
  of this argument is {@code true}, the existing handler is replaced with the argument handler. If the
  value of this parameter is false the existing registration is preserved and an exception is thrown.
  @throws IllegalArgumentException
  - if the value of either of the handler or key arguments is null, or the value of the replace argument
  is false and a handler with the same key as the argument handler is already registered.
  @throws SecurityException
  - if the calling {@code AccessControlContext} is not authorized by the container to call this method.
  @throws PolicyContextException
  - if an operation by this method on the argument {@code PolicyContextHandler} causes it to throw a
  checked exception that is not accounted for in the signature of this method.