Skip to content

Commit 0a7cac0

Browse files
authored
Revert "Normalize Date source string when parsing (#609)"
This reverts commit 2eeb817.
1 parent bf5e840 commit 0a7cac0

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

src/main/java/org/sqlite/date/FastDateParser.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,15 @@ public Object parseObject(final String source) throws ParseException {
288288
* @see org.apache.commons.lang3.time.DateParser#parse(java.lang.String)
289289
*/
290290
public Date parse(final String source) throws ParseException {
291-
String normalizedSource = source.length() == 19 ? (source + ".000") : source;
292-
final Date date= parse(normalizedSource, new ParsePosition(0));
291+
final Date date= parse(source, new ParsePosition(0));
293292
if(date==null) {
294293
// Add a note re supported date range
295294
if (locale.equals(JAPANESE_IMPERIAL)) {
296295
throw new ParseException(
297296
"(The " +locale + " locale does not support dates before 1868 AD)\n" +
298-
"Unparseable date: \""+normalizedSource+"\" does not match "+parsePattern.pattern(), 0);
297+
"Unparseable date: \""+source+"\" does not match "+parsePattern.pattern(), 0);
299298
}
300-
throw new ParseException("Unparseable date: \""+normalizedSource+"\" does not match "+parsePattern.pattern(), 0);
299+
throw new ParseException("Unparseable date: \""+source+"\" does not match "+parsePattern.pattern(), 0);
301300
}
302301
return date;
303302
}

src/test/java/org/sqlite/StatementTest.java

-12
Original file line numberDiff line numberDiff line change
@@ -421,18 +421,6 @@ public void dateTimeTest() throws SQLException {
421421
Date d = rs.getDate(1);
422422
assertEquals(day.getTime(), d.getTime());
423423
}
424-
425-
@Test
426-
public void defaultDateTimeTest() throws SQLException {
427-
stat.executeUpdate("create table daywithdefaultdatetime (id integer, datetime datatime default current_timestamp)");
428-
PreparedStatement prep = conn.prepareStatement("insert into daywithdefaultdatetime (id) values (1)");
429-
prep.setInt(1, 1);
430-
prep.executeUpdate();
431-
ResultSet rs = stat.executeQuery("select * from day");
432-
assertTrue(rs.next());
433-
Date d = rs.getDate(2);
434-
assertTrue(d != null);
435-
}
436424

437425
@Test
438426
public void maxRows() throws SQLException {

0 commit comments

Comments
 (0)