@@ -150,6 +150,7 @@ private static Object trimString(Object rawValue) {
150150 return rawValue ;
151151 }
152152
153+ // TODO: could extract some steps to a method
153154 private static Date parseDate (String key , InputSource source , Object value ) {
154155 List <String > extraDateFormats = null ;
155156 String dateFormat = null ;
@@ -183,7 +184,6 @@ private static Date parseDate(String key, InputSource source, Object value) {
183184 dateFormat = fileSource .dateFormat ();
184185 timeZone = fileSource .timeZone ();
185186 break ;
186-
187187 default :
188188 throw new IllegalArgumentException ("Date format source " +
189189 source .getClass ().getName () + " not supported" );
@@ -193,9 +193,9 @@ private static Date parseDate(String key, InputSource source, Object value) {
193193 return parseDate (key , value , dateFormat , timeZone );
194194 }
195195
196- HashSet <String > allDateFormats = new HashSet <>();
196+ Set <String > allDateFormats = new HashSet <>(extraDateFormats );
197197 allDateFormats .add (dateFormat );
198- allDateFormats . addAll ( extraDateFormats );
198+
199199 int size = allDateFormats .size ();
200200 for (String df : allDateFormats ) {
201201 try {
@@ -297,11 +297,11 @@ private static long parseLong(String rawValue) {
297297 }
298298 }
299299
300- private static Date parseDate (String key , Object value ,
301- String dateFormat , String timeZone ) {
300+ private static Date parseDate (String key , Object value , String dateFormat , String timeZone ) {
302301 if (value instanceof Date ) {
303302 return (Date ) value ;
304303 }
304+
305305 if (value instanceof Number ) {
306306 return new Date (((Number ) value ).longValue ());
307307 } else if (value instanceof String ) {
@@ -322,8 +322,7 @@ private static Date parseDate(String key, Object value,
322322 value .getClass ()));
323323 }
324324
325- private static List <Object > split (String key , String rawValue ,
326- InputSource source ) {
325+ private static List <Object > split (String key , String rawValue , InputSource source ) {
327326 List <Object > valueColl = new ArrayList <>();
328327 if (rawValue .isEmpty ()) {
329328 return valueColl ;
0 commit comments