From: Wolfgang M. M. <wol...@us...> - 2004-09-20 10:23:28
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/http In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25106/src/org/exist/http Modified Files: RESTServer.java Log Message: Fixed NPE if the content of a POST request is neither a query nor an xupdate. Index: RESTServer.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/http/RESTServer.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** RESTServer.java 17 Sep 2004 10:07:25 -0000 1.18 --- RESTServer.java 20 Sep 2004 10:23:19 -0000 1.19 *************** *** 217,221 **** Document doc = docBuilder.parse(src); Element root = doc.getDocumentElement(); ! if(root.getNamespaceURI().equals(NS)) { if(root.getLocalName().equals("query")) { // process <query>xpathQuery</query> --- 217,222 ---- Document doc = docBuilder.parse(src); Element root = doc.getDocumentElement(); ! String rootNS = root.getNamespaceURI(); ! if(rootNS != null && rootNS.equals(NS)) { if(root.getLocalName().equals("query")) { // process <query>xpathQuery</query> *************** *** 271,275 **** else throw new BadRequestException("No query specified"); ! } else if(root.getNamespaceURI().equals(XUPDATE_NS)) { LOG.debug("Got xupdate request: " + content); DocumentSet docs =new DocumentSet(); --- 272,276 ---- else throw new BadRequestException("No query specified"); ! } else if(rootNS != null && rootNS.equals(XUPDATE_NS)) { LOG.debug("Got xupdate request: " + content); DocumentSet docs =new DocumentSet(); *************** *** 325,328 **** --- 326,331 ---- public Response doPut(DBBroker broker, File tempFile, String contentType, String docPath) throws BadRequestException, PermissionDeniedException { + if(tempFile == null) + throw new BadRequestException("No request content found for PUT"); Response response; try { |