microsoftgraph / microsoftgraph/msgraph-sdk-java

"java.lang.IllegalArgumentException: Collection is empty" when calling `lastEstimateStatisticsOperation`

Open
#2,656 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:waiting-for-triage type:bug
Dominant language
Java
Stars
444
Forks
154
Avg merge
18h 28m
Merged PRs (30d)
4

Description

Describe the bug

I'm fetching Search estimate statistics in Purview using the following call:

EdiscoveryEstimateOperation estimateOperation = client.security()
                .cases()
                .ediscoveryCases()
                .byEdiscoveryCaseId(caseId)
                .searches()
                .byEdiscoverySearchId(searchId)
                .lastEstimateStatisticsOperation()
                .get();

This consistently fails with the following error:

java.lang.IllegalArgumentException: Collection is empty
    at java.base/java.util.EnumSet.copyOf(EnumSet.java:177)
    at com.microsoft.kiota.serialization.JsonParseNode.getEnumSetValue(JsonParseNode.java:257)
    at com.microsoft.graph.beta.models.security.EdiscoveryEstimateOperation.lambda$getFieldDeserializers$6(EdiscoveryEstimateOperation.java:41)
    at com.microsoft.kiota.serialization.JsonParseNode.assignFieldValues(JsonParseNode.java:280)
    at com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java:192)
    at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:322)
    at com.microsoft.graph.beta.security.cases.ediscoverycases.item.searches.item.lastestimatestatisticsoperation.LastEstimateStatisticsOperationRequestBuilder.get(LastEstimateStatisticsOperationRequestBuilder.java:61)
    at com.microsoft.graph.beta.security.cases.ediscoverycases.item.searches.item.lastestimatestatisticsoperation.LastEstimateStatisticsOperationRequestBuilder.get(LastEstimateStatisticsOperationRequestBuilder.java:47)

It seems like response deserialization isn't working correctly, probably for the statisticsOptions field? It might be relevant that there doesn't seem to be any way to specify statisticsOptions when triggering statistics generation through the API.

Expected behavior

I expect this SDK call to successfully return an EdiscoveryEstimateOperation for the given search.

How to reproduce

I'm starting statistics generation with the following call:

client.security()
                .cases()
                .ediscoveryCases()
                .byEdiscoveryCaseId(caseId)
                .searches()
                .byEdiscoverySearchId(searchId)
                .microsoftGraphSecurityEstimateStatistics()
                .post();

Fetching statistics with the call listed above then triggers the bug.

SDK Version

beta 6.61.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated EdiscoveryEstimateOperation deserializer at EdiscoveryEstimateOperation.java:41 and trace JsonParseNode.getEnumSetValue, using the reported lastEstimateStatisticsOperation request as the reproduction. Compare the response handling for statisticsOptions with the API response and add or update a focused deserialization test if the repository provides one. Done means the call returns an EdiscoveryEstimateOperation without the empty-collection exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.