You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2010/05/22 18:24:22 UTC

svn commit: r947315 - in /poi/trunk: src/documentation/content/xdocs/status.xml src/java/org/apache/poi/hssf/usermodel/HSSFCell.java test-data/spreadsheet/49325.xlsx

Author: yegor
Date: Sat May 22 16:24:22 2010
New Revision: 947315

URL: http://svn.apache.org/viewvc?rev=947315&view=rev
Log:
avoid NPE when finding cell comments, Bugzilla 48846

Added:
    poi/trunk/test-data/spreadsheet/49325.xlsx   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=947315&r1=947314&r2=947315&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sat May 22 16:24:22 2010
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.7-SNAPSHOT" date="2010-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">48846 - Avoid NPE when finding cell comments</action>
            <action dev="POI-DEVELOPERS" type="fix">49325 - Ensure that CTPhoneticPr is included in poi-ooxml jar</action>
            <action dev="POI-DEVELOPERS" type="fix">49191 - Fixed tests failing in non-english locales</action>
            <action dev="POI-DEVELOPERS" type="add">48432 - Support for XSSF themes</action>

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=947315&r1=947314&r2=947315&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java Sat May 22 16:24:22 2010
@@ -1079,12 +1079,16 @@ public class HSSFCell implements Cell {
                 if (note.getRow() == row && note.getColumn() == column) {
                     if(i < noteTxo.size()) {
                         TextObjectRecord txo = noteTxo.get(note.getShapeId());
-                        comment = new HSSFComment(note, txo);
-                        comment.setRow(note.getRow());
-                        comment.setColumn((short) note.getColumn());
-                        comment.setAuthor(note.getAuthor());
-                        comment.setVisible(note.getFlags() == NoteRecord.NOTE_VISIBLE);
-                        comment.setString(txo.getStr());
+                        if(txo != null){
+                            comment = new HSSFComment(note, txo);
+                            comment.setRow(note.getRow());
+                            comment.setColumn(note.getColumn());
+                            comment.setAuthor(note.getAuthor());
+                            comment.setVisible(note.getFlags() == NoteRecord.NOTE_VISIBLE);
+                            comment.setString(txo.getStr());     
+                        } else{
+                            log.log(POILogger.WARN, "Failed to match NoteRecord and TextObjectRecord, row: " + row + ", column: " + column);
+                         }
                     } else {
                         log.log(POILogger.WARN, "Failed to match NoteRecord and TextObjectRecord, row: " + row + ", column: " + column);
                     }

Added: poi/trunk/test-data/spreadsheet/49325.xlsx
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/49325.xlsx?rev=947315&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/49325.xlsx
------------------------------------------------------------------------------
    svn:executable = *

Propchange: poi/trunk/test-data/spreadsheet/49325.xlsx
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org