[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-bugs] #17033 [metrics-lib]: failing tests due to system locale



#17033: failing tests due to system locale
-----------------------------+---------------------
     Reporter:  iwakeh       |      Owner:  karsten
         Type:  defect       |     Status:  new
     Priority:  minor        |  Milestone:
    Component:  metrics-lib  |    Version:
   Resolution:               |   Keywords:
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+---------------------

Comment (by karsten):

 There, reproduced it!

 But how about we fix this in the source rather than in the tests?  How's
 this fix?

 {{{
 diff --git a/src/org/torproject/descriptor/impl/ParseHelper.java
 b/src/org/torproject/descriptor/impl/ParseHelper.java
 index 761a93d..4e91e92 100644
 --- a/src/org/torproject/descriptor/impl/ParseHelper.java
 +++ b/src/org/torproject/descriptor/impl/ParseHelper.java
 @@ -6,6 +6,7 @@ import java.text.DateFormat;
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.HashMap;
 +import java.util.Locale;
  import java.util.Map;
  import java.util.SortedMap;
  import java.util.TimeZone;
 @@ -156,7 +157,7 @@ public class ParseHelper {
    static DateFormat getDateFormat(String format) {
      Map<String, DateFormat> threadDateFormats = dateFormats.get();
      if (!threadDateFormats.containsKey(format)) {
 -      DateFormat dateFormat = new SimpleDateFormat(format);
 +      DateFormat dateFormat = new SimpleDateFormat(format, Locale.US);
        dateFormat.setLenient(false);
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        threadDateFormats.put(format, dateFormat);
 }}}

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/17033#comment:3>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs