You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2012/11/05 18:13:53 UTC
svn commit: r1405882 -
/pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
Author: rwhitcomb
Date: Mon Nov 5 17:13:53 2012
New Revision: 1405882
URL: http://svn.apache.org/viewvc?rev=1405882&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.
Modified:
pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
Modified: pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java?rev=1405882&r1=1405881&r2=1405882&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BXMLSerializer.java Mon Nov 5 17:13:53 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();