You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "James Grahn (JIRA)" <ji...@apache.org> on 2012/11/12 19:05:12 UTC

[jira] [Created] (AXIOM-442) Null pointer exception in MTOM validation

James Grahn created AXIOM-442:
---------------------------------

             Summary: Null pointer exception in MTOM validation
                 Key: AXIOM-442
                 URL: https://issues.apache.org/jira/browse/AXIOM-442
             Project: Axiom
          Issue Type: Bug
    Affects Versions: 1.2.12
            Reporter: James Grahn


As part of an Axis2 workflow, my code validates incoming messages against schemas.   This seems to work in all cases except when the incoming message contains an MTOM attachment.

The code constructs a Source object for the part of the message to be validated, then calls the "validate" method on a properly constructed javax.xml.validation.Validator object:
Source validateMe = new OMSource(messagePart);
validator.validate(validateMe);

The error generated looks like this:
java.lang.NullPointerException
 at org.apache.axiom.om.impl.llom.OMTextImpl.getTextCharacters(OMTextImpl.java:272)
 at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:196)
 at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:166)
 at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:163)
 at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:83)
 at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:73)
 at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source)
 at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
 at javax.xml.validation.Validator.validate(Unknown Source)

----

By the time it reaches my handler, I'm not fully certain what should be in the MTOM attachment element should contain, as it's reasonable to assume that the attachment has been extracted by then.   A NullPointerException doesn't seem appropriate, however.

A logging statement does show the attachment inline, encoded in Base64 (though I believe all incoming MTOM is represented that way if the envelope is printed for a log).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-442) Null pointer exception in MTOM validation

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

Hudson commented on AXIOM-442:
------------------------------

Integrated in ws-axiom-trunk #1268 (See [https://builds.apache.org/job/ws-axiom-trunk/1268/])
    AXIOM-442: Fixed a NullPointerException in OMText#getTextCharacters(). (Revision 1408474)

     Result = SUCCESS
veithen : 
Files : 
* /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/base64/Base64Utils.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/base64/NoCopyCharArrayWriter.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-dom/src/main/java/org/apache/axiom/om/impl/dom/TextNodeImpl.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-impl/src/main/java/org/apache/axiom/om/impl/llom/OMTextImpl.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestGetTextCharactersFromDataHandler.java

                
> Null pointer exception in MTOM validation
> -----------------------------------------
>
>                 Key: AXIOM-442
>                 URL: https://issues.apache.org/jira/browse/AXIOM-442
>             Project: Axiom
>          Issue Type: Bug
>          Components: DOOM, LLOM
>    Affects Versions: 1.2.12, 1.2.13
>            Reporter: James Grahn
>            Assignee: Andreas Veithen
>
> As part of an Axis2 workflow, my code validates incoming messages against schemas.   This seems to work in all cases except when the incoming message contains an MTOM attachment.
> The code constructs a Source object for the part of the message to be validated, then calls the "validate" method on a properly constructed javax.xml.validation.Validator object:
> Source validateMe = new OMSource(messagePart);
> validator.validate(validateMe);
> The error generated looks like this:
> java.lang.NullPointerException
>  at org.apache.axiom.om.impl.llom.OMTextImpl.getTextCharacters(OMTextImpl.java:272)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:196)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:166)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:163)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:83)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:73)
>  at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source)
>  at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
>  at javax.xml.validation.Validator.validate(Unknown Source)
> ----
> By the time it reaches my handler, I'm not fully certain what should be in the MTOM attachment element should contain, as it's reasonable to assume that the attachment has been extracted by then.   A NullPointerException doesn't seem appropriate, however.
> A logging statement does show the attachment inline, encoded in Base64 (though I believe all incoming MTOM is represented that way if the envelope is printed for a log).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Updated] (AXIOM-442) Null pointer exception in MTOM validation

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

Andreas Veithen updated AXIOM-442:
----------------------------------

          Component/s: LLOM
                       DOOM
    Affects Version/s: 1.2.13
             Assignee: Andreas Veithen

Based on inspection of the relevant code, the issue still exists in trunk. It affects both LLOM and DOOM.

getTextCharacters indeed fails to consider the case where the text node is backed by a DataHandler, resulting in a NullPointerException.

The other issue is that using getTextCharacters is the worst way to pass base64 encoded binary data to a SAX ContentHandler. There are better ways to do that (where better means better performance and constant memory usage).
                
