java.lang.NumberFormatException: For input string: ""

Jive Software Open Source | Robin Collier | 6 years ago
  1. 0

    Smack use SimpleDateFormat is not thread safe. I recently tested for workgroup extension. I use smack write client for many webchat and agent, and throw java.lang.NumberFormatException: For input string: "" in javadoc, java.text.SimpleDateFormat: Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally. But some places in smack, it use SimpleDateFormat as a static field for all parse and format in this class, and not synchronized, eg. org.jivesoftware.smackx.workgroup.packet.QueueDetails: private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss"); So, if multi thread conditions, it cause : java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Long.parseLong(Long.java:424) at java.lang.Long.parseLong(Long.java:461) at java.text.DigitList.getLong(DigitList.java:177) at java.text.DecimalFormat.parse(DecimalFormat.java:1298) at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1536) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1263) at java.text.DateFormat.parse(DateFormat.java:335) at org.jivesoftware.smackx.workgroup.packet.QueueDetails$Provider.parseExtension(Q ueueDetails.java:174) at org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension(PacketParser Utils.java:378) at org.jivesoftware.smack.util.PacketParserUtils.parsePresence(PacketParserUtils.j ava:204) at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:278) at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44) at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

    Jive Software Open Source | 6 years ago | Robin Collier
    java.lang.NumberFormatException: For input string: ""
  2. 0

    Smack use SimpleDateFormat is not thread safe. I recently tested for workgroup extension. I use smack write client for many webchat and agent, and throw java.lang.NumberFormatException: For input string: "" in javadoc, java.text.SimpleDateFormat: Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally. But some places in smack, it use SimpleDateFormat as a static field for all parse and format in this class, and not synchronized, eg. org.jivesoftware.smackx.workgroup.packet.QueueDetails: private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss"); So, if multi thread conditions, it cause : java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Long.parseLong(Long.java:424) at java.lang.Long.parseLong(Long.java:461) at java.text.DigitList.getLong(DigitList.java:177) at java.text.DecimalFormat.parse(DecimalFormat.java:1298) at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1536) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1263) at java.text.DateFormat.parse(DateFormat.java:335) at org.jivesoftware.smackx.workgroup.packet.QueueDetails$Provider.parseExtension(Q ueueDetails.java:174) at org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension(PacketParser Utils.java:378) at org.jivesoftware.smack.util.PacketParserUtils.parsePresence(PacketParserUtils.j ava:204) at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:278) at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44) at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

    JIRA | 6 years ago | Robin Collier
    java.lang.NumberFormatException: For input string: ""
  3. 0

    Smack use SimpleDateFormat is not thread safe. I recently tested for workgroup extension. I use smack write client for many webchat and agent, and throw java.lang.NumberFormatException: For input string: "" in javadoc, java.text.SimpleDateFormat: Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally. But some places in smack, it use SimpleDateFormat as a static field for all parse and format in this class, and not synchronized, eg. org.jivesoftware.smackx.workgroup.packet.QueueDetails: private static final SimpleDateFormat DATE_FORMATTER = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss"); So, if multi thread conditions, it cause : java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48) at java.lang.Long.parseLong(Long.java:424) at java.lang.Long.parseLong(Long.java:461) at java.text.DigitList.getLong(DigitList.java:177) at java.text.DecimalFormat.parse(DecimalFormat.java:1298) at java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1536) at java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1263) at java.text.DateFormat.parse(DateFormat.java:335) at org.jivesoftware.smackx.workgroup.packet.QueueDetails$Provider.parseExtension(Q ueueDetails.java:174) at org.jivesoftware.smack.util.PacketParserUtils.parsePacketExtension(PacketParser Utils.java:378) at org.jivesoftware.smack.util.PacketParserUtils.parsePresence(PacketParserUtils.j ava:204) at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:278) at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44) at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:76)

    Jive Software Open Source | 6 years ago | Robin Collier
    java.lang.NumberFormatException: For input string: ""
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Another exception...

    GitHub | 3 years ago | talios
    java.lang.NumberFormatException: For input string: ""
  6. 0

    thread issue in Static middleware

    GitHub | 4 years ago | bckfnn
    java.lang.NumberFormatException: For input string: ""

    4 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NumberFormatException

      For input string: ""

      at java.lang.NumberFormatException.forInputString()
    2. Java RT
      DateFormat.parse
      1. java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
      2. java.lang.Long.parseLong(Long.java:424)
      3. java.lang.Long.parseLong(Long.java:461)
      4. java.text.DigitList.getLong(DigitList.java:177)
      5. java.text.DecimalFormat.parse(DecimalFormat.java:1298)
      6. java.text.SimpleDateFormat.subParse(SimpleDateFormat.java:1536)
      7. java.text.SimpleDateFormat.parse(SimpleDateFormat.java:1263)
      8. java.text.DateFormat.parse(DateFormat.java:335)
      8 frames