public void doJar()

in atomos.utils/atomos.utils.core/src/main/java/org/apache/felix/atomos/utils/core/plugins/index/IndexPlugin.java [108:182]


    public void doJar(JarFile jar, Context context, URLClassLoader classLoader)
    {
        long id = counter.getAndIncrement();

        IndexInfoImpl info = new IndexInfoImpl();

        try
        {
            Manifest mf = jar.getManifest();
            Attributes attributes = mf == null ? null : mf.getMainAttributes();
            if (attributes != null)
            {
                info.setBsn(attributes.getValue(Constants.BUNDLE_SYMBOLICNAME));
                info.setVersion(attributes.getValue(Constants.BUNDLE_VERSION));
            }
        }
        catch (IOException e1)
        {

            e1.printStackTrace();
            return;
        }

        info.setId(Long.toString(id));

        if (info.getBundleSymbolicName() == null)
        {
            return;
        }
        if (info.getVersion() == null)
        {
            info.setVersion("0.0");
        }
        List<String> files = jar.stream().peek(j -> {
            try
            {
                if (Boolean.FALSE == uniquePaths.get(j.getName()))
                {
                    String fileName = ATOMOS_BUNDLES_BASE_PATH + id + "/" + j.getName();
                    if (isJarType())
                    {
                        final JarEntry entry = new JarEntry(fileName);
                        if (j.getCreationTime() != null)
                        {
                            entry.setCreationTime(j.getCreationTime());
                        }
                        if (j.getComment() != null)
                        {
                            entry.setComment(j.getComment());
                        }
                        jos.putNextEntry(entry);
                        jos.write(jar.getInputStream(j).readAllBytes());
                    }
                    else
                    {
                        Path path = config.indexOutputDirectory().resolve(fileName);
                        Files.createDirectories(path.getParent());
                        Files.write(path, jar.getInputStream(j).readAllBytes());
                        BasicFileAttributeView attrs = Files.getFileAttributeView(path,
                            BasicFileAttributeView.class);
                        FileTime time = j.getCreationTime();
                        attrs.setTimes(time, time, time);
                    }
                }
            }
            catch (final IOException e)
            {
                throw new UncheckedIOException(e);
            }

        }).map(JarEntry::getName).collect(Collectors.toList());

        info.setFiles(files);
        indexInfos.add(info);
    }