#fixed code
                                private void deleteDirectory(File path) {
        if ( path.exists() ) {
            File[] files = path.listFiles();
            for ( File file : files ) {
                if ( file.isDirectory() ) {
                    deleteDirectory( file );
                }
                else {
                    file.delete();
                }
            }
        }
        path.delete();
    }
#vulnerable code 
                                private void deleteDirectory(File path) {
        if ( path.exists() ) {
            File[] files = path.listFiles();
            for ( int i = 0; i < files.length; i++ ) {
                if ( files[i].isDirectory() ) {
                    deleteDirectory( files[i] );
                }
                else {
                    files[i].delete();
                }
            }
        }
        path.delete();
    } 
                            #location 4 
                            #vulnerability type NULL_DEREFERENCE