{"action":"created","issue":{"url":"https://api.github.com/repos/Pi4J/pi4j/issues/217","repository_url":"https://api.github.com/repos/Pi4J/pi4j","labels_url":"https://api.github.com/repos/Pi4J/pi4j/issues/217/labels{/name}","comments_url":"https://api.github.com/repos/Pi4J/pi4j/issues/217/comments","events_url":"https://api.github.com/repos/Pi4J/pi4j/issues/217/events","html_url":"https://github.com/Pi4J/pi4j/issues/217","id":130824803,"number":217,"title":"RaspiPin.getPinByName(\"GPIO 2\") returns null in 1.1-SNAPSHOT","user":{"login":"mstevetodd","id":5759316,"avatar_url":"https://avatars.githubusercontent.com/u/5759316?v=3","gravatar_id":"","url":"https://api.github.com/users/mstevetodd","html_url":"https://github.com/mstevetodd","followers_url":"https://api.github.com/users/mstevetodd/followers","following_url":"https://api.github.com/users/mstevetodd/following{/other_user}","gists_url":"https://api.github.com/users/mstevetodd/gists{/gist_id}","starred_url":"https://api.github.com/users/mstevetodd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstevetodd/subscriptions","organizations_url":"https://api.github.com/users/mstevetodd/orgs","repos_url":"https://api.github.com/users/mstevetodd/repos","events_url":"https://api.github.com/users/mstevetodd/events{/privacy}","received_events_url":"https://api.github.com/users/mstevetodd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-02T21:35:22Z","updated_at":"2016-03-14T11:29:11Z","closed_at":null,"body":"Calling RaspiPin.getPinByName(\"GPIO 2\") (or any other pin by name) in 1.1-SNAPSHOT returns null, _unless_ one of the static values has been accessed earlier.  \r\nFor example, in ListenGpioExample.java, changing the line \r\n`final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.GPIO_02, PinPullResistance.PULL_DOWN);`\r\nto\r\n`final GpioPinDigitalInput myButton = gpio.provisionDigitalInputPin(RaspiPin.getPinByName(\"GPIO 2\"), PinPullResistance.PULL_DOWN);`\r\nresults in an error due to RaspiPin.getPinByName(\"GPIO 2\") returning null.\r\nIf I add a line like:\r\n`Pin tp = RaspiPin.GPIO_02;`\r\nprior to the line above, the getPinByName works properly.  It seems that something isn't being initialized, but I'm not sure what that is.\r\nThis syntax works fine in 1.0.  \r\nI've also compiled the latest development branch but it exhibits the same problem.\r\n\r\nRegards,\r\n  SteveT"},"comment":{"url":"https://api.github.com/repos/Pi4J/pi4j/issues/comments/196268804","html_url":"https://github.com/Pi4J/pi4j/issues/217#issuecomment-196268804","issue_url":"https://api.github.com/repos/Pi4J/pi4j/issues/217","id":196268804,"user":{"login":"sanados","id":7146844,"avatar_url":"https://avatars.githubusercontent.com/u/7146844?v=3","gravatar_id":"","url":"https://api.github.com/users/sanados","html_url":"https://github.com/sanados","followers_url":"https://api.github.com/users/sanados/followers","following_url":"https://api.github.com/users/sanados/following{/other_user}","gists_url":"https://api.github.com/users/sanados/gists{/gist_id}","starred_url":"https://api.github.com/users/sanados/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanados/subscriptions","organizations_url":"https://api.github.com/users/sanados/orgs","repos_url":"https://api.github.com/users/sanados/repos","events_url":"https://api.github.com/users/sanados/events{/privacy}","received_events_url":"https://api.github.com/users/sanados/received_events","type":"User","site_admin":false},"created_at":"2016-03-14T11:29:11Z","updated_at":"2016-03-14T11:29:11Z","body":"One thought though.\r\n\r\nIn RaspiPin line 47:\r\n\r\n`private static Map<String, Pin> pins = new HashMap<String, Pin>();`\r\n\r\nI would replace with\r\n\r\n`private static final Map<String, Pin> pins = new HashMap<>();`\r\n\r\n"}}