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 6f8613afa6..abaca3a5cf 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java @@ -80,7 +80,6 @@ import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogger; -import org.apache.poi.util.Removal; import org.apache.poi.util.Units; import org.apache.poi.xssf.model.CommentsTable; import org.apache.poi.xssf.usermodel.XSSFPivotTable.PivotTableReferenceConfigurator; @@ -4011,7 +4010,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { public List getDataValidations() { List xssfValidations = new ArrayList<>(); CTDataValidations dataValidations = this.worksheet.getDataValidations(); - if( dataValidations!=null && dataValidations.getCount() > 0 ) { + if (dataValidations != null) { for (CTDataValidation ctDataValidation : dataValidations.getDataValidationArray()) { CellRangeAddressList addressList = new CellRangeAddressList(); @@ -4031,6 +4030,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet { xssfValidations.add(xssfDataValidation); } } + return xssfValidations; } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index 5476e28688..7c2fed7a83 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -3661,4 +3661,12 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { assertEquals(CellType.NUMERIC, value.getCellType()); assertEquals(1, value.getNumberValue(), 0.01); } + + @Test + public void test64750() throws IOException { + try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("64750.xlsx")) { + Sheet sheet = wb.getSheet("Sheet1"); + assertEquals(1, sheet.getDataValidations().size()); + } + } } diff --git a/test-data/spreadsheet/64750.xlsx b/test-data/spreadsheet/64750.xlsx new file mode 100644 index 0000000000..7653dfe111 Binary files /dev/null and b/test-data/spreadsheet/64750.xlsx differ