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

            Bug ID: 58402
           Summary: AreaReference's SpreadsheetVersion instance variable
                    should be final
           Product: POI
           Version: 3.13-dev
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: SS Common
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
        Depends on: 56328

Created attachment 33099
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33099&action=edit
AreaReference.java patch

>From Bug 56328 (implemented in poi-3.13-beta1) r1685101

AreaReference's SpreadsheetVersion instance variable, _version is private and
is unable to be modified outside of the constructors (no setters provided).
This field should probably be final like the rest of the instance variables in
this class.

AreaReference(CellReference, CellReference) currently assumes
SpreadsheetVersion is EXCEL97. I deprecated this constructor in favor of
AreaReference(CellReference, CellReference, SpreadsheetVersion). I wasn't sure
what the preferred argument order was here, since the other constructor is
AreaReference(String, SpreadsheetVersion), but the static methods list
SpreadsheetVersion as the first argument. Your call.

I added a few other lines of defensive code to prevent NPEs.

One thing lead to another and I wrote unit tests for nearly all of
AreaReference. Note: many of these tests currently fail. In general, this class
should probably either delegate to a common cell reference string parser or
remove functions that operate on strings. It seems like allowing Strings that
do not match "[A-Z]+[0-9]+(:[A-Z]+[0-9]+)?" or perhaps even
"[A-Z]+[0-9]+:[A-Z]+[0-9]+" should raise an IllegalArgumentException--it
shouldn't be AreaReference's responsibility to strip off sheet information and
know sheet (and external workbook) naming rules.

Note: this patch requires further work before it can be committed.

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