From fab3636895d0db5f16b93f7684510a266a42b4fa Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 16 Nov 2011 10:33:05 +0000 Subject: [PATCH] Patch from bug #52190 - null check on XWPF setFontFamily git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1202620 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java | 1 - src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index fce325aa74..ee49e67d78 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 52190 - null check on XWPF setFontFamily 52062 - ensure that temporary files in SXSSF are deleted 50936 - Exception parsing MS Word 8.0 file (as duplicate of 47958) 47958 - ArrayIndexOutOfBoundsException from PicturesTable.getAllPictures() during Escher tree walk diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java index e87dd0daaa..b1d532427b 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -91,7 +91,6 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSelection; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetCalcPr; -import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetData; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetFormatPr; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetPr; import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetProtection; diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java index 4e905ec6af..73629f7467 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFRun.java @@ -461,7 +461,7 @@ public class XWPFRun { * @param fontFamily */ public void setFontFamily(String fontFamily) { - CTRPr pr = run.getRPr(); + CTRPr pr = run.isSetRPr() ? run.getRPr() : run.addNewRPr(); CTFonts fonts = pr.isSetRFonts() ? pr.getRFonts() : pr.addNewRFonts(); fonts.setAscii(fontFamily); } -- 2.39.5