[MGNLUI-3623] Division by zero in JcrThumbnailContainer with less than 3 assets Created: 13/Oct/15  Updated: 14/Oct/15  Resolved: 14/Oct/15

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: 5.4.2
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Nils Breunese Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
duplicate
duplicates MGNLUI-3502 Exception in thumbnail view when havi... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

When there are less than 3 assets opening the thumbnail view in the assets app results in a division by zero error.

In info.magnolia.ui.workbench.thumbnail.JcrThumbnailContainer#setPageSize pageSize gets divided by 3, but since this in an integer division 2/3 = 0.

Then in AbstractJcrContainer#updateOffsetAndCache you get a division by zero in this code:

currentOffset = (index / (pageLength * cacheRatio)) * (pageLength * cacheRatio);

(Maybe this calculation should be more like the one in AbstractJcrContainer#indexOfId, which has a similar statement, but with +1 in the division?)



 Comments   
Comment by Michael Mühlebach [ 14/Oct/15 ]

Thank you for taking the time to report this issue. It is already fixed and will be released with 5.4.3. I linked the fixing issue and will close this one.

Generated at Mon Feb 12 09:08:29 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.