Bug #75080 getCalendarInstanceForSessionOrNew retun null in FabricMySQLConnectionProxy
Submitted: 3 Dec 2014 6:57 Modified: 4 Feb 2015 17:44
Reporter: Nabeel Bukhari Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.1034 OS:Any
Assigned to: Jess Balint CPU Architecture:Any
Tags: fabric, FabricMySQLConnectionProxy, JConnector 5.1.34

[3 Dec 2014 6:57] Nabeel Bukhari
Description:
Function getCalendarInstanceForSessionOrNew in FabricMySQLConnectionProxy return null.

PreparedStatement has following code:

                    Calendar sessionCalendar = this.connection.getUseJDBCCompliantTimezoneShift() ? this.connection.getUtcCalendar()
                            : getCalendarInstanceForSessionOrNew();

                    synchronized (sessionCalendar) {
                        x = TimeUtil
                                .changeTimezone(this.connection, sessionCalendar, targetCalendar, x, tz, this.connection.getServerTimezoneTZ(), rollForward);
                    }

Default Value for getUseJDBCCompliantTimezoneShift is false which calls getCalendarInstanceForSessionOrNew(), which returns null.
sessionCalender is null and when tried to synchronize on it. It throws null pointer exception.

How to repeat:
Use JConnector 5.1.34 with WebLogic 12c and EclipseLink. 
Insert a new row in table with timestamp field.

Suggested fix:
There should be some default implementation for getCalendarInstanceForSessionOrNew in FabricMySQLConnectionProxy.
[16 Dec 2014 0:20] Jess Balint
Thank for you the bug report. I have verified it as described.
[4 Feb 2015 16:54] Jess Balint
Posted by developer:
 
(Git) commit 758631872a58441699423510abd45cfc5204cede
[4 Feb 2015 17:44] Daniel So
Added the following entry to the Connector/J 5.1.35 changelog:

"The setTimestamp method failed in a Fabric connection with a null pointer exception. It was because the implementation for the getCalendarInstanceForSessionOrNew method was missing, which has been added by this fix to Connector/J."
[28 Feb 2015 1:04] Jess Balint
Bug #75240 was marked as a duplicate of this bug.