UNEXPECTED_ELEMENT_ERR + currentNode.getNodeName());
WebDAVUtil.UNEXPECTED_ELEMENT_ERR + currentNode.getNodeName());
	public void process(User user, HttpServletRequest request, HttpServletResponse response,			Collection collection, DocumentImpl resource)			throws ServletException, IOException {		if(collection == null) {			LOG.debug("No resource or collection found");			response.sendError(HttpServletResponse.SC_NOT_FOUND, "No resource or collection found");			return;		}		if(!collection.getPermissions().validate(user, Permission.READ)) {			response.sendError(HttpServletResponse.SC_FORBIDDEN);			return;		}		Document doc = parseRequestContent(request, response);		int type = FIND_ALL_PROPERTIES;		DAVProperties searchedProperties = new DAVProperties();		if(doc != null) {				Element propfind = doc.getDocumentElement();			if(!(propfind.getLocalName().equals("propfind") && 					propfind.getNamespaceURI().equals(WebDAV.DAV_NS))) {				LOG.debug(UNEXPECTED_ELEMENT_ERR + propfind.getNodeName());				response.sendError(HttpServletResponse.SC_BAD_REQUEST,						UNEXPECTED_ELEMENT_ERR + propfind.getNodeName());				return;			}						NodeList childNodes = propfind.getChildNodes();			for(int i = 0; i < childNodes.getLength(); i++) {				Node currentNode = childNodes.item(i);				if(currentNode.getNodeType() == Node.ELEMENT_NODE) {					if(currentNode.getNamespaceURI().equals(WebDAV.DAV_NS)) {						if(currentNode.getLocalName().equals("prop")) {							type = FIND_BY_PROPERTY;							getPropertyNames(currentNode, searchedProperties);						}						if(currentNode.getLocalName().equals("allprop"))							type = FIND_ALL_PROPERTIES;						if(currentNode.getLocalName().equals("propname"))							type = FIND_PROPERTY_NAMES;					} else {						// Found an unknown element: return with 400 Bad Request						LOG.debug("Unexpected child: " + currentNode.getNodeName());						response.sendError(HttpServletResponse.SC_BAD_REQUEST,								UNEXPECTED_ELEMENT_ERR + currentNode.getNodeName());						return;					}				}			}		}				String servletPath = getServletPath(request);		int depth = getDepth(request);		StringWriter os = new StringWriter();		SAXSerializer serializer = SAXSerializerPool.getInstance().borrowSAXSerializer();		try {			serializer.setWriter(os);			serializer.setOutputProperties(WebDAV.OUTPUT_PROPERTIES);			AttributesImpl attrs = new AttributesImpl();			serializer.startDocument();			serializer.startPrefixMapping(PREFIX, WebDAV.DAV_NS);			serializer.startElement(WebDAV.DAV_NS, "multistatus", "D:multistatus", attrs);						if(type == FIND_ALL_PROPERTIES || type == FIND_BY_PROPERTY) {				if(resource != null)					writeResourceProperties(user, searchedProperties, type, resource, serializer, servletPath);				else					writeCollectionProperties(user, searchedProperties, type, collection, serializer, servletPath, depth, 0);			} else if(type == FIND_PROPERTY_NAMES)			    writePropertyNames(collection, resource, serializer, servletPath);						serializer.endElement(WebDAV.DAV_NS, "multistatus", "D:multistatus");			serializer.endPrefixMapping(PREFIX);			serializer.endDocument();		} catch (SAXException e) {			throw new ServletException("Exception while writing multistatus response: " + e.getMessage(), e);		} finally {			SAXSerializerPool.getInstance().returnSAXSerializer(serializer);		}		String content = os.toString();		LOG.debug("response:\n" + content);		writeResponse(response, content);	}