commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject [1/2] [lang] Fix NullPointerException in FastDateParser$TimeZoneStrategy
Date Thu, 17 Dec 2015 15:47:06 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master 1002c9e24 -> c8cc65165


Fix NullPointerException in FastDateParser$TimeZoneStrategy

Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/5556026e
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/5556026e
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/5556026e

Branch: refs/heads/master
Commit: 5556026ed1dc17e70946a4a030842ade3a33baeb
Parents: 56907c9
Author: Nick Manley <nm3n8@mail.umkc.edu>
Authored: Thu Nov 19 23:24:05 2015 -0600
Committer: Nick Manley <nm3n8@mail.umkc.edu>
Committed: Thu Nov 19 23:24:05 2015 -0600

----------------------------------------------------------------------
 src/main/java/org/apache/commons/lang3/time/FastDateParser.java  | 3 +++
 .../commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5556026e/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
index 26538d7..6abcd03 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateParser.java
@@ -853,6 +853,9 @@ public class FastDateParser implements DateParser, Serializable {
                 final TimeZone tz = TimeZone.getTimeZone(tzId);
                 for(int i= 1; i<zoneNames.length; ++i) {
                     String zoneName = zoneNames[i];
+                    if (zoneName == null) {
+                        break;
+                    }
                     if (tzNames.put(zoneName.toLowerCase(locale), tz) == null) {
                         simpleQuote(sb.append('|'), zoneName);
                     }

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/5556026e/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
index 34a67c0..be08454 100644
--- a/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/FastDateParser_TimeZoneStrategyTest.java
@@ -33,7 +33,9 @@ public class FastDateParser_TimeZoneStrategyTest {
             for(final String[] zone :  zones) {
                 for(int t = 1; t<zone.length; ++t) {
                     final String tzDisplay = zone[t];
-
+                    if (tzDisplay == null) {
+                        break;
+                    }
                     try {
                         parser.parse(tzDisplay);
                     }


Mime
View raw message