Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ODFTOOLKIT-398: Prevent NPE in getCellBackgroundColor. Patch by David…

… Reepmeyer.

git-svn-id: https://svn.apache.org/repos/asf/incubator/odf/trunk@1684559 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 8ad91b2ee746d5e11e1c9d02ab316de53cc0e1f1 1 parent 0610e68
Florian Hopf authored
View
36 CHANGES.txt
@@ -1,6 +1,42 @@
Apache ODF Toolkit Change Log
=============================
+======= Release 0.6.2 =======
+
+The most notable changes in ODF Toolkit 0.6.2 incubating over previous release:
+
+Release wiki page: https://cwiki.apache.org/confluence/display/ODFTOOLKIT/0.6.2-incubating
+
+Versions of major components
+----------------------------
+
+* Xerces 2.9.1 (http://xerces.apache.org/mirrors.cgi)
+* Apache Jena 2.9.4 (http://jena.apache.org/download/index.html)
+* Apache Commons Validator 1.4.0 (http://commons.apache.org/proper/commons-validator//download_validator.cgi)
+
+For a full dependecy list run mvn dependency:tree from the top level in the source module or see the release wiki page.
+
+Upgrading from 0.6.1-incubating
+-----------------------------
+
+
+Detailed Change List
+--------------------
+
+New Features
+------------
+
+Optimizations
+-------------
+
+Bug Fixes
+---------
+
+* ODFTOOLKIT-398 prevent NullPointerException in getCellBackgroundColor() (Florian Hopf, Patch by David Reepmeyer)
+
+Other
+-----
+
======= Release 0.6.1 =======
The most notable changes in ODF Toolkit 0.6.1 incubating over previous release:
View
4 simple/src/main/java/org/odftoolkit/simple/table/CellStyleHandler.java
@@ -425,7 +425,9 @@ public Color getBackgroundColor() {
if (!isDefault) {
OdfDefaultStyle defaultStyle = getCellDefaultStyle();
TableCellProperties defaultStyleSetting = TableCellProperties.getTableCellProperties(defaultStyle);
- tempColor = defaultStyleSetting.getBackgroundColor();
+ if (defaultStyleSetting != null) {
+ tempColor = defaultStyleSetting.getBackgroundColor();
+ }
}
// use default
if (tempColor == null)
View
46 simple/src/test/java/org/odftoolkit/simple/SpreadsheetWithoutTableCellPropertiesTest.java
@@ -0,0 +1,46 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.odftoolkit.simple;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.odftoolkit.simple.table.Table;
+import org.odftoolkit.simple.utils.ResourceUtilities;
+import org.odftoolkit.simple.table.Cell;
+import org.odftoolkit.odfdom.type.Color;
+
+public class SpreadsheetWithoutTableCellPropertiesTest {
+
+ private final static String TEST_FILE_NAME = "TestCellWithoutTableCellProperties.ods";
+
+ @Test
+ public void testGetCellBackgroundColorOfEmptySpace() throws Exception {
+ SpreadsheetDocument document = SpreadsheetDocument.loadDocument(ResourceUtilities
+ .getTestResourceAsStream(TEST_FILE_NAME));
+ Table table = document.getSheetByIndex(0);
+ Cell cell = table.getCellByPosition(0, 0);
+ Color color = cell.getCellBackgroundColor();
+ Assert.assertEquals(color, org.odftoolkit.odfdom.type.Color.WHITE);
+ }
+}
View
BIN  simple/src/test/resources/TestCellWithoutTableCellProperties.ods
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.