XStream
  1. XStream
  2. XSTR-51

DateFormat throws exception if used by multiple threads concurrently

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 0.6
    • Component/s: Converters
    • Labels:
      None

      Description

      XStream should be thread safe, but some of the converters use DateFormat.. which isn't.

      Here's something that exposes it....

      final DateFormat df = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss.sss");

      Runnable r = new Runnable() {
      public void run() {
      for (int i = 0; i < 100; i++) {
      try

      { df.parse("2004-05-05 17:40:23.126"); }

      catch (ParseException e)

      { e.printStackTrace(); }

      //Object o = xStreamMarshaller.unmarshal(s);
      }
      System.out.println("done");
      }
      };

      for(int i = 0; i < 100; i++)

      { new Thread(r).start(); }

        People

        • Assignee:
          Unassigned
          Reporter:
          Joe Walnes
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: