/*
(non-Javadoc)

@see org.eclipse.osgi.storage.bundlefile.BundleFileWrapper#getEntryPaths(java.lang.String, boolean)
559009
@Override
    public Enumeration<String> getEntryPaths(String path, boolean recurse) {
        path = preSlashify(path);
        Iterator<Entry> entries;
        if (path.equals("/")) {
            // asking for entries of the root container
            entries = container.iterator();
        } else {
            Entry entry = container.getEntry(path);
            Container entryContainer = entry == null ? null : getContainer(entry);
            // Check if the entry is a container; 
            // if so only iterate over its entries if the container is not a root
            entries = entryContainer == null || entryContainer.isRoot() ? null : entryContainer.iterator();
            path = postSlashify(path, null);
        }
        return entries == null ? null : new ContainerEnumeration(path, entries, recurse);
    }
1138348
@Override
	public List<PathMapping> getPathMappings(JoinableResourceBundle bundle, String resourcePath,
			ResourceReaderHandler rsReader) {

		List<PathMapping> pathMappings = new ArrayList<>();
		PathMapping pathMapping = null;
		GeneratorMappingHelper helper = new GeneratorMappingHelper(resourcePath);
		String path = resolver.getResourcePath(helper.getPath());
		String[] names = path.split(RESOURCE_BUNDLE_SEPARATOR);

		for (String resourceName : names) {

			path = resourceName.replace(PACKAGE_SEPARATOR, JawrConstant.URL_SEPARATOR_CHAR);
			path = control.toBundleName(path, new Locale("", "")) + PROPERTIES_FILE_SUFFIX;
			URL rbURL = LocaleUtils.getResourceBundleURL(path, config.getContext());
			if (rbURL != null) {
				String strURL = rbURL.toString();
				// returns the path mapping only if the MessageBundle are on a
				// filesystem
				if (strURL.startsWith(JawrConstant.FILE_URL_PREFIX)) {
					String parentPath = "/WEB-INF/classes/" + PathNormalizer.getParentPath(path);
					String resourceBundleName = FileNameUtils.getBaseName(path);
					MessageBundleFileFilter filter = new MessageBundleFileFilter(resourceBundleName);
					pathMapping = new PathMapping(bundle, parentPath, filter);
					pathMappings.add(pathMapping);
				}
			}
		}
		return pathMappings;
	}
822457
public List<String> getPaths() {
        final List<String> resourcePaths = new ArrayList<>(this.size());
        for (final Resource resource : this) {
            resourcePaths.add(resource.getPath());
        }
        return resourcePaths;
    }
143421
public static URL[] getClassPathJars(final Bundle bundle) {
		final List<URL> urls = new ArrayList<>();
		final String bundleClasspath = (String) bundle.getHeaders().get(
				"Bundle-ClassPath");
		if (bundleClasspath != null) {
			String[] segments = bundleClasspath.split(",");
			for (String segment : segments) {
				final URL url = bundle.getEntry(segment);
				if (url != null) {
					if (url.toExternalForm().endsWith("jar")) {
						LOG.debug("Using url: " + url);
						try {
							URL jarUrl = new URL("jar:" + url.toExternalForm()
									+ "!/");
							urls.add(jarUrl);
						} catch (MalformedURLException ignore) {
							LOG.debug(ignore.getMessage());
						}
					}
				}
			}
		}
		LOG.debug("Bundle-ClassPath URLs: " + urls);
		// adds the depending bundles to the "classloader" space
		urls.addAll(getLocationsOfBundlesInClassSpace(bundle));

		return urls.toArray(new URL[urls.size()]);
	}
575224
@SuppressWarnings("unchecked")
    private Set<Path> extractUserProvidedClassPathEntries(Container container) {
        Map<Path, List<String>> localizedResources;
        try {
            Field lf = container.getClass().getDeclaredField("localizedResources");
            lf.setAccessible(true);
            localizedResources = (Map<Path, List<String>>) lf.get(container);
            Set<Path> paths = localizedResources.keySet();
            // Needed for Tez
            for (Path path : paths) {
                if (path.toString().endsWith("tez-conf.pb") || path.toString().endsWith("tez-dag.pb")){
                    File sourceFile = new File(path.toUri());

                    File targetFile = new File(System.getenv(Environment.PWD.name()) + "/" + sourceFile.getName());
                    FileUtils.copyFile(sourceFile, targetFile);

//			System.out.println("######## Copied file: " + targetFile);
//			FileInputStream fis = new FileInputStream(new File(System.getenv(Environment.PWD.name()), targetFile.getName()));
//			System.out.println(fis.available());
//			fis.close();
//			break;
                }
            }
            return paths;
        }
        catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
960601
public java.util.List<java.util.Map<String, String>> getEntries() {
        if (entries == null) {
            entries = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>();
        }
        return entries;
    }
647053
public List<E> getEntriesForActivities(Set<String> activities) {
        Validate.noNullElements(activities);
        List<E> result = new ArrayList<>();
        for (E entry : logEntries) {
            if (activities.contains(entry.getActivity())) {
                result.add(entry);
            }
        }
        return result;
    }
319348
public java.util.List<EgressOnlyInternetGateway> getEgressOnlyInternetGateways() {
        if (egressOnlyInternetGateways == null) {
            egressOnlyInternetGateways = new com.amazonaws.internal.SdkInternalList<EgressOnlyInternetGateway>();
        }
        return egressOnlyInternetGateways;
    }
134901
public com.google.api.ads.adwords.axis.v201809.rm.OfflineDataUpload[] getEntries() {
        return entries;
    }
1088135
@Override
  public List<AclEntry> getEntries() {
    if (isEmpty()) {
      return new ArrayList<>();
    }
    List<AclEntry> aclEntryList = super.getEntries();

    for (AclEntry entry : aclEntryList) {
      entry.setDefault(true);
    }
    return aclEntryList;
  }
1369605
private FileStatusEntry[] doListPathsEntry(Path path, FileStatusEntry entry)
      throws IOException {
    final Path[] paths = listPaths(path);

    final FileStatusEntry[] children =
        paths.length > 0 ? new FileStatusEntry[paths.length] : FileStatusEntry.EMPTY_ENTRIES;
    for (int i = 0; i < paths.length; i++) {
      children[i] = createPathEntry(entry, paths[i]);
    }
    return children;
  }
1342136
private Set<String> findExclusionPaths(ServletContext servletContext) {
        Set<String> exclusions = new TreeSet<String>();
        
        // Let other handlers deal with folders that do not reside in the WEB-INF or META-INF
        Set<String> resourcePaths = servletContext.getResourcePaths("/");
        
        // This most certainly should not be null!
        // It means that the server cannot read files at all
        if (resourcePaths == null) throw new InitException("ServletContext cannot read files. Reason is unknown");
        
        resourcePaths.removeIf( path -> path.contains("-INF") || path.contains("-inf"));
    
        // We still need to also remove the views folder from being processed by other handlers
        resourcePaths.removeIf( path -> path.contains(TemplateEngine.TEMPLATES_FOLDER));
        
        // Add the remaining paths to exclusions
        for (String path : resourcePaths) {
            // add leading slash
            if (path.charAt(0) != '/')
                path = '/' + path;
            
            // remove the last slash
            if (path.charAt(path.length()-1) == '/')
                path = path.substring(0, path.length()-1);
            exclusions.add(path);
        }
        
        return exclusions;
    }
514862
@Override
  public Set<String> getFileEntries() throws
      IOException
  {
    synchronized (zip)
    {
      if (allEntries == null)
      {
        listEntries();
      }
      return Collections.unmodifiableSet(fileEntries);
    }
  }
363555
public static String getPathsString(Collection<VirtualFile> paths) {
        if (paths == null) {
            throw MESSAGES.nullArgument("paths");
        }
        StringBuilder buffer = new StringBuilder();
        boolean first = true;
        for (VirtualFile path : paths) {
            if (path == null) { throw new IllegalArgumentException("Null path in " + paths); }
            if (first == false) {
                buffer.append(':');
            } else {
                first = false;
            }
            buffer.append(path.getPathName());
        }
        if (first == true) {
            buffer.append("<empty>");
        }
        return buffer.toString();
    }
191873
public java.util.List<String> getEgressOnlyInternetGatewayIds() {
        if (egressOnlyInternetGatewayIds == null) {
            egressOnlyInternetGatewayIds = new com.amazonaws.internal.SdkInternalList<String>();
        }
        return egressOnlyInternetGatewayIds;
    }
762441
public void getSubEntries(
        String rootPath,
        boolean isRoot,
        I_CmsSimpleCallback<List<CmsSitemapEntryBean>> callback) {

        m_controller.getSubEntries(rootPath, isRoot, null, callback);
    }
872770
public static List<String> getSourcePaths() throws PackageManager.NameNotFoundException, IOException {
        ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(getPackageName(), 0);
        File sourceApk = new File(applicationInfo.sourceDir);
        File dexDir = new File(applicationInfo.dataDir, SECONDARY_FOLDER_NAME);
        File instantRunDir = new File(applicationInfo.dataDir, INSTANT_RUN_DEX_DIR_PATH); //default instant-run dir

        List<String> sourcePaths = new ArrayList<>();
        sourcePaths.add(applicationInfo.sourceDir); //add the default apk path

        if (instantRunDir.exists()) { //check if app using instant run
            for(final File dexFile : instantRunDir.listFiles()) { //add all sources from instan-run
                sourcePaths.add(dexFile.getAbsolutePath());
            }
        }

        //the prefix of extracted file, ie: test.classes
        String extractedFilePrefix = sourceApk.getName() + EXTRACTED_NAME_EXT;
        //the total dex numbers
        int totalDexNumber = getMultiDexPreferences().getInt(KEY_DEX_NUMBER, 1);

        for (int secondaryNumber = 2; secondaryNumber <= totalDexNumber; secondaryNumber++) {
            //for each dex file, ie: test.classes2.zip, test.classes3.zip...
            String fileName = extractedFilePrefix + secondaryNumber + EXTRACTED_SUFFIX;
            File extractedFile = new File(dexDir, fileName);
            if (extractedFile.isFile()) {
                sourcePaths.add(extractedFile.getAbsolutePath());
                //we ignore the verify zip part
            }
        }

        return sourcePaths;
    }