Re: Fix for using JDK1.2 instead of JDK1.4 method in date/time/timestampToString

From: Barry Lind <blind(at)xythos(dot)com>
To: Kim Ho <kho(at)redhat(dot)com>
Cc: pgsql-jdbc-list <pgsql-jdbc(at)postgresql(dot)org>, Fernando Nasser <fnasser(at)redhat(dot)com>, Dave Cramer <Dave(at)micro-automation(dot)net>
Subject: Re: Fix for using JDK1.2 instead of JDK1.4 method in date/time/timestampToString
Date: 2003-07-22 05:38:59
Message-ID: 3F1CCDF3.3040006@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Patch applied.

--Barry

Kim Ho wrote:
> Uses a slightly longer method of getting the rawoffset and then adding
> the DST offset if any.
>
> Cheers,
>
> Kim
>
>
>
>
> ------------------------------------------------------------------------
>
> ? temp.diff
> Index: Makefile
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/Makefile,v
> retrieving revision 1.38
> diff -c -p -r1.38 Makefile
> *** Makefile 12 Feb 2003 06:13:04 -0000 1.38
> --- Makefile 17 Jul 2003 14:23:09 -0000
> ***************
> *** 4,10 ****
> #
> # Copyright (c) 2001, PostgreSQL Global Development Group
> #
> ! # $Header: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/Makefile,v 1.38 2003/02/12 06:13:04 barry Exp $
> #
> #-------------------------------------------------------------------------
>
> --- 4,10 ----
> #
> # Copyright (c) 2001, PostgreSQL Global Development Group
> #
> ! # $Header: /cvsroot/pgsql-server/src/interfaces/jdbc/Makefile,v 1.38 2003/02/12 06:13:04 barry Exp $
> #
> #-------------------------------------------------------------------------
>
> Index: org/postgresql/jdbc1/AbstractJdbc1Statement.java
> ===================================================================
> RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v
> retrieving revision 1.27
> diff -c -p -r1.27 AbstractJdbc1Statement.java
> *** org/postgresql/jdbc1/AbstractJdbc1Statement.java 9 Jul 2003 05:12:04 -0000 1.27
> --- org/postgresql/jdbc1/AbstractJdbc1Statement.java 17 Jul 2003 14:23:11 -0000
> *************** public abstract class AbstractJdbc1State
> *** 2072,2078 ****
> if (timezoneLocation>7 && timezoneLocation+3 == s.length())
> {
> timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> if (s.charAt(timezoneLocation)=='+')
> timezone*=-1;
> }
> --- 2072,2081 ----
> if (timezoneLocation>7 && timezoneLocation+3 == s.length())
> {
> timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! // localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> ! localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
> ! if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Date(millis)))
> ! localoffset += 60*60*1000;
> if (s.charAt(timezoneLocation)=='+')
> timezone*=-1;
> }
> *************** public abstract class AbstractJdbc1State
> *** 2101,2107 ****
> if (timezoneLocation != -1 && timezoneLocation+3 == s.length())
> {
> timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> if (s.charAt(timezoneLocation)=='+')
> timezone*=-1;
> }
> --- 2104,2113 ----
> if (timezoneLocation != -1 && timezoneLocation+3 == s.length())
> {
> timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! // localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> ! localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
> ! if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Time(millis)))
> ! localoffset += 60*60*1000;
> if (s.charAt(timezoneLocation)=='+')
> timezone*=-1;
> }
> *************** public abstract class AbstractJdbc1State
> *** 2146,2152 ****
> if (timezoneLocation>8 && timezoneLocation+3 == s.length())
> {
> timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> if (s.charAt(timezoneLocation)=='+')
> timezone*=-1;
> }
> --- 2152,2161 ----
> if (timezoneLocation>8 && timezoneLocation+3 == s.length())
> {
> timezone = Integer.parseInt(s.substring(timezoneLocation+1,s.length()));
> ! // localoffset = java.util.Calendar.getInstance().getTimeZone().getOffset(millis);
> ! localoffset = java.util.Calendar.getInstance().getTimeZone().getRawOffset();
> ! if (java.util.Calendar.getInstance().getTimeZone().inDaylightTime(new java.sql.Timestamp(millis)))
> ! localoffset += 60*60*1000;
> if (s.charAt(timezoneLocation)=='+')
> timezone*=-1;
> }
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2003-07-22 05:49:14 Patch applied for SQL Injection vulnerability for setObject(int, Object, int)
Previous Message Oliver Jowett 2003-07-22 04:11:19 the IN clause saga