You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Ivan (JIRA)" <ji...@apache.org> on 2011/05/09 04:52:03 UTC

[jira] [Created] (AXIS2-5023) Ambigious use of isElementData in the Block interface

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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Updated] (AXIS2-5023) Ambigious use of isElementData in the Block interface

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen updated AXIS2-5023:
-----------------------------------

    Labels: Geronimo  (was: )

> 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
>            Reporter: Ivan
>              Labels: Geronimo
>         Attachments: AXIS2-5023-Test.patch
>
>
> 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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Commented] (AXIS2-5023) Ambigious use of isElementData in the Block interface

Posted by "Ivan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13030589#comment-13030589 ] 

Ivan commented on AXIS2-5023:
-----------------------------

I am thinking to add a new method isElementDataOnly(), it returns true when the data always represents one or more xml elements. Thoughts ?
Thanks.

> 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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Updated] (AXIS2-5023) Ambigious use of isElementData in the Block interface

Posted by "Ivan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan updated AXIS2-5023:
------------------------

    Attachment: AXIS2-5023-Test.patch

The patch takes advantage of an existing test suite in jaxws-integration module, it could somewhat demonstrate what happens.
An illegal format XML message is used to invoke a remote service, and an exception about XML parsing should be triggered on the client side, while in current Axis2, the exception is got from remote side.
The exception is thrown by StAXOMBuilder in the BlockImpl.getQName(), but it is ingored in the following places.
a. BlockImpl.getQName() line 183
b. XMLSpineImpl.setBodyBlock() line 420

> 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
>            Reporter: Ivan
>         Attachments: AXIS2-5023-Test.patch
>
>
> 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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Updated] (AXIS2-5023) Ambigious use of isElementData in the Block interface

Posted by "Ivan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ivan updated AXIS2-5023:
------------------------

    Attachment: AXIS2-5023.patch

In the patch, a new method isXMLData is added to indicate whether the contents of the block should be of XML, it only returns false with DataSourceBlockImpl.
Also, it is allowed to return empty source with the Provider style web service, so the SourceBlockFactoryImpl will return null if the empty source is detected

> 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
>            Reporter: Ivan
>              Labels: Geronimo
>         Attachments: AXIS2-5023-Test.patch, AXIS2-5023.patch
>
>
> 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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


[jira] [Updated] (AXIS2-5023) Ambigious use of isElementData in the Block interface

Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-5023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen updated AXIS2-5023:
-----------------------------------

    Affects Version/s:     (was: 1.7.0)

I think you should start by providing a test case that shows the issue (e.g. with Dispatch<Source>), so that we can get a better understanding of the issue and evaluate the proposed changes.

> 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
>            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: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org