@@ -25,16 +25,18 @@ public MySQLTimeZoneComparison(Connection connection)
2525 this .connection = connection ;
2626 }
2727
28- public void compareTimeZone () throws SQLException
28+ public void compareTimeZone ()
29+ throws SQLException
2930 {
3031 TimeZone serverTimeZone = null ;
3132 try {
3233 serverTimeZone = getServerTimeZone ();
33- } catch (SQLException ex ) {
34- logger .error (String .format (Locale .ENGLISH ,"SQLException raised %s" ,ex .toString ()));
34+ }
35+ catch (SQLException ex ) {
36+ logger .error (String .format (Locale .ENGLISH , "SQLException raised %s" , ex .toString ()));
3537 }
3638
37- if ( serverTimeZone == null ) {
39+ if ( serverTimeZone == null ) {
3840 logger .warn ("Can't get server TimeZone." );
3941 return ;
4042 }
@@ -43,8 +45,8 @@ public void compareTimeZone() throws SQLException
4345 Date today = new Date ();
4446 int clientOffset = clientTimeZone .getRawOffset ();
4547
46- if ( clientTimeZone .inDaylightTime (today ) ) {
47- clientOffset += clientTimeZone .getDSTSavings ();
48+ if ( clientTimeZone .inDaylightTime (today )) {
49+ clientOffset += clientTimeZone .getDSTSavings ();
4850 }
4951
5052 //
@@ -54,21 +56,20 @@ public void compareTimeZone() throws SQLException
5456 // TimeZone tz_gmt9 = TimeZone.getTimeZone("GMT+9");
5557 // tz_jst.hasSameRules(tz_gmt9) // return false.
5658 //
57- if ( clientOffset != serverTimeZone .getRawOffset () ) {
59+ if ( clientOffset != serverTimeZone .getRawOffset ()) {
5860 logger .warn (String .format (Locale .ENGLISH ,
5961 "The client timezone(%s) is different from the server timezone(%s). The plugin will fetch wrong datetime values." ,
60- clientTimeZone .getID (),serverTimeZone .getID ()));
62+ clientTimeZone .getID (), serverTimeZone .getID ()));
6163 logger .warn (String .format (Locale .ENGLISH ,
6264 "Use You may need to set options `useLegacyDatetimeCode` and `serverTimeZone`" ));
6365 logger .warn (String .format (Locale .ENGLISH ,
6466 "Ex. `options: { useLegacyDatetimeCode: false, serverTimeZone: UTC }`" ));
6567 }
66- logger .warn (String .format (Locale .ENGLISH ,"The plugin will set `useLegacyDatetimeCode=false` by default in future." ));
67-
68-
68+ logger .warn (String .format (Locale .ENGLISH , "The plugin will set `useLegacyDatetimeCode=false` by default in future." ));
6969 }
7070
71- private TimeZone getServerTimeZone () throws SQLException
71+ private TimeZone getServerTimeZone ()
72+ throws SQLException
7273 {
7374 //
7475 // First, I used `@@system_time_zone`. but It return non Time Zone Abbreviations name on a specific platform.
@@ -86,15 +87,15 @@ private TimeZone getServerTimeZone() throws SQLException
8687 else {
8788 return null ;
8889 }
89-
90- } finally {
90+ }
91+ finally {
9192 stmt .close ();
9293 }
9394 }
9495
9596 private TimeZone fromGMTOffsetSeconds (int offsetSeconds )
9697 {
97- if ( offsetSeconds == 0 ) {
98+ if ( offsetSeconds == 0 ) {
9899 return TimeZone .getTimeZone ("UTC" );
99100 }
100101
0 commit comments