incubator-odf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "orgoo (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ODFTOOLKIT-364) cell range only has one cell will throw array index out of bound exception
Date Wed, 08 May 2013 08:29:19 GMT
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

Mime
View raw message