You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2010/01/25 16:18:55 UTC
svn commit: r902836 - /subversion/trunk/subversion/libsvn_ra_neon/util.c
Author: julianfoad
Date: Mon Jan 25 15:18:53 2010
New Revision: 902836
URL: http://svn.apache.org/viewvc?rev=902836&view=rev
Log:
Improve RA neon error message when non-XML response received.
* subversion/libsvn_ra_neon/util.c
(check_parse_error): New function.
(wrapper_reader_cb): If the parser reported an error, call check_parse_error
to turn it into a Subversion error object and store that in the request.
(parsed_request): Use check_parse_error() instead of equivalent in-line code.
Modified:
subversion/trunk/subversion/libsvn_ra_neon/util.c
Modified: subversion/trunk/subversion/libsvn_ra_neon/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_neon/util.c?rev=902836&r1=902835&r2=902836&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_neon/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_neon/util.c Mon Jan 25 15:18:53 2010
@@ -1084,11 +1084,29 @@
return 0;
}
+/* If XML_PARSER found an XML parse error, then return a Subversion error
+ * saying that the error was found in the response to the DAV request METHOD
+ * for the URL URL. Otherwise, return SVN_NO_ERROR. */
+static svn_error_t *
+check_parse_error(const char *method,
+ ne_xml_parser *xml_parser,
+ const char *url)
+{
+ const char *msg = ne_xml_get_error(xml_parser);
+ if (msg != NULL && *msg != '\0')
+ return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
+ _("The %s request returned invalid XML "
+ "in the response: %s (%s)"),
+ method, msg, url);
+ return SVN_NO_ERROR;
+}
+
static int
wrapper_reader_cb(void *baton, const char *data, size_t len)
{
parser_wrapper_baton_t *pwb = baton;
svn_ra_neon__session_t *sess = pwb->req->sess;
+ int parser_status;
if (pwb->req->err)
return 1;
@@ -1101,7 +1119,15 @@
if (pwb->req->err)
return 1;
- return ne_xml_parse(pwb->parser, data, len);
+ parser_status = ne_xml_parse(pwb->parser, data, len);
+ if (parser_status)
+ {
+ /* Pass XML parser error. */
+ pwb->req->err = check_parse_error(pwb->req->method, pwb->parser,
+ pwb->req->url);
+ }
+
+ return parser_status;
}
ne_xml_parser *
@@ -1194,7 +1220,6 @@
apr_pool_t *pool)
{
ne_xml_parser *success_parser = NULL;
- const char *msg;
spool_reader_baton_t spool_reader_baton;
if (body == NULL)
@@ -1261,13 +1286,7 @@
}
}
- /* was there an XML parse error somewhere? */
- msg = ne_xml_get_error(success_parser);
- if (msg != NULL && *msg != '\0')
- return svn_error_createf(SVN_ERR_RA_DAV_REQUEST_FAILED, NULL,
- _("The %s request returned invalid XML "
- "in the response: %s (%s)"),
- method, msg, url);
+ SVN_ERR(check_parse_error(method, success_parser, url));
return SVN_NO_ERROR;
}