Bug #81214 NPE in TimeUtil.loadTimeZoneMappings causing server time zone value unrecognized
Submitted: 27 Apr 2016 18:19 Modified: 4 Jul 2016 15:25
Reporter: Gili T. Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:6.0.2 OS:Windows
Assigned to: CPU Architecture:Any
Tags: regression

[27 Apr 2016 18:19] Gili T.
Description:
It looks like the fix for bug #79343 never made into the 6.0 release. If you look at TimeUtil:163 you will notice that the code still refers to TimeZone.class instead of TimeUtil.class.

How to repeat:
See testcase of bug #79343 or add the following to a Maven pom.xml:

            <plugin>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-maven-plugin</artifactId>
                <version>4.0</version>
                <executions>
                    <execution>
                        <id>migrate-db</id>
                        <goals>
                            <goal>migrate</goal>
                        </goals>
                        <configuration>
                            <url>someURL</url>
                            <user>someUser</user>
                            <password>somePassword</password>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>6.0.2</version>
                    </dependency>
                </dependencies>
            </plugin>

Suggested fix:
Same as bug #79343.
[28 Apr 2016 11:38] Chiranjeevi Battula
Hello Gili T.,

Thank you for the bug report.
Verified based on internal discussion with dev's.

Thanks,
Chiranjeevi.
[4 Jul 2016 15:08] Daniel So
Posted by developer:
 
Added the following entry to the MySQL Connector/J 6.0.3 changelog:

"With some Tomcat web applications, when Connector/J connects to the server
with useLegacyDatetimeCode=false without setting serverTimeZone, a
NullPointerException was returned. This was because the timezone property
file for Connector/J was loaded by the bootstrap class loader, which did not
know the location of the property file and thus failed to load it. This fix
avoids the problem by making Connector/J use the same class loader for both
the property file and the Connector/J classes."
[4 Jul 2016 15:25] Gili T.
Hi Daniel,

Aside from adding this note to the changelog, was the actual code fixed?
[4 Jul 2016 17:41] Alexander Soklakov
Hi Gili,

Yes, the fix was merged from 5.1 branch.
[16 Mar 2017 20:40] Michael Seydel
This doesn't appear to be fixed in the 6.0.6 release.
[31 Aug 2017 23:04] Bret Hansen
Still having this problem with version 6.0.6