Skip to content

Commit

Permalink
fix for timestamp objects in simpletuple
Browse files Browse the repository at this point in the history
  • Loading branch information
mswertz committed Jul 31, 2012
1 parent 9fdcd13 commit 339b162
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/org/molgenis/util/SimpleTuple.java
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ public java.sql.Date getDate(int column) throws ParseException
{
if (this.getObject(column) == null || this.getString(column) == "") return null;
if (this.getObject(column) instanceof java.sql.Date) return (java.sql.Date) this.getObject(column);
if (this.getObject(column) instanceof java.sql.Timestamp) return (java.sql.Date) this.getObject(column);
if (this.getObject(column) instanceof java.util.Date) return new java.sql.Date(
((java.util.Date) this.getObject(column)).getTime());

Expand Down Expand Up @@ -495,6 +496,7 @@ public java.sql.Date getDate(String column) throws ParseException
{
if (this.getObject(column) == null || this.getString(column) == "") return null;
if (this.getObject(column) instanceof java.sql.Date) return (java.sql.Date) this.getObject(column);
if (this.getObject(column) instanceof java.sql.Timestamp) return (java.sql.Date) this.getObject(column);
if (this.getObject(column) instanceof java.util.Date) return new java.sql.Date(
((java.util.Date) this.getObject(column)).getTime());

Expand Down Expand Up @@ -577,6 +579,7 @@ public File getFile(int column)
public Timestamp getTimestamp(String column) throws ParseException
{
if (this.getObject(column) == null || this.getString(column) == "") return null;
if (this.getObject(column) instanceof java.sql.Timestamp) return (java.sql.Timestamp) this.getObject(column);
try
{
DateFormat formatter = new SimpleDateFormat(DATETIMEFORMAT, Locale.US);
Expand Down Expand Up @@ -620,6 +623,7 @@ public Timestamp getTimestamp(String column) throws ParseException
public Timestamp getTimestamp(int column) throws ParseException
{
if (this.getObject(column) == null || this.getString(column) == "") return null;
if (this.getObject(column) instanceof java.sql.Timestamp) return (java.sql.Timestamp) this.getObject(column);
try
{
DateFormat formatter = new SimpleDateFormat(DATETIMEFORMAT, Locale.US);
Expand Down

0 comments on commit 339b162

Please sign in to comment.