Say some thing no npe experienced.

On Mon, 8 Dec 2025 at 18:33, <[email protected]> wrote:

> https://bz.apache.org/bugzilla/show_bug.cgi?id=69897
>
>             Bug ID: 69897
>            Summary: NullPointerException from XSLFSimpleShape.getLineDash
>            Product: POI
>            Version: unspecified
>           Hardware: All
>                 OS: All
>             Status: NEW
>           Severity: normal
>           Priority: P2
>          Component: XSLF
>           Assignee: [email protected]
>           Reporter: [email protected]
>   Target Milestone: ---
>
> Cannot invoke
>
> "org.openxmlformats.schemas.drawingml.x2006.main.STPresetLineDashVal$Enum.intValue()"
> because the return value of
>
> "org.openxmlformats.schemas.drawingml.x2006.main.CTPresetLineDashProperties.getVal()"
> is null
>
> Stack trace:
>
> java.lang.NullPointerException
>         at
>
> org.apache.poi.xslf.usermodel.XSLFSimpleShape$5.fetch(XSLFSimpleShape.java:542)
>         at
>
> org.apache.poi.xslf.usermodel.XSLFShape.fetchShapeProperty(XSLFShape.java:337)
>         at
>
> org.apache.poi.xslf.usermodel.XSLFSimpleShape.getLineDash(XSLFSimpleShape.java:546)
>         at
>
> org.apache.poi.xslf.usermodel.XSLFSimpleShape$9.getLineDash(XSLFSimpleShape.java:1045)
>         at org.apache.poi.sl.draw.DrawShape.getStroke(DrawShape.java:222)
>         at
> org.apache.poi.sl.draw.DrawSimpleShape.getStroke(DrawSimpleShape.java:341)
>
> Fixed method:
>
>     public StrokeStyle.LineDash getLineDash() {
>
>         PropertyFetcher<StrokeStyle.LineDash> fetcher = new
> PropertyFetcher<StrokeStyle.LineDash>() {
>             @Override
>             public boolean fetch(XSLFShape shape) {
>                 CTLineProperties ln = getLn(shape, false);
>                 if (ln == null || !ln.isSetPrstDash() || ln.getPrstDash()
> ==
> null || ln.getPrstDash().getVal() == null) {
>                     return false;
>                 }
>
>
>
> setValue(StrokeStyle.LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue()));
>                 return true;
>             }
>         };
>         fetchShapeProperty(fetcher);
>
>         StrokeStyle.LineDash dash = fetcher.getValue();
>         if (dash == null) {
>             CTLineProperties defaultLn = getDefaultLineProperties();
>             if (defaultLn != null && defaultLn.isSetPrstDash() &&
> defaultLn.getPrstDash() != null && defaultLn.getPrstDash().getVal() !=
> null) {
>                 dash =
>
> StrokeStyle.LineDash.fromOoxmlId(defaultLn.getPrstDash().getVal().intValue());
>             }
>         }
>         return dash;
>     }
>
> --
> You are receiving this mail because:
> You are the assignee for the bug.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to