Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-22076

Recent changes to date/time parsing (SimpleDateFormat) break the debug language (en_DEBUG)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: RESOLVED
    • Priority: Major
    • Resolution: Incorporated
    • Affects Version/s: 2.9.0
    • Fix Version/s: None
    • Component/s: Internationalization
    • Labels:

      Description

      Many tools don't function at all if the debug language is set. This is described on the how to translate Sakai page:
      https://confluence.sakaiproject.org/display/I18N/How+to+Translate+Sakai

      This is because these strings are passed from the ResourceLoader directly into another method (like SimpleDateFormat) and the TimeService breaks if it doesn't get a "time" value.

      and was a feature I used often in the past (~2.7 and 2.8). I know that SAM-1522 specifically is breaking Samigo now.

      To enable:

      • Add to sakai.properties
      • locales.more=en_US_DEBUG
      • Switch to "English Debug Locale" in your preferences.

      I feel it's important to preserve this debug locale but how to best fix this regression?
      ResourceLoader returns this as the first thing in all cases

      public String getString(String key)
      {
      if ( getLocale().toString().equals(DEBUG_LOCALE) )

      { return formatDebugPropertiesString( key ); }

      1) Make a special prefix for the key like "nodebug_KEY" or "simpledate_KEY" and have getString/getStrings check for this prefix? If the prefix matches always pass the value instead of the key. This would require fixing all of the code that is using this date but should be relatively easy.

      2) Make all of the code that calls SimpleDateFormat call some wrapper instead. (Like maybe in BasicTimeService) If it can't parse the string, return one of the default strings that's present there. It seems like they should be all catching and handling ParseExceptions though?

      3) Do a regex test on the value looking for date patterns?

      4) ??? Remove debug as an option because it breaks most tools?

      Any suggestions? This feels like a new regression for 2.9

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  jonespm Matthew Jones
                  Reporter:
                  jonespm Matthew Jones
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration