Skip to content
This repository has been archived by the owner on Dec 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #27 from kazuki43zoo/fix-bug-JapaneseDateTypeHandler
Browse files Browse the repository at this point in the history
Fix converion bug of JapaneseDateTypeHandler
  • Loading branch information
hazendaz committed Jan 1, 2017
2 parents 631f09e + 6413f1b commit 3ce6cf8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.time.chrono.JapaneseDate;
import java.util.concurrent.TimeUnit;

/**
* Type Handler for {@link JapaneseDate}.
Expand All @@ -34,7 +34,7 @@ public class JapaneseDateTypeHandler extends BaseTypeHandler<JapaneseDate> {
@Override
public void setNonNullParameter(PreparedStatement ps, int i, JapaneseDate parameter, JdbcType jdbcType)
throws SQLException {
ps.setDate(i, new Date(TimeUnit.DAYS.toMillis(parameter.toEpochDay())));
ps.setDate(i, Date.valueOf(LocalDate.ofEpochDay(parameter.toEpochDay())));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import org.junit.Test;

import java.sql.Date;
import java.time.LocalDate;
import java.time.chrono.JapaneseDate;
import java.util.concurrent.TimeUnit;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
Expand All @@ -30,7 +30,7 @@ public class JapaneseDateTypeHandlerTest extends BaseTypeHandlerTest {

private static final TypeHandler<JapaneseDate> TYPE_HANDLER = new JapaneseDateTypeHandler();
private static final JapaneseDate JAPANESE_DATE = JapaneseDate.now();
private static final Date DATE = new Date(TimeUnit.DAYS.toMillis(JAPANESE_DATE.toEpochDay()));
private static final Date DATE = Date.valueOf(LocalDate.ofEpochDay(JAPANESE_DATE.toEpochDay()));

@Override
@Test
Expand Down

0 comments on commit 3ce6cf8

Please sign in to comment.