[jira] [Created] (FLINK-22639) ClassLoaderUtil cannot print classpath of FlinkUserCodeClassLoader

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-22639) ClassLoaderUtil cannot print classpath of FlinkUserCodeClassLoader

Shang Yuanchun (Jira)
Adrian Zhong created FLINK-22639:
------------------------------------

             Summary: ClassLoaderUtil cannot print classpath of FlinkUserCodeClassLoader
                 Key: FLINK-22639
                 URL: https://issues.apache.org/jira/browse/FLINK-22639
             Project: Flink
          Issue Type: Improvement
          Components: Runtime / Configuration, Table SQL / Runtime
    Affects Versions: 1.13.0
            Reporter: Adrian Zhong


Hello, community.

I found FlinkUserCodeClassLoader is wrapping by 

SafetyNetWrapperClassLoader, but it cut getURL invoking chain.

 

ClassLoaderUtil.getUserCodeClassLoaderInfo:
{code:java}
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()) {
                }
}{code}
{code:java}
SafetyNetWrapperClassLoader(FlinkUserCodeClassLoader inner, ClassLoader parent) {
    super(new URL[0], parent);
    this.inner = inner;
}
{code}
The url passing empty array, SafetyNetWrapperClassLoader.getURL should dispatch this invocation.

 
{code:java}

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

{code}
Otherwise,  
{code:java}
ClassLoaderUtil.getUserCodeClassLoaderInfo(theJarClassLoader);
{code}
will print empty, like below:
{code:java}
URL ClassLoader:
{code}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)