You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by OpenDog <be...@opendog.org> on 2012/03/22 04:09:07 UTC

DataReaderImpl.java NullPointerException

In DataReaderImpl.java there is this hack in the
WSUIDValidationHandler.handleEvent that parses the event's message (see
below). It doesn't check for a null message. I have an envelope where I'm
sent a syntactically incorrect number that results in a
NumberFormatException with a null message. 

It's annoying because I have to turn the jaxb validation handler off and I
have to barf on the invalid data.

I thin k a simple "if ( msg!=null && ... " would do the trick. This is from
2.4 but I checked 2.5 it's still the same. 

Thank you,
Bela

This is the source.

/
private static class WSUIDValidationHandler implements
ValidationEventHandler {
        ValidationEventHandler origHandler;
        WSUIDValidationHandler(ValidationEventHandler o) {
            origHandler = o;
        }
        
        public boolean handleEvent(ValidationEvent event) {
            String msg = event.getMessage();
            if ((msg.startsWith("cvc-type.3.1.1: ") 
                || msg.startsWith("cvc-type.3.2.2: "))  
                && msg.contains(":Id")) {
                return true;
            }
            if (origHandler != null) {
                return origHandler.handleEvent(event);
            }
            return false;
        }
    }
/

--
View this message in context: http://cxf.547215.n5.nabble.com/DataReaderImpl-java-NullPointerException-tp5584639p5584639.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: DataReaderImpl.java NullPointerException

Posted by Daniel Kulp <dk...@apache.org>.
Agreed.  A check for null is definitely warranted here.  I'll get that 
fixed.


Dan


On Wednesday, March 21, 2012 08:09:07 PM OpenDog wrote:
> In DataReaderImpl.java there is this hack in the
> WSUIDValidationHandler.handleEvent that parses the event's message (see
> below). It doesn't check for a null message. I have an envelope where I'm
> sent a syntactically incorrect number that results in a
> NumberFormatException with a null message.
> 
> It's annoying because I have to turn the jaxb validation handler off and I
> have to barf on the invalid data.
> 
> I thin k a simple "if ( msg!=null && ... " would do the trick. This is
> from 2.4 but I checked 2.5 it's still the same.
> 
> Thank you,
> Bela
> 
> This is the source.
> 
> /
> private static class WSUIDValidationHandler implements
> ValidationEventHandler {
>         ValidationEventHandler origHandler;
>         WSUIDValidationHandler(ValidationEventHandler o) {
>             origHandler = o;
>         }
> 
>         public boolean handleEvent(ValidationEvent event) {
>             String msg = event.getMessage();
>             if ((msg.startsWith("cvc-type.3.1.1: ")
> 
>                 || msg.startsWith("cvc-type.3.2.2: "))
> 
>                 && msg.contains(":Id")) {
>                 return true;
>             }
>             if (origHandler != null) {
>                 return origHandler.handleEvent(event);
>             }
>             return false;
>         }
>     }
> /
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/DataReaderImpl-java-NullPointerException-
> tp5584639p5584639.html Sent from the cxf-user mailing list archive at
> Nabble.com.
-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com