aboutsummaryrefslogtreecommitdiffstats
path: root/poi/src
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2023-02-09 15:22:21 +0000
committerPJ Fanning <fanningpj@apache.org>2023-02-09 15:22:21 +0000
commitc2d2ec0eaf9b994820810a9b561ab7a5b49557c5 (patch)
tree3aeed8b9c8578a6edcd61a399ea860b082edff33 /poi/src
parentc4e2eebbaf3fdace3e26d696de2ccb2f91cdf310 (diff)
downloadpoi-c2d2ec0eaf9b994820810a9b561ab7a5b49557c5.tar.gz
poi-c2d2ec0eaf9b994820810a9b561ab7a5b49557c5.zip
DataFormatter - typo in javadoc and possible NPE
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907543 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src')
-rw-r--r--poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java b/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java
index 54b1bfe8b1..fe14527066 100644
--- a/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java
+++ b/poi/src/main/java/org/apache/poi/ss/usermodel/DataFormatter.java
@@ -99,7 +99,7 @@ import org.apache.poi.util.StringUtil;
* The trailing underscore and space ("_ ") in the format adds a space to the end and Excel formats this cell as {@code "12.34 "},
* but {@code DataFormatter} trims the formatted value and returns {@code "12.34"}.
* </p>
- * You can enable spaces by passing the {@code emulateCSV=true} flag in the {@code DateFormatter} cosntructor.
+ * You can enable spaces by passing the {@code emulateCSV=true} flag in the {@code DateFormatter} constructor.
* If set to true, then the output tries to conform to what you get when you take an xls or xlsx in Excel and Save As CSV file:
* <ul>
* <li>returned values are not trimmed</li>
@@ -496,7 +496,11 @@ public class DataFormatter {
return generalNumberFormat;
}
- if(DateUtil.isADateFormat(formatIndex,formatStr) &&
+ if (formatStr == null) {
+ return null;
+ }
+
+ if(DateUtil.isADateFormat(formatIndex, formatStr) &&
DateUtil.isValidExcelDate(cellValue)) {
return createDateFormat(formatStr, cellValue);
}