From: Greg Woolsey Date: Fri, 5 May 2017 21:50:59 +0000 (+0000) Subject: 60184 - invalid OOXML produced when XSSFFont.getFamily() called with no families... X-Git-Tag: REL_3_17_BETA1~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1a4724c9b1340609a5a76dbdeaa0d0511768781c;p=poi.git 60184 - invalid OOXML produced when XSSFFont.getFamily() called with no families defined Fix to stop creating an empty family when none exist, just use the existing logic to return NOT_APPLICABLE. Creating the empty element produces XML that doesn't comply with the XSD. Alternative would have been to set the family int value for the new family, but this way checking the value doesn't change the output, which is my preferred behavior. No quantum effects! git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1794111 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java index bdbbf74782..05b49671a0 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFFont.java @@ -598,7 +598,7 @@ public class XSSFFont implements Font { * @see org.apache.poi.ss.usermodel.FontFamily */ public int getFamily() { - CTIntProperty family = _ctFont.sizeOfFamilyArray() == 0 ? _ctFont.addNewFamily() : _ctFont.getFamilyArray(0); + CTIntProperty family = _ctFont.sizeOfFamilyArray() == 0 ? null : _ctFont.getFamilyArray(0); return family == null ? FontFamily.NOT_APPLICABLE.getValue() : FontFamily.valueOf(family.getVal()).getValue(); }