directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1697149 - in /directory/shared/trunk/util/src/main/java/org/apache/directory/api/util: GeneralizedTime.java Strings.java
Date Sun, 23 Aug 2015 04:20:46 GMT
Author: elecharny
Date: Sun Aug 23 04:20:46 2015
New Revision: 1697149

URL: http://svn.apache.org/r1697149
Log:
o Fixed the GeneralizedTime to use Local.ENGLISH (See DIRAPI-219)
o Also set the lowerCase method to use Locale.ROOT instead of Local.ENGLISH (see http://blog.thetaphi.de/2012/07/default-locales-default-charsets-and.html)

Modified:
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java?rev=1697149&r1=1697148&r2=1697149&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
(original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
Sun Aug 23 04:20:46 2015
@@ -111,7 +111,6 @@ import org.apache.directory.api.i18n.I18
  */
 public class GeneralizedTime implements Comparable<GeneralizedTime>
 {
-
     /**
      * The format of the generalized time.
      */
@@ -157,6 +156,7 @@ public class GeneralizedTime implements
         DIFF_HOUR_MINUTE
     }
 
+    /** The GMT TimeZone */
     private static final TimeZone GMT = TimeZone.getTimeZone( "GMT" );
 
     /** The user provided value */
@@ -260,7 +260,8 @@ public class GeneralizedTime implements
         // else error
         int pos = 10;
         char c = upGeneralizedTime.charAt( pos );
-        if ( '0' <= c && c <= '9' )
+        
+        if ( ( '0' <= c ) && ( c <= '9' ) )
         {
             parseMinute();
 
@@ -276,7 +277,8 @@ public class GeneralizedTime implements
             // else error
             pos = 12;
             c = upGeneralizedTime.charAt( pos );
-            if ( '0' <= c && c <= '9' )
+            
+            if ( ( '0' <= c ) && ( c <= '9' ) )
             {
                 parseSecond();
 
@@ -291,7 +293,8 @@ public class GeneralizedTime implements
                 // else error
                 pos = 14;
                 c = upGeneralizedTime.charAt( pos );
-                if ( c == '.' || c == ',' )
+                
+                if ( ( c == '.' ) || ( c == ',' ) )
                 {
                     // read fraction of second
                     parseFractionOfSecond();
@@ -300,7 +303,7 @@ public class GeneralizedTime implements
                     parseTimezone( pos );
                     upFormat = Format.YEAR_MONTH_DAY_HOUR_MIN_SEC_FRACTION;
                 }
-                else if ( c == 'Z' || c == '+' || c == '-' )
+                else if ( ( c == 'Z' ) || ( c == '+' ) || ( c == '-' ) )
                 {
                     // read timezone
                     parseTimezone( pos );
@@ -311,7 +314,7 @@ public class GeneralizedTime implements
                     throw new ParseException( I18n.err( I18n.ERR_04363 ), 14 );
                 }
             }
-            else if ( c == '.' || c == ',' )
+            else if ( ( c == '.' ) || ( c == ',' ) )
             {
                 // read fraction of minute
                 parseFractionOfMinute();
@@ -320,7 +323,7 @@ public class GeneralizedTime implements
                 parseTimezone( pos );
                 upFormat = Format.YEAR_MONTH_DAY_HOUR_MIN_FRACTION;
             }
-            else if ( c == 'Z' || c == '+' || c == '-' )
+            else if ( ( c == 'Z' ) || ( c == '+' ) || ( c == '-' ) )
             {
                 // read timezone
                 parseTimezone( pos );
@@ -331,7 +334,7 @@ public class GeneralizedTime implements
                 throw new ParseException( I18n.err( I18n.ERR_04364 ), 12 );
             }
         }
-        else if ( c == '.' || c == ',' )
+        else if ( ( c == '.' ) || ( c == ',' ) )
         {
             // read fraction of hour
             parseFractionOfHour();
@@ -340,7 +343,7 @@ public class GeneralizedTime implements
             parseTimezone( pos );
             upFormat = Format.YEAR_MONTH_DAY_HOUR_FRACTION;
         }
-        else if ( c == 'Z' || c == '+' || c == '-' )
+        else if ( ( c == 'Z' ) || ( c == '+' ) || ( c == '-' ) )
         {
             // read timezone
             parseTimezone( pos );
@@ -374,6 +377,7 @@ public class GeneralizedTime implements
         }
 
         char c = upGeneralizedTime.charAt( pos );
+        
         if ( c == 'Z' )
         {
             calendar.setTimeZone( GMT );
@@ -384,7 +388,7 @@ public class GeneralizedTime implements
                 throw new ParseException( I18n.err( I18n.ERR_04368 ), pos + 1 );
             }
         }
-        else if ( c == '+' || c == '-' )
+        else if ( ( c == '+' ) || ( c == '-' ) )
         {
             StringBuilder sb = new StringBuilder( "GMT" );
             sb.append( c );

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java?rev=1697149&r1=1697148&r2=1697149&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java Sun
Aug 23 04:20:46 2015
@@ -2018,7 +2018,7 @@ public final class Strings
             return null;
         }
 
-        return str.toLowerCase( Locale.ENGLISH );
+        return str.toLowerCase( Locale.ROOT );
     }
 
 



Mime
View raw message