#vulnerable code 
                             @Test
	public void test() throws Exception {
		VCard vcard = new VCard();

		StructuredNameType n = new StructuredNameType();
		n.setGiven("Michael");
		n.setFamily("Angstadt");
		vcard.setStructuredName(n);

		FormattedNameType fn = new FormattedNameType("Michael Angstadt");
		vcard.setFormattedName(fn);

		PhotoType photo = new PhotoType();
		photo.setUrl("http://example.com/image.jpg");
		vcard.getPhotos().add(photo);

		VCardWriter vcw = new VCardWriter(new OutputStreamWriter(System.out));
		vcw.write(vcard);
	} 
                            #location 17 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             @Test
	public void test() throws Exception {
		VCard vcard = new VCard();

		StructuredNameType n = new StructuredNameType();
		n.setGiven("Michael");
		n.setFamily("Angstadt");
		vcard.setStructuredName(n);

		FormattedNameType fn = new FormattedNameType("Michael Angstadt");
		vcard.setFormattedName(fn);

		PhotoType photo = new PhotoType();
		photo.setUrl("http://example.com/image.jpg");
		vcard.getPhotos().add(photo);

		StringWriter sw = new StringWriter();
		VCardWriter vcw = new VCardWriter(sw, VCardVersion.V2_1);
		vcw.write(vcard);
		System.out.println(sw.toString());
	}