Bug 66278 - Bug with multiple gradient stops at the exact same location causing a rendering failure (AWT -> not enough colors in gradient)
Summary: Bug with multiple gradient stops at the exact same location causing a renderi...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: 5.2.2-FINAL
Hardware: PC Mac OS X 10.1
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-27 09:24 UTC by Gareth Floodgate
Modified: 2022-12-12 20:45 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gareth Floodgate 2022-09-27 09:24:11 UTC
When rendering a shape with a gradient fill that contains 2 or more stops that are at the exact same fractional position, the rendering will fail with the following exception:

User must specify at least 2 colors: java.lang.IllegalArgumentException java.lang.IllegalArgumentException: User must specify at least 2 colors at java.awt.MultipleGradientPaint.<init>(MultipleGradientPaint.java:169) at java.awt.LinearGradientPaint.<init>(LinearGradientPaint.java:286) at java.awt.LinearGradientPaint.<init>(LinearGradientPaint.java:244) at java.awt.LinearGradientPaint.<init>(LinearGradientPaint.java:211) at org.apache.poi.sl.draw.DrawPaint.lambda$createLinearGradientPaint$1(DrawPaint.java:548) at org.apache.poi.sl.draw.DrawPaint.safeFractions(DrawPaint.java:620) at org.apache.poi.sl.draw.DrawPaint.createLinearGradientPaint(DrawPaint.java:548) at org.apache.poi.sl.draw.DrawPaint.getGradientPaint(DrawPaint.java:244) at org.apache.poi.sl.draw.DrawPaint.getPaint(DrawPaint.java:167) at org.apache.poi.sl.draw.DrawPaint.getPaint(DrawPaint.java:157) at org.apache.poi.sl.draw.DrawSimpleShape.getFillPaint(DrawSimpleShape.java:144) at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:70) at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:71) at

This issue is resolved by PR:
https://github.com/apache/poi/pull/385
Comment 1 PJ Fanning 2022-09-27 12:09:44 UTC
Thanks - I merged the PR