{"action":"created","issue":{"url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/265","labels_url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/265/labels{/name}","comments_url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/265/comments","events_url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/265/events","html_url":"https://github.com/NanoHttpd/nanohttpd/issues/265","id":121182682,"number":265,"title":"SimpleWebServer crashes on static initializer","user":{"login":"Alviere","id":10413107,"avatar_url":"https://avatars.githubusercontent.com/u/10413107?v=3","gravatar_id":"","url":"https://api.github.com/users/Alviere","html_url":"https://github.com/Alviere","followers_url":"https://api.github.com/users/Alviere/followers","following_url":"https://api.github.com/users/Alviere/following{/other_user}","gists_url":"https://api.github.com/users/Alviere/gists{/gist_id}","starred_url":"https://api.github.com/users/Alviere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alviere/subscriptions","organizations_url":"https://api.github.com/users/Alviere/orgs","repos_url":"https://api.github.com/users/Alviere/repos","events_url":"https://api.github.com/users/Alviere/events{/privacy}","received_events_url":"https://api.github.com/users/Alviere/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-09T07:57:49Z","updated_at":"2015-12-11T13:29:06Z","closed_at":null,"body":"Hi everyone!\r\nI faced an issue while trying to use nanohttpd-webserver in my android app:\r\n\r\n```\r\njava.lang.NullPointerException: Attempt to invoke virtual method 'int java.io.InputStream.read(byte[])' on a null object reference\r\n        at fi.iki.elonen.SimpleWebServer.<clinit>(SimpleWebServer.java:83)\r\n```\r\n\r\nThis is actually happens because `InputStream` of LICENSE.txt is null and static initializer catches only `IOException`\r\n\r\n```\r\n    static {\r\n        mimeTypes();\r\n        InputStream stream = SimpleWebServer.class.getResourceAsStream(\"/LICENSE.txt\");\r\n        ByteArrayOutputStream bytes = new ByteArrayOutputStream();\r\n        byte[] buffer = new byte[1024];\r\n        int count;\r\n        String text;\r\n        try {\r\n            while ((count = stream.read(buffer)) >= 0) {\r\n                bytes.write(buffer, 0, count);\r\n            }\r\n            text = bytes.toString(\"UTF-8\");\r\n        } catch (IOException e) {\r\n            text = \"unknown\";\r\n        }\r\n        LICENCE = text;\r\n    }\r\n```\r\n\r\nDoes anybody know what can be done about it? I simply can't start web server because of that.\r\nThanks in advance!"},"comment":{"url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/comments/163936301","html_url":"https://github.com/NanoHttpd/nanohttpd/issues/265#issuecomment-163936301","issue_url":"https://api.github.com/repos/NanoHttpd/nanohttpd/issues/265","id":163936301,"user":{"login":"LordFokas","id":3021352,"avatar_url":"https://avatars.githubusercontent.com/u/3021352?v=3","gravatar_id":"","url":"https://api.github.com/users/LordFokas","html_url":"https://github.com/LordFokas","followers_url":"https://api.github.com/users/LordFokas/followers","following_url":"https://api.github.com/users/LordFokas/following{/other_user}","gists_url":"https://api.github.com/users/LordFokas/gists{/gist_id}","starred_url":"https://api.github.com/users/LordFokas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LordFokas/subscriptions","organizations_url":"https://api.github.com/users/LordFokas/orgs","repos_url":"https://api.github.com/users/LordFokas/repos","events_url":"https://api.github.com/users/LordFokas/events{/privacy}","received_events_url":"https://api.github.com/users/LordFokas/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T13:29:06Z","updated_at":"2015-12-11T13:29:06Z","body":"How about NOT deleting LICENSE.TXT, so that the stream isn't null? ;)\r\nYou're not supposed to edit or remove the license of something you don't own."}}