Ambigious use of isElementData in the Block interface
-----------------------------------------------------
Key: AXIS2-5023
URL: https://issues.apache.org/jira/browse/AXIS2-5023
Project: Axis2
Issue Type: Bug
Components: jaxws
Affects Versions: 1.7.0
Reporter: Ivan
In the Block interface, a method named isElementData is defined with doc
description below, from my understanding, it only return true while the block
could be represented as a single element.
/**
* @return true if data is always an element; false if possibly mixed
content or multiple
* elements
*/
public boolean isElementData();
In the getQName() of BlockImpl class, any XML parsing exception is swallowed
if isElementData return false. IMO, it should only ignore it while the block
elment might be a MIME type, which means it is of a DataSource type. e.g. while
invoking the Dispatch<Source>.invoke, aninvalid XML string like
<simplerequest><param>1</param><simpleRequest> is passed, no exception is
thrown, while a WebServiceException should be expected.
Thougths ? If I did not miss anything, would like to open a JIRA for it and
attach a draft patch.
--->
/* (non-Javadoc)
* @see org.apache.axis2.jaxws.message.Block#getQName()
*/
public QName getQName() throws WebServiceException {
// If the QName is not known, find it
try {
if (qName == null) {
// If a prior call discovered that this content has no QName,
then return null
if (noQNameAvailable) {
return null;
}
if (omElement == null) {
try {
XMLStreamReader newReader = _getReaderFromBO(busObject,
busContext);
busObject = null;
StAXOMBuilder builder = new StAXOMBuilder(newReader);
omElement = builder.getDocumentElement();
omElement.close(true);
} catch (Exception e) {
// Some blocks may represent non-element data
if (log.isDebugEnabled()) {
log.debug("Exception occurred while obtaining
QName:" + e);
}
if (!isElementData()) {
// If this block can hold non-element data, then
accept
// the fact that there is no qname and continue
if (log.isDebugEnabled()) {
log.debug("The block does not contain an xml
element. Processing continues.");
}
// Indicate that the content has no QName
// The exception is swallowed.
noQNameAvailable = true;
return null;
} else {
// The content should contain xml.
// Rethrowing the exception.
throw ExceptionFactory.makeWebServiceException(e);
}
}
}
qName = omElement.getQName();
}
return qName;
} catch (Exception xse) {
setConsumed(true);
throw ExceptionFactory.makeWebServiceException(xse);
}
}
<---
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]