protected XMLStreamException _constructUnexpectedInTyped(int nextToken) { if (nextToken == START_ELEMENT) { return _constructTypeException("Element content can not contain child START_ELEMENT when using Typed Access methods", null); } return _constructTypeException("Expected a text token, got "+ErrorConsts.tokenTypeDesc(nextToken), null); }
protected XMLStreamException _constructUnexpectedInTyped(int nextToken) { if (nextToken == START_ELEMENT) { return _constructTypeException("Element content can not contain child START_ELEMENT when using Typed Access methods", null); } return _constructTypeException("Expected a text token, got "+ErrorConsts.tokenTypeDesc(nextToken), null); }
protected QName verifyQName(QName n) throws TypedXMLStreamException { String ln = n.getLocalPart(); int ix = XmlNames.findIllegalNameChar(ln, false); if (ix >= 0) { String prefix = n.getPrefix(); String pname = (prefix != null && prefix.length() > 0) ? (prefix + ":" +ln) : ln; throw _constructTypeException("Invalid local name \""+ln+"\" (character at #"+ix+" is invalid)", pname); } return n; }
protected QName verifyQName(QName n) throws TypedXMLStreamException { String ln = n.getLocalPart(); int ix = XmlNames.findIllegalNameChar(ln, false); if (ix >= 0) { String prefix = n.getPrefix(); String pname = (prefix != null && prefix.length() > 0) ? (prefix + ":" +ln) : ln; throw _constructTypeException("Invalid local name \""+ln+"\" (character at #"+ix+" is invalid)", pname); } return n; }
/** * Method called to handle value that has empty String * as representation. This will usually either lead to an * exception, or parsing to the default value for the * type in question (null for nullable types and so on). */ private void _handleEmptyValue(TypedValueDecoder dec) throws XMLStreamException { try { // default action is to throw an exception dec.handleEmptyValue(); } catch (IllegalArgumentException iae) { throw _constructTypeException(iae, ""); } }
/** * Method called to handle value that has empty String * as representation. This will usually either lead to an * exception, or parsing to the default value for the * type in question (null for nullable types and so on). */ private void _handleEmptyValue(TypedValueDecoder dec) throws XMLStreamException { try { // default action is to throw an exception dec.handleEmptyValue(); } catch (IllegalArgumentException iae) { throw _constructTypeException(iae, ""); } }
@Override public final void getAttributeAs(int index, TypedValueDecoder tvd) throws XMLStreamException { if (_currToken != START_ELEMENT) { throw new IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM); } try { _scanner.decodeAttrValue(index, tvd); } catch (IllegalArgumentException iae) { throw _constructTypeException(iae, getAttributeValue(index)); } }
@Override public final void getAttributeAs(int index, TypedValueDecoder tvd) throws XMLStreamException { if (_currToken != START_ELEMENT) { throw new IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM); } try { _scanner.decodeAttrValue(index, tvd); } catch (IllegalArgumentException iae) { throw _constructTypeException(iae, getAttributeValue(index)); } }
@Override public final void getElementAs(TypedValueDecoder tvd) throws XMLStreamException { // !!! TODO: optimize String value = getElementText(); value = value.trim(); if (value.length() == 0) { _handleEmptyValue(tvd); return; } try { tvd.decode(value); } catch (IllegalArgumentException iae) { throw _constructTypeException(iae, value); } }
@Override public final void getElementAs(TypedValueDecoder tvd) throws XMLStreamException { // !!! TODO: optimize String value = getElementText(); value = value.trim(); if (value.length() == 0) { _handleEmptyValue(tvd); return; } try { tvd.decode(value); } catch (IllegalArgumentException iae) { throw _constructTypeException(iae, value); } }
} catch (IllegalArgumentException iae) { throw _constructTypeException(iae.getMessage(), ""); throw _constructTypeException("Incomplete base64 triplet at the end of decoded content", ""); } else if (left > 0) { // 1 or 2 more bytes of data, loop some more continue main_loop;
} catch (IllegalArgumentException iae) { throw _constructTypeException(iae.getMessage(), ""); throw _constructTypeException("Incomplete base64 triplet at the end of decoded content", ""); } else if (left > 0) { // 1 or 2 more bytes of data, loop some more continue main_loop;