NPE in WMSServiceExtension if URL has no query string
-----------------------------------------------------

                 Key: UDIG-1218
                 URL: http://jira.codehaus.org/browse/UDIG-1218
             Project: uDIG
          Issue Type: Bug
          Components: wms
    Affects Versions: UDIG 1.1.RC9
         Environment: Windows XP, JRE 1.5.0_06-b05
            Reporter: Christian Gierer
         Assigned To: Richard Gould
         Attachments: .log

Using the import wizard to add a web map server causes unhandled 
NullPointerException if the entered URL contains no query string (no '?')

Method in WMSServiceExtension where exception will be thrown:
private static String processURL( URL url ) {
        if (url == null) {
            return Messages.WMSServiceExtension_nullURL;
        }

        String PATH = url.getPath();
        String QUERY = url.getQuery();
        String PROTOCOL = url.getProtocol();
        if (PROTOCOL.indexOf("http") == -1) { 
            return Messages.WMSServiceExtension_protocol + "'"+PROTOCOL+"'"; 
        }
        int indexOf = QUERY.toUpperCase().indexOf("SERVICE=");   // <-- NPE if 
QUERY is null!!!!!!!!
        if (QUERY != null && indexOf != -1) {
            // we have a service! It better be WMS
            if (QUERY.toUpperCase().indexOf("SERVICE=WMS") == -1) 
                return Messages.WMSServiceExtension_badService
                        + QUERY.substring(indexOf + 8, QUERY.indexOf('&', 
indexOf));
        } else if (PATH != null && PATH.toUpperCase().indexOf("GEOSERVER/WMS") 
!= -1) { 
            return null;
        }
        return null; // try it anyway
    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel

Reply via email to