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

            Bug ID: 59194
           Summary: org.apache.poi.ss.util.CellRangeAddressBase.getRectang
                    le() throws NoClassDefFoundError on Google App Engine
           Product: POI
           Version: 3.14-FINAL
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: rahul.herwad...@gmail.com

The following code example works fine with poi-3.13-20150929.jar on Google App
Engine environment:

      Workbook oWorkbook = new HSSFWorkbook();
      Sheet oSheet = oWorkbook.createSheet("Analysis");
      ...
      <code to init sRowIndex, oItemList etc.>
      ...
      oSheet.addMergedRegion(new CellRangeAddress(sRowIndex, sRowIndex, 3,
          oItemList.size() + 2));

The same code throws java.lang.NoClassDefFoundError error with latest
poi-3.14-20160307.jar:

      java.lang.NoClassDefFoundError: java.awt.geom.RectangularShape is a
restricted class. Please see the Google App Engine developer's guide for more
details.
    at
com.google.apphosting.runtime.security.shared.stub.java.awt.geom.RectangularShape.<clinit>(RectangularShape.java)
    at
org.apache.poi.ss.util.CellRangeAddressBase.getRectangle(CellRangeAddressBase.java:164)
    at
org.apache.poi.ss.util.CellRangeAddressBase.intersects(CellRangeAddressBase.java:140)
    at
org.apache.poi.hssf.usermodel.HSSFSheet.validateMergedRegions(HSSFSheet.java:722)
    at
org.apache.poi.hssf.usermodel.HSSFSheet.addMergedRegion(HSSFSheet.java:684)
        ...
        <application code similar to example code snippet goes here>

This is a regression between poi-3.13-20150929.jar and 3.14-20160307.jar.

The implementation for getRectangle() method in CellRangeAddressBase.java has a
TODO comment indicating a temporary workaround in rel 3.14:

    // TODO: Replace with an intersection code that doesn't rely on java.awt
    // Don't let this temporary implementation detail leak outside of this
class
    private final Rectangle getRectangle() {
        int firstRow, firstCol, lastRow, lastCol;

        if (!isFullColumnRange()) {
            firstRow = Math.min(_firstRow, _lastRow);
            lastRow = Math.max(_firstRow,  _lastRow);
        }
        else {
            firstRow = 0;
            lastRow = Integer.MAX_VALUE;
        }
        if (!isFullRowRange()) {
            firstCol = Math.min(_firstCol, _lastCol);
            lastCol = Math.max(_firstCol, _lastCol);
        }
        else {
            firstCol = 0;
            lastCol = Integer.MAX_VALUE;
        }
        return new Rectangle(firstRow, firstCol, lastRow-firstRow+1,
lastCol-firstCol+1);
    }

My use case is to create an MS Excel spreadsheet. As mentioned before, this use
case is working in rel 3.13 but breaks in 3.14 in the Google App Engine
environment.

-- 
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