orgoo created ODFTOOLKIT-364:
--------------------------------

             Summary: cell range only has one cell will throw array index out 
of bound exception
                 Key: ODFTOOLKIT-364
                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-364
             Project: ODF Toolkit
          Issue Type: Bug
          Components: simple api
    Affects Versions: 0.5-incubating
         Environment: windows7
            Reporter: orgoo


for class "Table" : 

public CellRange getCellRangeByName(String name) {
                NodeList nameRanges;
                try {
                        nameRanges = 
mTableElement.getOwnerDocument().getElementsByTagNameNS(OdfDocumentNamespace.TABLE.getUri(),
                                        "named-range");
                        for (int i = 0; i < nameRanges.getLength(); i++) {
                                TableNamedRangeElement nameRange = 
(TableNamedRangeElement) nameRanges.item(i);
                                if 
(nameRange.getTableNameAttribute().equals(name)) {
                                        String cellRange = 
nameRange.getTableCellRangeAddressAttribute();
                                        String[] addresses = 
cellRange.split(":");
                                        return 
getCellRangeByPosition(addresses[0], addresses[1]);
                                }
                        }
                } catch (Exception e) {
                        
Logger.getLogger(Table.class.getName()).log(Level.SEVERE, e.getMessage(), e);
                }
                return null;
        }

if this cell range only has one cell, then : 

String cellRange = nameRange.getTableCellRangeAddressAttribute();
String[] addresses = cellRange.split(":");
return getCellRangeByPosition(addresses[0], addresses[1]);

will throw exception because String[] addresses only has addresses[0].

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to