docs: public static PortletApplicationContext getPortletApplicationContext(PortletContext pc, String attrName) {
          Assert.notNull(pc, "PortletContext must not be null");
          Object attr = pc.getAttribute(attrName);
          if (attr == null) {
              return null;
          }
          if (attr instanceof RuntimeException) {
              throw (RuntimeException) attr;
          }
          if (attr instanceof Error) {
              throw (Error) attr;
          }
          if (attr instanceof Exception) {
              throw new IllegalStateException((Exception) attr);
          }
          if (!(attr instanceof PortletApplicationContext)) {
              throw new IllegalStateException("Context attribute is not of type PortletApplicationContext: " + attr.getClass() + " - " + attr);
          }
          return (PortletApplicationContext) attr;
      }