You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by gs...@apache.org on 2012/06/19 17:57:35 UTC

svn commit: r1351755 - /subversion/trunk/subversion/libsvn_ra_serf/util.c

Author: gstein
Date: Tue Jun 19 15:57:34 2012
New Revision: 1351755

URL: http://svn.apache.org/viewvc?rev=1351755&view=rev
Log:
Adjust the order of checking for errors from the Expat parser. If we
see an svn-based error, then use that first.

The old code raise an Expat error (by stopping the parser) when an
svn-based error occurred. That threw a spurious "Malformed XML" error,
overriding the intended svn-based error.

* subversion/libsvn_ra_serf/util.c:
  (expat_response_handler): reorder and document some error checks

Modified:
    subversion/trunk/subversion/libsvn_ra_serf/util.c

Modified: subversion/trunk/subversion/libsvn_ra_serf/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/util.c?rev=1351755&r1=1351754&r2=1351755&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/util.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/util.c Tue Jun 19 15:57:34 2012
@@ -2426,6 +2426,20 @@ expat_response_handler(serf_request_t *r
       /* ### should we have an IGNORE_ERRORS flag like the v1 parser?  */
 
       expat_status = XML_Parse(ectx->parser, data, (int)len, 0 /* isFinal */);
+
+      /* We need to check INNER_ERROR first. This is an error from the
+         callbacks that has been "dropped off" for us to retrieve. On
+         current Expat parsers, we stop the parser when an error occurs,
+         so we want to ignore EXPAT_STATUS (which reports the stoppage).
+
+         If an error is not present, THEN we go ahead and look for parsing
+         errors.  */
+      if (ectx->inner_error)
+        {
+          apr_pool_cleanup_run(ectx->cleanup_pool, &ectx->parser,
+                               xml_parser_cleanup);
+          return svn_error_trace(ectx->inner_error);
+        }
       if (expat_status == XML_STATUS_ERROR)
         return svn_error_createf(SVN_ERR_XML_MALFORMED,
                                  ectx->inner_error,
@@ -2435,14 +2449,6 @@ expat_response_handler(serf_request_t *r
                                  ectx->handler->sline.code,
                                  ectx->handler->sline.reason);
 
-      /* Was an error dropped off for us?  */
-      if (ectx->inner_error)
-        {
-          apr_pool_cleanup_run(ectx->cleanup_pool, &ectx->parser,
-                               xml_parser_cleanup);
-          return svn_error_trace(ectx->inner_error);
-        }
-
       /* The parsing went fine. What has the bucket told us?  */
 
       if (APR_STATUS_IS_EOF(status))