{"action":"created","issue":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/1257","repository_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix","labels_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/1257/labels{/name}","comments_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/1257/comments","events_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/1257/events","html_url":"https://github.com/spring-cloud/spring-cloud-netflix/issues/1257","id":170990483,"number":1257,"title":"NullPointerException thrown if illegal characters are used in URI","user":{"login":"russTbaker","id":1695661,"avatar_url":"https://avatars.githubusercontent.com/u/1695661?v=3","gravatar_id":"","url":"https://api.github.com/users/russTbaker","html_url":"https://github.com/russTbaker","followers_url":"https://api.github.com/users/russTbaker/followers","following_url":"https://api.github.com/users/russTbaker/following{/other_user}","gists_url":"https://api.github.com/users/russTbaker/gists{/gist_id}","starred_url":"https://api.github.com/users/russTbaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russTbaker/subscriptions","organizations_url":"https://api.github.com/users/russTbaker/orgs","repos_url":"https://api.github.com/users/russTbaker/repos","events_url":"https://api.github.com/users/russTbaker/events{/privacy}","received_events_url":"https://api.github.com/users/russTbaker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/labels/help%20wanted","name":"help wanted","color":"bfe5bf"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-13T03:26:23Z","updated_at":"2016-08-16T20:42:02Z","closed_at":null,"body":"If illegal characters are used in the @FeignClient(\"&lt;service_name&gt;\") annotation, then the org.springframework.cloud.netflix.feign.ribbon.LoadBalancerFeignClient will throw a NullPointerException. \r\nThe execute method uses the following code to create the URI which is then passed down to the cleanUri method:\r\n\r\n        URI asUri = URI.create(request.url());\r\n        String clientName = asUri.getHost();\r\n        URI uriWithoutHost = cleanUrl(request.url(), clientName);\r\n\r\n\tstatic URI cleanUrl(String originalUrl, String host) {\r\n\t\treturn URI.create(originalUrl.replaceFirst(host, \"\"));\r\n\t}\r\n\r\nif the URI has an illegal character, then the \"host\" is null, which results in a NullPointerException.\r\n\r\nIf there was a check using a regular expression prior to creating the URI, then the user can be notified that the URL that is being passed in is invalid instead of throwing an NPE."},"comment":{"url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/comments/240231623","html_url":"https://github.com/spring-cloud/spring-cloud-netflix/issues/1257#issuecomment-240231623","issue_url":"https://api.github.com/repos/spring-cloud/spring-cloud-netflix/issues/1257","id":240231623,"user":{"login":"russTbaker","id":1695661,"avatar_url":"https://avatars.githubusercontent.com/u/1695661?v=3","gravatar_id":"","url":"https://api.github.com/users/russTbaker","html_url":"https://github.com/russTbaker","followers_url":"https://api.github.com/users/russTbaker/followers","following_url":"https://api.github.com/users/russTbaker/following{/other_user}","gists_url":"https://api.github.com/users/russTbaker/gists{/gist_id}","starred_url":"https://api.github.com/users/russTbaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/russTbaker/subscriptions","organizations_url":"https://api.github.com/users/russTbaker/orgs","repos_url":"https://api.github.com/users/russTbaker/repos","events_url":"https://api.github.com/users/russTbaker/events{/privacy}","received_events_url":"https://api.github.com/users/russTbaker/received_events","type":"User","site_admin":false},"created_at":"2016-08-16T20:42:02Z","updated_at":"2016-08-16T20:42:02Z","body":"Illegal according to the URI specification. I found this bug when I put in an underscore in my service name, which resulted in a null value for the host. So I didn’t want to narrow it down to just one character, rather to have all characters that might result in the host being null.\n\nHope that helps.\n\nRuss Baker\n> On Aug 16, 2016, at 14:35, Ryan Baxter <notifications@github.com> wrote:\n> \n> I assume when you say \"illegal characters\" you mean what is illegal in a URI? When I include ^ in my @FeignClient name, for example @FeignClient(name=\"f^o\"), I get an exception when registering the FeignClient and my application fails to start. Are you doing something different?\n> \n> java.lang.IllegalStateException: Service id not legal hostname (f^o)\n> \n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub <https://github.com/spring-cloud/spring-cloud-netflix/issues/1257#issuecomment-240229836>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABnfrTLZAF6EFYNOsdxQ7H18sXRmFwAgks5qgh8lgaJpZM4JjmCa>.\n> \n\n"}}
{"actor":{"display_login":"russTbaker"}}