From d042bb37cb985910d2bbaa9b05b10764752fe870 Mon Sep 17 00:00:00 2001 From: lenamonj Date: Thu, 3 Sep 2026 22:26:50 -0400 Subject: [PATCH] Fix CSVPrinter.getRecordCount() Javadoc: the header record written by the constructor is counted --- src/main/java/org/apache/commons/csv/CSVPrinter.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java b/src/main/java/org/apache/commons/csv/CSVPrinter.java index 32343170f..b9e18ed75 100644 --- a/src/main/java/org/apache/commons/csv/CSVPrinter.java +++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java @@ -179,9 +179,10 @@ public Appendable getOut() { } /** - * Gets the record count printed, this does not include comments or headers. + * Gets the record count printed. This includes the header record written by the constructor when the format has a header and + * {@link CSVFormat#getSkipHeaderRecord()} is false; it does not include comments or headers written by {@link #printHeaders(ResultSet)}. * - * @return The record count, this does not include comments or headers. + * @return The record count, including the header record written by the constructor. * @since 1.13.0 */ public long getRecordCount() {