{"action":"created","issue":{"url":"https://api.github.com/repos/cloudfoundry/cf-java-client/issues/871","repository_url":"https://api.github.com/repos/cloudfoundry/cf-java-client","labels_url":"https://api.github.com/repos/cloudfoundry/cf-java-client/issues/871/labels{/name}","comments_url":"https://api.github.com/repos/cloudfoundry/cf-java-client/issues/871/comments","events_url":"https://api.github.com/repos/cloudfoundry/cf-java-client/issues/871/events","html_url":"https://github.com/cloudfoundry/cf-java-client/issues/871","id":310158361,"number":871,"title":"V3 Organization with nullified updatedAt","user":{"login":"eaglerainbow","id":12811079,"avatar_url":"https://avatars2.githubusercontent.com/u/12811079?v=4","gravatar_id":"","url":"https://api.github.com/users/eaglerainbow","html_url":"https://github.com/eaglerainbow","followers_url":"https://api.github.com/users/eaglerainbow/followers","following_url":"https://api.github.com/users/eaglerainbow/following{/other_user}","gists_url":"https://api.github.com/users/eaglerainbow/gists{/gist_id}","starred_url":"https://api.github.com/users/eaglerainbow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eaglerainbow/subscriptions","organizations_url":"https://api.github.com/users/eaglerainbow/orgs","repos_url":"https://api.github.com/users/eaglerainbow/repos","events_url":"https://api.github.com/users/eaglerainbow/events{/privacy}","received_events_url":"https://api.github.com/users/eaglerainbow/received_events","type":"User","site_admin":false},"labels":[{"id":522036706,"url":"https://api.github.com/repos/cloudfoundry/cf-java-client/labels/bug","name":"bug","color":"ee0701","default":true},{"id":522046577,"url":"https://api.github.com/repos/cloudfoundry/cf-java-client/labels/client","name":"client","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/cloudfoundry/cf-java-client/milestones/45","html_url":"https://github.com/cloudfoundry/cf-java-client/milestone/45","labels_url":"https://api.github.com/repos/cloudfoundry/cf-java-client/milestones/45/labels","id":3189777,"number":45,"title":"2.28.0.RELEASE","description":"","creator":{"login":"twoseat","id":3470048,"avatar_url":"https://avatars2.githubusercontent.com/u/3470048?v=4","gravatar_id":"","url":"https://api.github.com/users/twoseat","html_url":"https://github.com/twoseat","followers_url":"https://api.github.com/users/twoseat/followers","following_url":"https://api.github.com/users/twoseat/following{/other_user}","gists_url":"https://api.github.com/users/twoseat/gists{/gist_id}","starred_url":"https://api.github.com/users/twoseat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twoseat/subscriptions","organizations_url":"https://api.github.com/users/twoseat/orgs","repos_url":"https://api.github.com/users/twoseat/repos","events_url":"https://api.github.com/users/twoseat/events{/privacy}","received_events_url":"https://api.github.com/users/twoseat/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":1,"state":"open","created_at":"2018-03-15T08:50:04Z","updated_at":"2018-03-30T20:26:07Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2018-03-30T20:14:42Z","updated_at":"2018-03-30T20:30:38Z","closed_at":null,"author_association":"NONE","body":"This is in reference to https://github.com/promregator/promregator/issues/36, where the following situation has happened:\r\n* CF platform running on API version 2.94.0\r\n* Client application using cf-java-client 3.3.0.RELEASE -- source code as of state tested can be reviewed at https://github.com/promregator/promregator/tree/31b001aecf1e9223a2fc0794bd2f725ca87a8e00\r\n* The interesting code part is at https://github.com/promregator/promregator/blob/31b001aecf1e9223a2fc0794bd2f725ca87a8e00/src/main/java/org/cloudfoundry/promregator/cfaccessor/CFAccessorImpl.java#L34 \r\n* Client application fires an `applicationsV3().list()` request, selecting a single known org there. Aim is to get the org's ID. \r\n* The Org, however, was created somewhere at 2016-07-26T17:01:24Z. In the response, the `updatedAt` is apparently nullified.\r\n* Error message (symptom), which is raised, reads:\r\n```\r\nCaused by: java.lang.IllegalStateException: Cannot build OrganizationResource, some of required attributes are not set [updatedAt]\r\n\tat org.cloudfoundry.client.v3.organizations.OrganizationResource$Builder.build(OrganizationResource.java:395) ~[cloudfoundry-client-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]\r\n\tat org.cloudfoundry.client.v3.organizations.OrganizationResource.fromJson(OrganizationResource.java:200) ~[cloudfoundry-client-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_162]\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_162]\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_162]\r\n\tat java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_162]\r\n\tat com.fasterxml.jackson.databind.introspect.AnnotatedMethod.call1(AnnotatedMethod.java:114) ~[jackson-databind-2.9.4.jar!/:2.9.4]\r\n\tat com.fasterxml.jackson.databind.deser.std.StdValueInstantiator._createUsingDelegate(StdValueInstantiator.java:525) ~[jackson-databind-2.9.4.jar!/:2.9.4]\r\n\t... 70 common frames omitted\r\n\r\n2018-03-29 22:02:08.018 ERROR 10 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.cloudfoundry.reactor.util.JsonParsingException: Cannot construct instance of `org.cloudfoundry.client.v3.organizations.OrganizationResource`, problem: Cannot build OrganizationResource, some of required attributes are not set [updatedAt]\r\n at [Source: (byte[])\"{\r\n  \"pagination\": {\r\n    \"total_results\": 1,\r\n    \"total_pages\": 1,\r\n    \"first\": {\r\n      \"href\": \"https://my.cf.api.com/v3/organizations?names=My-CF-Org&page=1&per_page=50\"\r\n    },\r\n    \"last\": {\r\n      \"href\": \"https://my.cf.api.com/v3/organizations?names=My-CF-Org&page=1&per_page=50\"\r\n    },\r\n    \"next\": null,\r\n    \"previous\": null\r\n  },\r\n  \"resources\": [\r\n    {\r\n      \"guid\": \"ac4d8f82-c606-44cf-bda5-6fa36e01bf20\",\r\n      \"created_at\": \"2016-07-26T17:0\"[truncated 248 bytes]; line: 25, column: 5] (through reference chain: org.cloudfoundry.client.v3.organizations.ListOrganizationsResponse$Json[\"resources\"]->java.util.ArrayList[0])] with root cause \r\n```\r\n* When requesting the same org via the `applicationsV2` api, the nullified `updatedAt` attribute becomes visible (output of `cf -v orgs`):\r\n```\r\n{\r\n  \"next_url\": null,\r\n  \"prev_url\": null,\r\n  \"resources\": [\r\n    {\r\n      \"entity\": {\r\n        \"app_events_url\": \"/v2/organizations/my-org-guid/app_events\",\r\n        \"auditors_url\": \"/v2/organizations/my-org-guid/auditors\",\r\n        \"billing_enabled\": false,\r\n        \"billing_managers_url\": \"/v2/organizations/my-org-guid/billing_managers\",\r\n        \"default_isolation_segment_guid\": null,\r\n        \"domains_url\": \"/v2/organizations/my-org-guid/domains\",\r\n        \"managers_url\": \"/v2/organizations/my-org-guid/managers\",\r\n        \"name\": \"My-Org\",\r\n        \"private_domains_url\": \"/v2/organizations/my-org-guid/private_domains\",\r\n        \"quota_definition_guid\": \"my-quota-guid\",\r\n        \"quota_definition_url\": \"/v2/quota_definitions/my-quota-guid\",\r\n        \"space_quota_definitions_url\": \"/v2/organizations/my-org-guid/space_quota_definitions\",\r\n        \"spaces_url\": \"/v2/organizations/my-org-guid/spaces\",\r\n        \"status\": \"active\",\r\n        \"users_url\": \"/v2/organizations/my-org-guid/users\"\r\n      },\r\n      \"metadata\": {\r\n        \"created_at\": \"2016-07-26T17:01:24Z\",\r\n        \"guid\": \"my-org-guid\",\r\n        \"updated_at\": null,\r\n        \"url\": \"/v2/organizations/my-org-guid\"\r\n      }\r\n    }\r\n  ],\r\n  \"total_pages\": 1,\r\n  \"total_results\": 1\r\n} \r\n```\r\n\r\nFurther details can also be found at the linked issue above.\r\n\r\nMy expectation would have been that the V3 applications API is capable of handling this case. If the `updatedAt` field is really considered mandatory, then I would have expected that it would be defaulted with the value of `createdAt`, which apparently is available.\r\n\r\nCase is not urgent, but something that might be worthwhile to look at - and perhaps cover in a beasty regression test...\r\n\r\nThanks for checking!"},"comment":{"url":"https://api.github.com/repos/cloudfoundry/cf-java-client/issues/comments/377615962","html_url":"https://github.com/cloudfoundry/cf-java-client/issues/871#issuecomment-377615962","issue_url":"https://api.github.com/repos/cloudfoundry/cf-java-client/issues/871","id":377615962,"user":{"login":"twoseat","id":3470048,"avatar_url":"https://avatars2.githubusercontent.com/u/3470048?v=4","gravatar_id":"","url":"https://api.github.com/users/twoseat","html_url":"https://github.com/twoseat","followers_url":"https://api.github.com/users/twoseat/followers","following_url":"https://api.github.com/users/twoseat/following{/other_user}","gists_url":"https://api.github.com/users/twoseat/gists{/gist_id}","starred_url":"https://api.github.com/users/twoseat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/twoseat/subscriptions","organizations_url":"https://api.github.com/users/twoseat/orgs","repos_url":"https://api.github.com/users/twoseat/repos","events_url":"https://api.github.com/users/twoseat/events{/privacy}","received_events_url":"https://api.github.com/users/twoseat/received_events","type":"User","site_admin":false},"created_at":"2018-03-30T20:30:38Z","updated_at":"2018-03-30T20:30:38Z","author_association":"COLLABORATOR","body":"Thanks for the report! Unfortunately the [documentation](http://v3-apidocs.cloudfoundry.org/version/3.41.0/index.html#apps) we rely on doesn't indicate optionality for that field, and as it's shared among all resources I want to be careful about changing it (especially as we've never seen an example that had that field nulled before!) The good news is that once I confirm that it can be null the fix is trivial, so assuming a change is needed it will be in the next release."}}
{"actor":{"display_login":"twoseat"}}