#vulnerable code 
                              private byte[] callWrite(final Object instance) throws Exception {
    final ByteArrayOutputStream bout = new ByteArrayOutputStream();
    instance.getClass().getMethod("write", JBBPBitOutputStream.class).invoke(instance, new JBBPBitOutputStream(bout));
    bout.close();
    return bout.toByteArray();
  } 
                            #location 3 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                              private byte[] callWrite(final Object instance) throws Exception {
    final ByteArrayOutputStream bout = new ByteArrayOutputStream();
    final JBBPBitOutputStream bitout = new JBBPBitOutputStream(bout);
    instance.getClass().getMethod("write", JBBPBitOutputStream.class).invoke(instance, bitout);
    bitout.close();
    return bout.toByteArray();
  }