https://bz.apache.org/bugzilla/show_bug.cgi?id=60255

--- Comment #9 from Javen O'Neal <one...@apache.org> ---
(In reply to Nick Burch from comment #7)
> r1764863
Is there anything special about the special 9999 and 1000? Could a workbook
have more drawings than this (and then POI artificially limits drawing creation
to 1000)?

I was thinking of something along the lines of

NavigableSet<Integer> takenIDs = new TreeSet<Integer>();
for (PackagePart part : packages) {
    takenIDs.add(part.getRefID());
}
int previous = 0;
for (int id : takenIDs.tailSet(1)) {
    if (id != previous+1) {
        // a gap was found or the taken IDs did not start at 1
        return previous+1;
    }
}
// there were no gaps in takenIDs. Assign the max taken ID + 1.
return takenIDs.last() + 1;

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to