embulk 0.8.38 → 0.8.39

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55af3711ab3a9806eaff42dfba41acdc5f21f389
4
- data.tar.gz: 97daabaa7947559ee3028717c3fb36d2cf35b5a7
3
+ metadata.gz: ebe3aaaaac493d48a7239516115cf094a943d057
4
+ data.tar.gz: a3559e3a41bbf658fe1286e58acd47ae9509a7ae
5
5
  SHA512:
6
- metadata.gz: 7cb6005c6604e3e940f2139aeebb7a9e9e1e5fc3660ca160eb4e90c13edba63f75537ae508f78f79ec81846d438373366bf5848c0f12425f3cc1539d13a844db
7
- data.tar.gz: 23dbeb33d2a3de6bea2a672ba8f4da05d02d8d13104efdffb2a2c086408216766b80dea360b1d793ea74c7d771b7ef70efb54b9e950e2c0c03000943289ee19b
6
+ metadata.gz: 1eab1ebc52cbeb553a8712d976278853ee713ae4b7778f68f1a425d15a29652b9d4e91a957ac10a603b8d746bf6de626ddcd66eb1638d86b8e3e9ae35eab0d59
7
+ data.tar.gz: 34491eb3cbaf1b736a1406f985cdba36056881c4c31923466e294a842cf3653a823c46f179680e23f940e502f9ced228d41cf39e20b583f82ec9005c3db4d3df
@@ -24,7 +24,7 @@ def release_projects = [project(":embulk-core"), project(":embulk-standards"), p
24
24
 
25
25
  allprojects {
26
26
  group = 'org.embulk'
27
- version = '0.8.38'
27
+ version = '0.8.39'
28
28
 
29
29
  ext {
30
30
  jrubyVersion = '9.1.13.0'
@@ -333,7 +333,7 @@ task releaseCheck {
333
333
  if (!file("embulk-docs/src/release.rst").getText().contains("release-${project.version}")) {
334
334
  throw new GradleException("embulk-docs/src/release.rst doesn't include release-${project.version}")
335
335
  }
336
- String date = new Date().format("yyyy-MM-dd")
336
+ String date = new Date().format("yyyy-MM-d")
337
337
  if (!file("embulk-docs/src/release/release-${project.version}.rst").getText().contains(date)) {
338
338
  throw new GradleException("embulk-docs/src/release/release-${project.version}.rst doesn't include today's release date")
339
339
  }
@@ -57,20 +57,39 @@ public class TimestampFormat
57
57
 
58
58
  public static DateTimeZone parseDateTimeZone(String s)
59
59
  {
60
- final int rubyStyleTimeOffsetInSecond = TimeZoneConverter.dateZoneToDiff(s);
61
-
62
- if (rubyStyleTimeOffsetInSecond != Integer.MIN_VALUE) {
63
- return DateTimeZone.forOffsetMillis(rubyStyleTimeOffsetInSecond * 1000);
60
+ DateTimeZone jodaDateTimeZoneTemporary = null;
61
+ try {
62
+ // Use TimeZone#forID, not TimeZone#getTimeZone.
63
+ // Because getTimeZone returns GMT even if given timezone id is not found.
64
+ jodaDateTimeZoneTemporary = DateTimeZone.forID(s);
65
+ }
66
+ catch (IllegalArgumentException ex) {
67
+ jodaDateTimeZoneTemporary = null;
64
68
  }
69
+ final DateTimeZone jodaDateTimeZone = jodaDateTimeZoneTemporary;
65
70
 
66
- if(s.startsWith("+") || s.startsWith("-")) {
67
- return DateTimeZone.forID(s);
71
+ if (jodaDateTimeZone != null && (s.startsWith("+") || s.startsWith("-"))) {
72
+ return jodaDateTimeZone;
68
73
 
69
74
  } else if (s.equals("Z")) {
70
75
  return DateTimeZone.UTC;
71
76
 
72
77
  } else {
73
78
  try {
79
+ // DateTimeFormat.forPattern("z").parseMillis(s) is incorrect, but kept for compatibility as of now.
80
+ //
81
+ // The offset of PDT (Pacific Daylight Time) should be -07:00.
82
+ // DateTimeFormat.forPattern("z").parseMillis("PDT") however returns 8 hours (-08:00).
83
+ // DateTimeFormat.forPattern("z").parseMillis("PDT") == 28800000
84
+ // https://github.com/JodaOrg/joda-time/blob/v2.9.2/src/main/java/org/joda/time/DateTimeUtils.java#L446
85
+ //
86
+ // Embulk has used it to parse time zones for a very long time since it was v0.1.
87
+ // https://github.com/embulk/embulk/commit/b97954a5c78397e1269bbb6979d6225dfceb4e05
88
+ //
89
+ // It is kept as -08:00 for compatibility as of now.
90
+ //
91
+ // TODO: Make time zone parsing consistent.
92
+ // @see <a href="https://github.com/embulk/embulk/issues/860">https://github.com/embulk/embulk/issues/860</a>
74
93
  int rawOffset = (int) DateTimeFormat.forPattern("z").parseMillis(s);
75
94
  if(rawOffset == 0) {
76
95
  return DateTimeZone.UTC;
@@ -83,12 +102,24 @@ public class TimestampFormat
83
102
  // parseMillis failed
84
103
  }
85
104
 
86
- // TimeZone.getTimeZone returns GMT zone if given timezone id is not found
87
- // we want to only return timezone if exact match, otherwise exception
88
- if (availableTimeZoneNames.contains(s)) {
89
- //return TimeZone.getTimeZone(s);
90
- return DateTimeZone.forID(s);
105
+ if (jodaDateTimeZone != null && availableTimeZoneNames.contains(s)) {
106
+ return jodaDateTimeZone;
91
107
  }
108
+
109
+ // Parsing Ruby-style time zones in lower priority than Joda-Time because
110
+ // TimestampParser has parsed time zones with Joda-Time for a long time
111
+ // since ancient. The behavior is kept for compatibility.
112
+ //
113
+ // The following time zone IDs are duplicated in Ruby and Joda-Time 2.9.2
114
+ // while Ruby does not care summer time and Joda-Time cares summer time.
115
+ // "CET", "EET", "Egypt", "Iran", "MET", "WET"
116
+ //
117
+ // Some zone IDs (ex. "PDT") are parsed by DateTimeFormat#parseMillis as shown above.
118
+ final int rubyStyleTimeOffsetInSecond = TimeZoneConverter.dateZoneToDiff(s);
119
+ if (rubyStyleTimeOffsetInSecond != Integer.MIN_VALUE) {
120
+ return DateTimeZone.forOffsetMillis(rubyStyleTimeOffsetInSecond * 1000);
121
+ }
122
+
92
123
  return null;
93
124
  }
94
125
  }
@@ -55,7 +55,22 @@ public class TestTimestampParser {
55
55
  public void test__strptime__3_rfc822() {
56
56
  testToParse("Thu, 29 Jul 1999 09:54:21 UT", "%a, %d %b %Y %H:%M:%S %Z", 933242061L);
57
57
  testToParse("Thu, 29 Jul 1999 09:54:21 GMT", "%a, %d %b %Y %H:%M:%S %Z", 933242061L);
58
- testToParse("Thu, 29 Jul 1999 09:54:21 PDT", "%a, %d %b %Y %H:%M:%S %Z", 933267261L);
58
+
59
+ // It should be 933267261L if PDT (Pacific Daylight Time) is correctly -07:00.
60
+ //
61
+ // Joda-Time's DateTimeFormat.forPattern("z").parseMillis("PDT") however returns 8 hours (-08:00).
62
+ // DateTimeFormat.forPattern("z").parseMillis("PDT") == 28800000
63
+ // https://github.com/JodaOrg/joda-time/blob/v2.9.2/src/main/java/org/joda/time/DateTimeUtils.java#L446
64
+ //
65
+ // Embulk has used it to parse time zones for a very long time since it was v0.1.
66
+ // https://github.com/embulk/embulk/commit/b97954a5c78397e1269bbb6979d6225dfceb4e05
67
+ //
68
+ // It is kept as -08:00 for compatibility as of now.
69
+ //
70
+ // TODO: Make time zone parsing consistent.
71
+ // @see <a href="https://github.com/embulk/embulk/issues/860">https://github.com/embulk/embulk/issues/860</a>
72
+ testToParse("Thu, 29 Jul 1999 09:54:21 PDT", "%a, %d %b %Y %H:%M:%S %Z", 933270861L);
73
+
59
74
  testToParse("Thu, 29 Jul 1999 09:54:21 z", "%a, %d %b %Y %H:%M:%S %Z", 933242061L);
60
75
  testToParse("Thu, 29 Jul 1999 09:54:21 +0900", "%a, %d %b %Y %H:%M:%S %Z", 933209661L);
61
76
  testToParse("Thu, 29 Jul 1999 09:54:21 +0430", "%a, %d %b %Y %H:%M:%S %Z", 933225861L);
@@ -4,6 +4,7 @@ Release Notes
4
4
  .. toctree::
5
5
  :maxdepth: 1
6
6
 
7
+ release/release-0.8.39
7
8
  release/release-0.8.38
8
9
  release/release-0.8.37
9
10
  release/release-0.8.36
@@ -0,0 +1,12 @@
1
+ Release 0.8.39
2
+ ==================================
3
+
4
+ General Changes
5
+ ----------------
6
+
7
+ * Backport hot-fix: Parse time zones in Ruby-style in lower priority than Joda-Time [#864]
8
+
9
+
10
+ Release Date
11
+ ------------------
12
+ 2017-12-6
@@ -3,7 +3,7 @@
3
3
  module Embulk
4
4
  @@warned = false
5
5
 
6
- VERSION_INTERNAL = '0.8.38'
6
+ VERSION_INTERNAL = '0.8.39'
7
7
 
8
8
  DEPRECATED_MESSAGE = 'Embulk::VERSION in (J)Ruby is deprecated. Use org.embulk.EmbulkVersion::VERSION instead. If this message is from a plugin, please tell this to the author of the plugin!'
9
9
  def self.const_missing(name)
@@ -45,7 +45,22 @@ class TimestampParserTest < ::Test::Unit::TestCase
45
45
  # rfc822
46
46
  ['Thu, 29 Jul 1999 09:54:21 UT', '%a, %d %b %Y %H:%M:%S %Z'],
47
47
  ['Thu, 29 Jul 1999 09:54:21 GMT', '%a, %d %b %Y %H:%M:%S %Z'],
48
- ['Thu, 29 Jul 1999 09:54:21 PDT', '%a, %d %b %Y %H:%M:%S %Z'],
48
+
49
+ # They should be the same if PDT (Pacific Daylight Time) is correctly -07:00.
50
+ #
51
+ # Joda-Time's DateTimeFormat.forPattern("z").parseMillis("PDT") however returns 8 hours (-08:00).
52
+ # DateTimeFormat.forPattern("z").parseMillis("PDT") == 28800000
53
+ # https://github.com/JodaOrg/joda-time/blob/v2.9.2/src/main/java/org/joda/time/DateTimeUtils.java#L446
54
+ #
55
+ # Embulk has used it to parse time zones for a very long time since it was v0.1.
56
+ # https://github.com/embulk/embulk/commit/b97954a5c78397e1269bbb6979d6225dfceb4e05
57
+ #
58
+ # It is kept as -08:00 for compatibility as of now.
59
+ #
60
+ # TODO: Make time zone parsing consistent.
61
+ # See https://github.com/embulk/embulk/issues/860
62
+ # ['Thu, 29 Jul 1999 09:54:21 PDT', '%a, %d %b %Y %H:%M:%S %Z'],
63
+
49
64
  ['Thu, 29 Jul 1999 09:54:21 z', '%a, %d %b %Y %H:%M:%S %Z'],
50
65
  ['Thu, 29 Jul 1999 09:54:21 +0900', '%a, %d %b %Y %H:%M:%S %Z'],
51
66
  ['Thu, 29 Jul 1999 09:54:21 +0430', '%a, %d %b %Y %H:%M:%S %Z'],
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.38
4
+ version: 0.8.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-22 00:00:00.000000000 Z
11
+ date: 2017-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jruby-jars
@@ -115,10 +115,10 @@ files:
115
115
  - classpath/commons-compress-1.10.jar
116
116
  - classpath/commons-lang-2.4.jar
117
117
  - classpath/commons-lang3-3.4.jar
118
- - classpath/embulk-cli-0.8.38.jar
119
- - classpath/embulk-core-0.8.38.jar
120
- - classpath/embulk-jruby-strptime-0.8.38.jar
121
- - classpath/embulk-standards-0.8.38.jar
118
+ - classpath/embulk-cli-0.8.39.jar
119
+ - classpath/embulk-core-0.8.39.jar
120
+ - classpath/embulk-jruby-strptime-0.8.39.jar
121
+ - classpath/embulk-standards-0.8.39.jar
122
122
  - classpath/guava-18.0.jar
123
123
  - classpath/guice-4.0.jar
124
124
  - classpath/guice-bootstrap-0.1.1.jar
@@ -527,6 +527,7 @@ files:
527
527
  - embulk-docs/src/release/release-0.8.36.rst
528
528
  - embulk-docs/src/release/release-0.8.37.rst
529
529
  - embulk-docs/src/release/release-0.8.38.rst
530
+ - embulk-docs/src/release/release-0.8.39.rst
530
531
  - embulk-docs/src/release/release-0.8.4.rst
531
532
  - embulk-docs/src/release/release-0.8.5.rst
532
533
  - embulk-docs/src/release/release-0.8.6.rst