Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Visitor
Posts: 1

BoxUser#getMemberships() method raises an UnsupportedOperationException

I was testing the sample deleting group members of each Box user, but an exception occurred.

It occurs with the frequency of deleting 5 group members of 3000 users.

Also, it is executed under multithreading.

 

The version of java sdk is 2.4.0

 

It occurred with the following code.

for(BoxGroupMembership.Info member : user.getResource().getMemberships()) {
	if(member.getGroup().getName().equals(group.getName())) {
		member.getResource().delete();
	}
}

I confirmed with the debugger that it turned out that there was a difference in response.

How can I avoid this?

 

Response without exception

{
    "total_count": 1,
    "entries": [{
        "type": "group_membership",
        "id":***phone number removed for privacy***",
        "user": {
            "type": "user",
            "id":***phone number removed for privacy***",
            "name": "\u5c71\u7530 \u524a\u9664 1183",
            "login": "***email address removed for privacy***"
        },
        "group": {
            "type": "group",
            "id": "***number removed for privacy***",
            "name": "group05"
        },
        "role": "member"
    }],
    "limit": 100,
    "offset": 0
}

Response with exception

{
    "total_count": 1,
    "entries": {
        "1": {
            "type": "group_membership",
            "id":***phone number removed for privacy***",
            "user": {
                "type": "user",
                "id":***phone number removed for privacy***",
                "name": "\u5c71\u7530 \u524a\u9664 0084",
                "login": "***email address removed for privacy***"
            },
            "group": {
                "type": "group",
                "id": "***number removed for privacy***",
                "name": "group04"
            },
            "role": "member"
        }
    },
    "limit": 100,
    "offset": 0
}