@@ -132,25 +132,23 @@ public static long getCurrentTimeNanosOrMillis() {
132132 /**
133133 * Returns the 'official' Java timezone name for the given timezone
134134 *
135- * @param timezoneStr
135+ * @param timeZoneStr
136136 * the 'common' timezone name
137137 * @param exceptionInterceptor
138138 * exception interceptor
139139 *
140140 * @return the Java timezone name for the given timezone
141141 */
142- public static String getCanonicalTimeZone (String timezoneStr , ExceptionInterceptor exceptionInterceptor ) {
143- if (timezoneStr == null ) {
142+ public static String getCanonicalTimeZone (String timeZoneStr , ExceptionInterceptor exceptionInterceptor ) {
143+ if (timeZoneStr == null ) {
144144 return null ;
145145 }
146146
147- timezoneStr = timezoneStr .trim ();
147+ timeZoneStr = timeZoneStr .trim ();
148148
149- // handle '+/-hh:mm' form ...
150- if (timezoneStr .length () > 2 ) {
151- if ((timezoneStr .charAt (0 ) == '+' || timezoneStr .charAt (0 ) == '-' ) && Character .isDigit (timezoneStr .charAt (1 ))) {
152- return "GMT" + timezoneStr ;
153- }
149+ // Handle '+/-hh:mm' form.
150+ if (timeZoneStr .length () > 2 && (timeZoneStr .charAt (0 ) == '+' || timeZoneStr .charAt (0 ) == '-' ) && Character .isDigit (timeZoneStr .charAt (1 ))) {
151+ return "GMT" + timeZoneStr ;
154152 }
155153
156154 LOCK .lock ();
@@ -162,13 +160,13 @@ public static String getCanonicalTimeZone(String timezoneStr, ExceptionIntercept
162160 LOCK .unlock ();
163161 }
164162
165- String canonicalTz ;
166- if (( canonicalTz = timeZoneMappings . getProperty ( timezoneStr )) != null ) {
163+ String canonicalTz = timeZoneMappings . getProperty ( timeZoneStr ) ;
164+ if (canonicalTz != null ) {
167165 return canonicalTz ;
168166 }
169167
170168 throw ExceptionFactory .createException (InvalidConnectionAttributeException .class ,
171- Messages .getString ("TimeUtil.UnrecognizedTimeZoneId" , new Object [] { timezoneStr }), exceptionInterceptor );
169+ Messages .getString ("TimeUtil.UnrecognizedTimeZoneId" , new Object [] { timeZoneStr }), exceptionInterceptor );
172170 }
173171
174172 /**
@@ -329,11 +327,9 @@ private static void loadTimeZoneMappings(ExceptionInterceptor exceptionIntercept
329327 } catch (IOException e ) {
330328 throw ExceptionFactory .createException (Messages .getString ("TimeUtil.LoadTimeZoneMappingError" ), exceptionInterceptor );
331329 }
332- // bridge all Time Zone ids known by Java
330+ // Bridge all Time Zones known by Java.
333331 for (String tz : TimeZone .getAvailableIDs ()) {
334- if (!timeZoneMappings .containsKey (tz )) {
335- timeZoneMappings .put (tz , tz );
336- }
332+ timeZoneMappings .put (tz , tz );
337333 }
338334 }
339335
0 commit comments