> Null pointer exception in MTOM validation
> -----------------------------------------
>
>                 Key: AXIOM-442
>                 URL: https://issues.apache.org/jira/browse/AXIOM-442
>             Project: Axiom
>          Issue Type: Bug
>          Components: DOOM, LLOM
>    Affects Versions: 1.2.12, 1.2.13
>            Reporter: James Grahn
>            Assignee: Andreas Veithen
>
> As part of an Axis2 workflow, my code validates incoming messages against schemas.   This seems to work in all cases except when the incoming message contains an MTOM attachment.
> The code constructs a Source object for the part of the message to be validated, then calls the "validate" method on a properly constructed javax.xml.validation.Validator object:
> Source validateMe = new OMSource(messagePart);
> validator.validate(validateMe);
> The error generated looks like this:
> java.lang.NullPointerException
>  at org.apache.axiom.om.impl.llom.OMTextImpl.getTextCharacters(OMTextImpl.java:272)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:196)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:166)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:163)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:83)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:73)
>  at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source)
>  at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
>  at javax.xml.validation.Validator.validate(Unknown Source)
> ----
> By the time it reaches my handler, I'm not fully certain what should be in the MTOM attachment element should contain, as it's reasonable to assume that the attachment has been extracted by then.   A NullPointerException doesn't seem appropriate, however.
> A logging statement does show the attachment inline, encoded in Base64 (though I believe all incoming MTOM is represented that way if the envelope is printed for a log).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (AXIOM-442) Null pointer exception in MTOM validation

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

Hudson commented on AXIOM-442:
------------------------------

Integrated in ws-axiom-trunk #1270 (See [https://builds.apache.org/job/ws-axiom-trunk/1270/])
    AXIOM-442: Implemented streaming of base64 encoded binary content in the SAXSource returned by getSAXSource. (Revision 1409122)

     Result = SUCCESS
veithen : 
Files : 
* /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/ContentHandlerWriter.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/om/impl/serialize/OMXMLReader.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/OMTestSuiteBuilder.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestBase64Streaming.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestBase64StreamingWithGetSAXSource.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/text/TestBase64StreamingWithSerialize.java
* /webservices/commons/trunk/modules/axiom/modules/axiom-testutils/src/main/java/org/apache/axiom/testutils/activation/RandomDataSource.java

                
> Null pointer exception in MTOM validation
> -----------------------------------------
>
>                 Key: AXIOM-442
>                 URL: https://issues.apache.org/jira/browse/AXIOM-442
>             Project: Axiom
>          Issue Type: Bug
>          Components: DOOM, LLOM
>    Affects Versions: 1.2.12, 1.2.13
>            Reporter: James Grahn
>            Assignee: Andreas Veithen
>             Fix For: 1.2.14
>
>
> As part of an Axis2 workflow, my code validates incoming messages against schemas.   This seems to work in all cases except when the incoming message contains an MTOM attachment.
> The code constructs a Source object for the part of the message to be validated, then calls the "validate" method on a properly constructed javax.xml.validation.Validator object:
> Source validateMe = new OMSource(messagePart);
> validator.validate(validateMe);
> The error generated looks like this:
> java.lang.NullPointerException
>  at org.apache.axiom.om.impl.llom.OMTextImpl.getTextCharacters(OMTextImpl.java:272)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:196)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:166)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:163)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:83)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:73)
>  at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source)
>  at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
>  at javax.xml.validation.Validator.validate(Unknown Source)
> ----
> By the time it reaches my handler, I'm not fully certain what should be in the MTOM attachment element should contain, as it's reasonable to assume that the attachment has been extracted by then.   A NullPointerException doesn't seem appropriate, however.
> A logging statement does show the attachment inline, encoded in Base64 (though I believe all incoming MTOM is represented that way if the envelope is printed for a log).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Resolved] (AXIOM-442) Null pointer exception in MTOM validation

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

Andreas Veithen resolved AXIOM-442.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.14
    
> Null pointer exception in MTOM validation
> -----------------------------------------
>
>                 Key: AXIOM-442
>                 URL: https://issues.apache.org/jira/browse/AXIOM-442
>             Project: Axiom
>          Issue Type: Bug
>          Components: DOOM, LLOM
>    Affects Versions: 1.2.12, 1.2.13
>            Reporter: James Grahn
>            Assignee: Andreas Veithen
>             Fix For: 1.2.14
>
>
> As part of an Axis2 workflow, my code validates incoming messages against schemas.   This seems to work in all cases except when the incoming message contains an MTOM attachment.
> The code constructs a Source object for the part of the message to be validated, then calls the "validate" method on a properly constructed javax.xml.validation.Validator object:
> Source validateMe = new OMSource(messagePart);
> validator.validate(validateMe);
> The error generated looks like this:
> java.lang.NullPointerException
>  at org.apache.axiom.om.impl.llom.OMTextImpl.getTextCharacters(OMTextImpl.java:272)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:196)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:166)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.generateEvents(OMXMLReader.java:163)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:83)
>  at org.apache.axiom.om.impl.serialize.OMXMLReader.parse(OMXMLReader.java:73)
>  at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.validate(Unknown Source)
>  at org.apache.xerces.jaxp.validation.ValidatorImpl.validate(Unknown Source)
>  at javax.xml.validation.Validator.validate(Unknown Source)
> ----
> By the time it reaches my handler, I'm not fully certain what should be in the MTOM attachment element should contain, as it's reasonable to assume that the attachment has been extracted by then.   A NullPointerException doesn't seem appropriate, however.
> A logging statement does show the attachment inline, encoded in Base64 (though I believe all incoming MTOM is represented that way if the envelope is printed for a log).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org