code: public <T> T doAs(PrivilegedExceptionAction<T> action
    ) throws IOException, InterruptedException {
      try {
        return Subject.doAs(null, action);
      } catch (PrivilegedActionException pae) {
        Throwable cause = pae.getCause();
        LOG.error("PriviledgedActionException as:"+this+" cause:"+cause);
        if (cause instanceof IOException) {
          throw (IOException) cause;
        } else if (cause instanceof Error) {
          throw (Error) cause;
        } else if (cause instanceof RuntimeException) {
          throw (RuntimeException) cause;
        } else if (cause instanceof InterruptedException) {
          throw (InterruptedException) cause;
        } else {
          throw new UndeclaredThrowableException(pae,"Unknown exception in doAs");
        }
      }
    }
docs: Run the given action as the user, potentially throwing an exception.
  @param <T> the return type of the run method
  @param action the method to execute
  @return the value from the run method
  @throws IOException if the action throws an IOException
  @throws Error if the action throws an Error
  @throws RuntimeException if the action throws a RuntimeException
  @throws InterruptedException if the action throws an InterruptedException
  @throws java.lang.reflect.UndeclaredThrowableException if the action throws something else