Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-22639

ClassLoaderUtil cannot print classpath of FlinkUserCodeClassLoader

    XMLWordPrintableJSON

Details

    Description

      Hello, community.

      I found FlinkUserCodeClassLoader is wrapping by 

      SafetyNetWrapperClassLoader, but it cut getURL invoking chain.

       

      ClassLoaderUtil.getUserCodeClassLoaderInfo:

      public static String getUserCodeClassLoaderInfo(ClassLoader loader) {
              if (loader instanceof URLClassLoader) {
                  URLClassLoader cl = (URLClassLoader) loader;
      
                  try {
                      StringBuilder bld = new StringBuilder();
      
                      if (cl == ClassLoader.getSystemClassLoader()) {
                          bld.append("System ClassLoader: ");
                      } else {
                          bld.append("URL ClassLoader:");
                      }
      
                      for (URL url : cl.getURLs()) {
                      }
      }
      SafetyNetWrapperClassLoader(FlinkUserCodeClassLoader inner, ClassLoader parent) {
          super(new URL[0], parent);
          this.inner = inner;
      }
      

      The constructor passed an empty array to super class, SafetyNetWrapperClassLoader.getURL should dispatch this invocation.

      @Override
      public URL[] getURLs() {
          return inner.getURLs();
      }
      
      

      Otherwise,  

      ClassLoaderUtil.getUserCodeClassLoaderInfo(theJarClassLoader);
      

      will print empty, like below:

      URL ClassLoader:
      

       
       

      Attachments

        Issue Links

          Activity

            People

              paul8263 Yao Zhang
              Adrian Z slankka
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: