Author: rwhitcomb
Date: Mon Nov  5 17:16:16 2012
New Revision: 1405883

URL: http://svn.apache.org/viewvc?rev=1405883&view=rev
Log:
PIVOT-536: BXMLSerializer should provide a structure with error
information when an exception occurs.

The easiest way to do this is provide access to the XMLStreamReader's
Location information, which has everything we could possibly get about
the current location, either in the case of an error, or just during
normal parsing.

Adding a "getCurrentLocation()" method which does just that.

This is a merge of revision 1405882 from trunk to branches/2.0.x.

Modified:
    pivot/branches/2.0.x/   (props changed)
    pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java

Propchange: pivot/branches/2.0.x/
------------------------------------------------------------------------------
  Merged /pivot/trunk:r1405882

Modified: 
pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java
URL: 
http://svn.apache.org/viewvc/pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java?rev=1405883&r1=1405882&r2=1405883&view=diff
==============================================================================
--- pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java 
(original)
+++ pivot/branches/2.0.x/core/src/org/apache/pivot/beans/BXMLSerializer.java 
Mon Nov  5 17:16:16 2012
@@ -1401,6 +1401,15 @@ public class BXMLSerializer implements S
         element = element.parent;
     }
 
+    /**
+     * Return the current location of the XML parser.  Useful to ascertain the
+     * location where an error occurred (if the error was not an 
XMLStreamException,
+     * which has its own {@link XMLStreamException#getLocation} method).
+     */
+    public Location getCurrentLocation() {
+        return xmlStreamReader.getLocation();
+    }
+
     private void logException() {
         Location streamReaderlocation = xmlStreamReader.getLocation();
         String message = "An error occurred at line number " + 
streamReaderlocation.getLineNumber();


Reply via email to