{"action":"opened","issue":{"url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/393","repository_url":"https://api.github.com/repos/jamesagnew/hapi-fhir","labels_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/393/labels{/name}","comments_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/393/comments","events_url":"https://api.github.com/repos/jamesagnew/hapi-fhir/issues/393/events","html_url":"https://github.com/jamesagnew/hapi-fhir/issues/393","id":161621710,"number":393,"title":"Null pointer exception on @Extension field element1.","user":{"login":"ykovbtc","id":5816367,"avatar_url":"https://avatars.githubusercontent.com/u/5816367?v=3","gravatar_id":"","url":"https://api.github.com/users/ykovbtc","html_url":"https://github.com/ykovbtc","followers_url":"https://api.github.com/users/ykovbtc/followers","following_url":"https://api.github.com/users/ykovbtc/following{/other_user}","gists_url":"https://api.github.com/users/ykovbtc/gists{/gist_id}","starred_url":"https://api.github.com/users/ykovbtc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ykovbtc/subscriptions","organizations_url":"https://api.github.com/users/ykovbtc/orgs","repos_url":"https://api.github.com/users/ykovbtc/repos","events_url":"https://api.github.com/users/ykovbtc/events{/privacy}","received_events_url":"https://api.github.com/users/ykovbtc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-22T08:28:28Z","updated_at":"2016-06-22T08:28:28Z","closed_at":null,"body":"Fields marked as Extension should have a defined type, but no general like IElement.\r\nHowever it works without this annotation.\r\n\r\nThe same with direct IResource field. works fine without Extension annotation \r\n\r\n```java\r\n@ResourceDef(name = \"OperationOutcome\", profile = \"http://hl7.org/fhir/profiles/custom-operation-outcome\", id = \"custom-operation-outcome\")\r\npublic static class CustomOperationOutcome extends OperationOutcome {\r\n\r\n    @Child(name = \"someElement1\")\r\n    @Extension(definedLocally = false, isModifier = false, url = \"#someElement1\")\r\n    public IElement element1;\r\n}\r\n\r\n\r\n@DatatypeDef(name = \"CustomTiming\")\r\npublic static class CustomTimingDt extends TimingDt {\r\n\r\n    @Child(name = \"someValue\")\r\n    @Extension(definedLocally = false, isModifier = false, url = \"#someValue\")\r\n    public StringDt value;\r\n\r\n}\r\n\r\n@Test\r\npublic void testCustomDataTypeBugN1_NPE() {\r\n    CustomTimingDt customTimingDt = new CustomTimingDt();\r\n    customTimingDt.value = new StringDt(\"testTest\");\r\n\r\n    CustomOperationOutcome outcome = new CustomOperationOutcome();\r\n    outcome.element1 = customTimingDt;\r\n\r\n    IParser parser = FhirContext.forDstu2().newXmlParser();\r\n    String outcomeString = parser.encodeResourceToString(outcome);\r\n    CustomOperationOutcome parsedOutcome = parser.parseResource(CustomOperationOutcome.class, outcomeString);\r\n} \r\n```"}}
{"actor":{"display_login":"ykovbtc"}}