#vulnerable code 
                             @Override
	protected void doMarshalValue(StringBuilder sb, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode) {
		//VCardWriter handles 2.1 AGENT types that have an embedded vCard.
		//this method will not be called for these instances

		if (url != null) {
			sb.append(url);
		} else {
			StringWriter sw = new StringWriter();
			VCardWriter writer = new VCardWriter(sw, version, null, "\n");
			writer.setCompatibilityMode(compatibilityMode);
			writer.setAddGenerator(false);
			try {
				writer.write(vcard);
			} catch (IOException e) {
				//never thrown because we're writing to a string
			}
			String str = sw.toString();

			for (String w : writer.getWarnings()) {
				warnings.add("AGENT marshal warning: " + w);
			}

			sb.append(VCardStringUtils.escapeText(str));
		}
	} 
                            #location 20 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             @Override
	protected void doMarshalValue(StringBuilder sb, VCardVersion version, List<String> warnings, CompatibilityMode compatibilityMode) {
		if (url != null) {
			sb.append(url);
		} else if (vcard != null) {
			throw new EmbeddedVCardException(vcard);
		} else {
			throw new SkipMeException("Property has neither a URL nor an embedded vCard.");
		}
	}