#vulnerable code 
                                public static void print(EventFrame ef) {
        synchronized(io) {
            createOutput();
            OutputWriter out = io.getOut();

            Date date = new Date();
            out.write("[");
            out.write(dateFormat.format(date));
            out.write("] EVENT ");
            out.write(ef.getMessage());
            out.write("\n");
            out.close();
        }
    } 
                            #location 2 
                            #vulnerability type THREAD_SAFETY_VIOLATION
#fixed code
                                public static void print(EventFrame ef) {
        createOutput();
        synchronized(io) {
            OutputWriter out = io.getOut();
            Date date = new Date();
            out.write("[");
            out.write(dateFormat.format(date));
            out.write("] EVENT ");
            out.write(ef.getMessage());
            out.write("\n");
            out.close();
        }
    }