AXmlResourceParser +getFirstError()

This commit is contained in:
Ryszard Wiśniewski 2010-06-14 12:05:16 +02:00
parent 126d66082a
commit a592ec78b1

View File

@ -56,6 +56,10 @@ public class AXmlResourceParser implements XmlResourceParser {
open(stream); open(stream);
} }
public AndrolibException getFirstError() {
return mFirstError;
}
public ResAttrDecoder getAttrDecoder() { public ResAttrDecoder getAttrDecoder() {
return mAttrDecoder; return mAttrDecoder;
} }
@ -315,6 +319,7 @@ public class AXmlResourceParser implements XmlResourceParser {
return mAttrDecoder.decode(valueType, valueData, return mAttrDecoder.decode(valueType, valueData,
getAttributeNameResource(index)); getAttributeNameResource(index));
} catch (AndrolibException ex) { } catch (AndrolibException ex) {
setFirstError(ex);
LOGGER.log(Level.WARNING, String.format( LOGGER.log(Level.WARNING, String.format(
"Could not decode attr value, using undecoded value " + "Could not decode attr value, using undecoded value " +
"instead: ns=%s, name=%s, value=0x%08x", "instead: ns=%s, name=%s, value=0x%08x",
@ -906,6 +911,13 @@ public class AXmlResourceParser implements XmlResourceParser {
} }
} }
} }
private void setFirstError(AndrolibException error) {
if (mFirstError == null) {
mFirstError = error;
}
}
/////////////////////////////////// data /////////////////////////////////// data
/* /*
* All values are essentially indices, e.g. m_name is * All values are essentially indices, e.g. m_name is
@ -913,6 +925,8 @@ public class AXmlResourceParser implements XmlResourceParser {
*/ */
private ExtDataInput m_reader; private ExtDataInput m_reader;
private ResAttrDecoder mAttrDecoder; private ResAttrDecoder mAttrDecoder;
private AndrolibException mFirstError;
private boolean m_operational = false; private boolean m_operational = false;
private StringBlock m_strings; private StringBlock m_strings;
private int[] m_resourceIDs; private int[] m_resourceIDs;