#vulnerable code 
                                public static void main(String[] args) throws Exception {
        System.setProperty("Log4jContextSelector", AsyncLoggerContextSelector.class.getName());

        Logger logger = LogManager.getLogger();
        if (!(logger instanceof AsyncLogger)) {
            throw new IllegalStateException();
        }
        logger.info("Starting...");
        Thread.sleep(100);

        final RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();

        // warmup
        final int ITERATIONS = 100000;
        long startMs = System.currentTimeMillis();
        long end = startMs + TimeUnit.SECONDS.toMillis(10);
        long total = 0;
        int count = 0;
        StringBuilder sb = new StringBuilder(512);
        do {
            sb.setLength(0);
            long startNanos = System.nanoTime();
            long uptime = runtimeMXBean.getUptime();
            loop(logger, ITERATIONS);
            long endNanos = System.nanoTime();
            long durationNanos = endNanos - startNanos;
            final long opsPerSec = (1000L * 1000L * 1000L * ITERATIONS) / durationNanos;
            sb.append(uptime).append(" Warmup: Throughput: ").append(opsPerSec).append(" ops/s");
            System.out.println(sb);
            total += opsPerSec;
            count++;
            // Thread.sleep(1000);// drain buffer
        } while (System.currentTimeMillis() < end);
        System.out.printf("Average warmup throughput: %,d ops/s%n", total/count);

        final int COUNT = 10;
        final long[] durationNanos = new long[10];
        for (int i = 0; i < COUNT; i++) {
            final long startNanos = System.nanoTime();
            loop(logger, ITERATIONS);
            long endNanos = System.nanoTime();
            durationNanos[i] = endNanos - startNanos;
            // Thread.sleep(1000);// drain buffer
        }
        total = 0;
        for (int i = 0; i < COUNT; i++) {
            final long opsPerSec = (1000L * 1000L * 1000L * ITERATIONS) / durationNanos[i];
            System.out.printf("Throughput: %,d ops/s%n", opsPerSec);
            total += opsPerSec;
        }
        System.out.printf("Average throughput: %,d ops/s%n", total/COUNT);
    } 
                            #location 51 
                            #vulnerability type CHECKERS_PRINTF_ARGS
#fixed code
                                public static void main(String[] args) throws Exception {
        System.setProperty("Log4jContextSelector", AsyncLoggerContextSelector.class.getName());

        Logger logger = LogManager.getLogger();
        if (!(logger instanceof AsyncLogger)) {
            throw new IllegalStateException();
        }
        // work around a bug in Log4j-2.5
        workAroundLog4j2_5Bug();

        logger.error("Starting...");
        System.out.println("Starting...");
        Thread.sleep(100);

        final RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean();
        final long testStartNanos = System.nanoTime();
        final long[] UPTIMES = new long[1024];
        final long[] DURATIONS = new long[1024];

        // warmup
        long startMs = System.currentTimeMillis();
        long end = startMs + TimeUnit.SECONDS.toMillis(10);
        int warmupCount = 0;
        do {
            runTest(logger, runtimeMXBean, UPTIMES, DURATIONS, warmupCount);
            warmupCount++;
            // Thread.sleep(1000);// drain buffer
        } while (System.currentTimeMillis() < end);

        final int COUNT = 10;
        for (int i = 0; i < COUNT; i++) {
            int count = warmupCount + i;
            runTest(logger, runtimeMXBean, UPTIMES, DURATIONS, count);
            // Thread.sleep(1000);// drain buffer
        }
        double testDurationNanos = System.nanoTime() - testStartNanos;
        System.out.println("Done. Calculating stats...");

        printReport("Warmup", UPTIMES, DURATIONS, 0, warmupCount);
        printReport("Test", UPTIMES, DURATIONS, warmupCount, COUNT);

        StringBuilder sb = new StringBuilder(512);
        sb.append("Test took: ").append(testDurationNanos/(1000.0*1000.0*1000.0)).append(" sec");
        System.out.println(sb);

        final List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans();
        for (int i = 0; i < gcBeans.size(); i++) {
            GarbageCollectorMXBean gcBean = gcBeans.get(i);
            sb.setLength(0);
            sb.append("GC[").append(gcBean.getName()).append("] ");
            sb.append(gcBean.getCollectionCount()).append(" collections, collection time=");
            sb.append(gcBean.getCollectionTime()).append(" millis.");
            System.out.println(sb);
        }
    }