sebb        2003/12/16 05:02:03

  Modified:    src/protocol/http/org/apache/jmeter/protocol/http/control
                        CookieManager.java
  Log:
  Make dateFormat an instance variable to avoid any synchronization errors
  
  Revision  Changes    Path
  1.21      +10 -11    
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java
  
  Index: CookieManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/CookieManager.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- CookieManager.java        14 Dec 2003 17:24:11 -0000      1.20
  +++ CookieManager.java        16 Dec 2003 13:02:02 -0000      1.21
  @@ -101,20 +101,19 @@
       public static final String CLEAR = "CookieManager.clearEachIteration";
       public static final String COOKIES = "CookieManager.cookies";
   
  -    // FIXME: SimpleDateFormat isn't thread-safe, so we need to synchronize
  -    // access to it.
  -    private static SimpleDateFormat dateFormat =
  +    // SimpleDateFormat isn't thread-safe
  +    // TestElements are cloned for each thread, so
  +    // we use an instance variable.
  +    private SimpleDateFormat dateFormat =
           new SimpleDateFormat("EEEE, dd-MMM-yy HH:mm:ss zzz");
   
  -    static {
  -        // The cookie specification requires that the timezone be GMT.
  -        // See 
http://developer.netscape.com/docs/manuals/communicator/jsguide4/cookies.htm
  -        // See http://www.cookiecentral.com/faq/
  -        dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
  -    }
  -
       public CookieManager()
       {
  +             // The cookie specification requires that the timezone be GMT.
  +             // See 
http://developer.netscape.com/docs/manuals/communicator/jsguide4/cookies.htm
  +             // See http://www.cookiecentral.com/faq/
  +             dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
  +
           setProperty(new CollectionProperty(COOKIES, new ArrayList()));
           setProperty(new BooleanProperty(CLEAR, false));
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to