diff --git a/pom.xml b/pom.xml index 8fc1457..ab3753c 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.eficode.atlassian jirainstancemanager - 2.1.11 + 2.1.12 A groovy library for interacting with Jira REST API. @@ -58,7 +58,7 @@ com.eficode devstack-standalone - 2.3.25 + 2.3.26 test diff --git a/src/main/groovy/com/eficode/atlassian/jiraInstanceManager/beans/UserRestBean.groovy b/src/main/groovy/com/eficode/atlassian/jiraInstanceManager/beans/UserRestBean.groovy index 4b9a2a7..1bb388b 100644 --- a/src/main/groovy/com/eficode/atlassian/jiraInstanceManager/beans/UserRestBean.groovy +++ b/src/main/groovy/com/eficode/atlassian/jiraInstanceManager/beans/UserRestBean.groovy @@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonAnyGetter import com.fasterxml.jackson.annotation.JsonAnySetter import com.fasterxml.jackson.annotation.JsonIgnore import com.fasterxml.jackson.annotation.JsonSetter +import org.slf4j.Logger +import org.slf4j.LoggerFactory class UserRestBean { @@ -24,18 +26,37 @@ class UserRestBean { public String expand public String lastLoginTime + @JsonIgnore + static Logger log = LoggerFactory.getLogger(UserRestBean.class) + @JsonIgnore private Map additionalProperties = new LinkedHashMap() @JsonSetter("groups") void setGroup(Map rawMap) { - this.groups = (rawMap.get("items") as Map)?.collect {it."name"} + try { + ArrayList items = rawMap.get("items", null) as ArrayList + ArrayList groupNames = items?.collect {it.get("name", null)} + this.groups = groupNames + }catch (Throwable ex) { + log.error("Error parsing groups based on raw input:" + rawMap) + throw ex + } + } @JsonSetter("applicationRoles") void setApplicationRoles(Map rawMap) { - this.applicationRoles = (rawMap.get("items") as Map)?.collect {it."key"} + + try { + ArrayList items = rawMap.get("items", null) as ArrayList + ArrayList roleNames = items?.collect {it.get("key", null)} + this.applicationRoles = roleNames + }catch (Throwable ex) { + log.error("Error parsing applicationRoles based on raw input:" + rawMap) + throw ex + } }