When analyzing a large number of dates in java, I sometimes get this strange error:
java.lang.NumberFormatException: For input string: ".201144E4.201144E4" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1250) at java.lang.Double.parseDouble(Double.java:540) at java.text.DigitList.getDouble(DigitList.java:168) at java.text.DecimalFormat.parse(DecimalFormat.java:1321) at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1793) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1455) at java.text.DateFormat.parse(DateFormat.java:355) at gameloop.tf2tradebot.user.UserManager.getUser(UserManager.java:102) at gameloop.tradebot2.bot.weaponbot1.Weaponbot1.onMessageReceived(Weaponbot1.java:269) at gameloop.api.steam.chat.ChatEvent.run(ChatEvent.java:49) at java.lang.Thread.run(Thread.java:745)
In this case, the date was
2014-12-13 06:56:27
Date format was
private static final DateFormat STANDARD_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
My code is:
Date firstSeenDate = null; try { firstSeenDate = STANDARD_DATE_FORMAT.parse(firstSeen); } catch(Exception pe) { pe.printStackTrace(); logger.outputError(4001, "Error parsing first seen date. Shutting down..."); logger.outputError(4001, "First seen date : \'" + firstSeen + "\'"); CH405BotServer.shutdown(logger.getCallerName(), "an error in parsing first seen date"); } user.setFirstSeen(firstSeenDate);
Initial data:
isadmin = false firstseen = 2014-12-13 06:56:27 lastseen = 2014-12-13 06:56:27 numtrades = 0
EDIT: A line in the error log looks great:
(ERROR 4001) Error parsing first seen date. Shutting down... (ERROR 4001) Last seen date : '2014-12-13 06:56:27'
I need help on how to solve this problem.
source share