Menu

#60 JETT exception because of some unknown color in an Excel template

1.0
closed
nobody
None
2017-02-18
2015-10-09
No

Hi,

Recently I was customizing a customer's xlsx and got this error while rendering with JETT:

java.lang.ArrayIndexOutOfBoundsException: 81
at net.sf.jett.model.ExcelColor.getHssfColorByIndex(ExcelColor.java:248)
at net.sf.jett.util.SheetUtil.getXSSFColorHexString(SheetUtil.java:2494)
at net.sf.jett.util.SheetUtil.getColorHexString(SheetUtil.java:2429)
at net.sf.jett.model.FontCache.getRepresentation(FontCache.java:179)
at net.sf.jett.model.FontCache.getRepresentation(FontCache.java:152)
at net.sf.jett.model.FontCache.cacheFont(FontCache.java:110)
at net.sf.jett.model.FontCache.cachePreExistingFonts(FontCache.java:57)
at net.sf.jett.model.FontCache.<init>(FontCache.java:44)

This is caused by some kind of invalid coloring in the Excel sheet. I've patched the code for myself with a trivial index-check. Maybe such should be added to JETT itself too ?

Discussion

  • Randy Gettman

    Randy Gettman - 2016-02-23

    Zoltan,

    Some patch should be created to avoid this AIOOBE. I'm curious, what color does this represent? Black? Automatic? Is it possible for you to please attach the spreadsheet that caused this exception?

    This will help me determine the best course of action when this value appears in a template spreadsheet.

    Thanks,
    Randy Gettman

     
  • Randy Gettman

    Randy Gettman - 2016-04-15

    I was able to duplicate this issue finally. It appears that comments use the index 81 for the font color. Excel doesn't allow you to set the text color of comments, and it renders that text black. So, I'm having JETT consider this index 81 to be the color black. This will prevent the crash that you have observed.

    I have checked in code to resolve this issue, and it will be part of the next JETT build.

     
  • Randy Gettman

    Randy Gettman - 2017-02-18
    • status: open --> closed
     
  • Randy Gettman

    Randy Gettman - 2017-02-18

    This was included in JETT 0.10.0, which was released on May 5, 2016.

     

Log in to post a comment.