private void ensureProperPermissions ( String path ) { ClassLoader cl = Thread . currentThread ( ) . getContextClassLoader ( ) ; // 1) Container can access anything if ( cl instanceof ContainerClassLoader ) { return ; } // 2. Some files are whitelisted globally for all stage libraries if ( exceptions . contains ( path ) ) { return ; } // 3. Some stage libraries have some files whitelisted globally if ( cl instanceof SDCClassLoader ) { String libraryName = ( ( SDCClassLoader ) cl ) . getName ( ) ; if ( stageLibExceptions . containsKey ( libraryName ) && stageLibExceptions . get ( libraryName ) . contains ( path ) ) { return ; } } // No whitelist, no fun, go away throw new SecurityException ( Utils . format ( "Classloader {} is not allowed access to Data Collector internal directories ({})." , cl . toString ( ) , path ) ) ; }
Make sure that the active code have proper rights to access the file inside protected directory .