#fixed code
                             public void writeXmlConfig(XmlWriter xmlWriter) throws SAXException,
			SearchLibException, SecurityException, IOException {
		xmlWriter.startElement("system");

		xmlWriter.startElement("availableProcessors", "value", Integer
				.toString(getAvailableProcessors()));
		xmlWriter.endElement();

		xmlWriter.startElement("freeMemory", "value", Long
				.toString(getFreeMemory()), "rate", Double
				.toString(getMemoryRate()));
		xmlWriter.endElement();

		xmlWriter.startElement("maxMemory", "value", Long
				.toString(getMaxMemory()));
		xmlWriter.endElement();

		xmlWriter.startElement("totalMemory", "value", Long
				.toString(getTotalMemory()));
		xmlWriter.endElement();

		xmlWriter.startElement("indexCount", "value", Integer
				.toString(getIndexCount()));
		xmlWriter.endElement();

		Double rate = getDiskRate();
		if (rate == null)
			xmlWriter.startElement("freeDiskSpace", "value", getFreeDiskSpace()
					.toString());
		else
			xmlWriter.startElement("freeDiskSpace", "value", getFreeDiskSpace()
					.toString(), "rate", rate.toString());

		xmlWriter.endElement();

		xmlWriter.startElement("dataDirectoryPath", "value",
				getDataDirectoryPath());
		xmlWriter.endElement();

		xmlWriter.endElement();

		xmlWriter.startElement("properties");

		for (Entry<Object, Object> prop : getProperties()) {
			xmlWriter.startElement("property", "name",
					prop.getKey().toString(), "value", prop.getValue()
							.toString());
			xmlWriter.endElement();
		}

		xmlWriter.endElement();
	}
#vulnerable code 
                             public void writeXmlConfig(XmlWriter xmlWriter) throws SAXException,
			SearchLibException {
		xmlWriter.startElement("system");

		xmlWriter.startElement("availableProcessors", "value", Integer
				.toString(getAvailableProcessors()));
		xmlWriter.endElement();

		xmlWriter.startElement("freeMemory", "value", Long
				.toString(getFreeMemory()), "rate", Double
				.toString(getMemoryRate()));
		xmlWriter.endElement();

		xmlWriter.startElement("maxMemory", "value", Long
				.toString(getMaxMemory()));
		xmlWriter.endElement();

		xmlWriter.startElement("totalMemory", "value", Long
				.toString(getTotalMemory()));
		xmlWriter.endElement();

		xmlWriter.startElement("indexCount", "value", Integer
				.toString(getIndexCount()));
		xmlWriter.endElement();

		xmlWriter.startElement("freeDiskSpace", "value", getFreeDiskSpace()
				.toString());
		xmlWriter.endElement();

		xmlWriter.startElement("dataDirectoryPath", "value",
				getDataDirectoryPath());
		xmlWriter.endElement();

		xmlWriter.endElement();

		xmlWriter.startElement("properties");

		for (Entry<Object, Object> prop : getProperties()) {
			xmlWriter.startElement("property", "name",
					prop.getKey().toString(), "value", prop.getValue()
							.toString());
			xmlWriter.endElement();
		}

		xmlWriter.endElement();
	} 
                            #location 27 
                            #vulnerability type NULL_DEREFERENCE