#vulnerable code 
                                protected void doWriteKeyPair(KeyPair kp, OutputStream os) throws Exception {
        PEMWriter w = new PEMWriter(new OutputStreamWriter(os));
        w.writeObject(kp);
    } 
                            #location 3 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                protected void doWriteKeyPair(KeyPair kp, OutputStream os) throws Exception {
        PEMWriter w = new PEMWriter(new OutputStreamWriter(os));
        try {
            w.writeObject(kp);
        } finally {
            w.close();
        }
    }