public void expose()

in src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java [43:66]


    public void expose(JarIdentification identification, JarAnalyzer jarAnalyzer) {
        List<JarEntry> entries = jarAnalyzer.getEntries();
        SimpleDateFormat tsformat = new SimpleDateFormat("yyyyMMdd", Locale.US); // $NON-NLS-1$
        Bag<String> timestamps = new HashBag<>();
        for (JarEntry entry : entries) {
            long time = entry.getTime();
            String timestamp = tsformat.format(new Date(time));
            timestamps.add(timestamp);
        }

        String ts = "";
        int tsmax = 0;
        for (String timestamp : timestamps) {
            int count = timestamps.getCount(timestamp);
            if (count > tsmax) {
                ts = timestamp;
                tsmax = count;
            }
        }

        if (ts != null && !ts.isEmpty()) {
            identification.addVersion(ts);
        }
    }