docs: public static Document parseDocument(DocumentBuilder builder, EntityResolver entityResolver, ErrorHandler errorHandler, InputStream is) throws IOException, SAXException {
          final DocumentBuilder docBuilder = builder;
          final EntityResolver eResolver = entityResolver;
          final ErrorHandler errHandler = errorHandler;
          final InputStream iStream = is;
          try {
              return (Document) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                  public Object run() throws SAXException, IOException {
                      Thread currThread = Thread.currentThread();
                      ClassLoader oldLoader = currThread.getContextClassLoader();
                      currThread.setContextClassLoader(ParserFactory.class.getClassLoader());
                      try {
                          docBuilder.setEntityResolver(eResolver);
                          docBuilder.setErrorHandler(errHandler);
                          return docBuilder.parse(iStream);
                      }
                                          finally {
                                              currThread.setContextClassLoader(oldLoader);
                                          }
                                      }
              });
          } catch (PrivilegedActionException pae) {
              Throwable t = pae.getCause();
              if (t instanceof SAXException) {
                  throw (SAXException) t;
              } else if (t instanceof IOException) {
                  throw (IOException) t;
              }
          }
          return null;
      }