cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-2727) NullPointerException at org.apache.cxf.transport.TransportURIResolver when the WSDL is not found instead of an exception with a useful message
Date Thu, 01 Apr 2010 18:35:27 GMT

    [ https://issues.apache.org/jira/browse/CXF-2727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852495#action_12852495
] 

Gary Gregory commented on CXF-2727:
-----------------------------------

Ok, cool, thank you for the fix.

When I look at the call sites for the method fixed, I see in CatalogWSDLLocator:

{code:java}
    public InputSource getBaseInputSource() {
        InputSource result = null;
        if (manager != null) {
            try {
                String s = manager.resolveSystem(baseUri);
                if (s != null) {
                    result = resolver.resolve(s, null);
                }
            } catch (MalformedURLException e) {
                //ignore
            } catch (IOException e) {
                //ignore
            }
        }
        if (result == null) {
            result = resolver.resolve(baseUri, null);
        }
        if (wsdlUrl == null
            && result != null) {
            wsdlUrl = result.getSystemId();
        }
        baseUri = resolver.getURI();
        return result;
    }
{code}

I do not see what the end of the method does unless there are some side-effects involved.
IOW, is this needed?

{code:java}
        if (wsdlUrl == null
            && result != null) {
            wsdlUrl = result.getSystemId();
        }
        baseUri = resolver.getURI();
{code}

It does not affect the result, at first glance at least.



> NullPointerException at org.apache.cxf.transport.TransportURIResolver when the WSDL is
not found instead of an exception with a useful message
> ----------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CXF-2727
>                 URL: https://issues.apache.org/jira/browse/CXF-2727
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.2.4
>            Reporter: Gary Gregory
>            Assignee: Daniel Kulp
>             Fix For: 2.2.8
>
>
> I get bit by this every time so you would I think I would learn: You get a {{NullPointerException
at org.apache.cxf.transport.TransportURIResolver}} when the WSDL is not found instead of an
Exception with a useful message,
> For example:
> {{WSDLServiceFactory factory = new WSDLServiceFactory(BusFactory.newInstance().createBus(),
wsdlUrlString.trim(), null);}}
> Where wsdlUrlString points to a resource that is not there, in my case a resource on
disk that is not there.
> {noformat}
> java.lang.NullPointerException
> 	at org.apache.cxf.transport.TransportURIResolver.resolve(TransportURIResolver.java:109)
> 	at org.apache.cxf.catalog.CatalogWSDLLocator.getBaseInputSource(CatalogWSDLLocator.java:72)
> 	at org.apache.cxf.wsdl11.AbstractWrapperWSDLLocator.getBaseInputSource(AbstractWrapperWSDLLocator.java:57)
> 	at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(Unknown Source)
> 	at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:210)
> 	at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:175)
> 	at org.apache.cxf.wsdl11.WSDLServiceFactory.&lt;init>(WSDLServiceFactory.java:91)
> 	at com.seagullsw.appinterface.server.comm.soap.SoapServletCxf$ValidatingInterceptor.initValidatingInterceptor(SoapServletCxf.java:952)
> 	at com.seagullsw.appinterface.server.comm.soap.SoapServletCxf$ValidatingInterceptor.addBefore(SoapServletCxf.java:931)
> 	at com.seagullsw.appinterface.server.comm.soap.SoapServletCxf.initValidators(SoapServletCxf.java:1303)
> 	at com.seagullsw.appinterface.server.comm.soap.SoapServletCxf.init(SoapServletCxf.java:1262)
> 	at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
> 	at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
> 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
> 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
> 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
> 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
> 	at org.mortbay.jetty.Server.handle(Server.java:322)
> 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
> 	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:938)
> 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:755)
> 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
> 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
> 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
> 	at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)
> {noformat}
> I can see in TransportURIResolver, that there is a {{null}} check for {{base}} but that
the last {{if}} in the method is not guarded for a {{null base}}
> Can we get a exception thrown with a URI not found or some such?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message