提交 53439d35 authored 作者: Noel Grandin's avatar Noel Grandin

fix oracle date parsing in Java1.6

looks like later versions of Java ignore a "+" at the beginning of a
number
上级 c1cb994a
......@@ -6,7 +6,6 @@
package org.h2.util;
import static java.lang.String.format;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -21,7 +20,6 @@ import java.util.Map;
import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.h2.api.ErrorCode;
import org.h2.message.DbException;
......@@ -143,6 +141,10 @@ class ToDateTokenizer {
case IYYY:
inputFragmentStr = matchStringOrThrow(
PATTERN_FOUR_DIGITS, params, formatTokenEnum);
// only necessary for Java1.6
if (inputFragmentStr.startsWith("+")) {
inputFragmentStr = inputFragmentStr.substring(1);
}
dateNr = Integer.parseInt(inputFragmentStr);
// Gregorian calendar does not have a year 0.
// 0 = 0001 BC, -1 = 0002 BC, ... so we adjust
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论