embulk-parser-jsonpath 0.1.1 → 0.1.2

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: 3fd87aab165b58977d3110a7a915f327e453813e
4
- data.tar.gz: b88edab1cf1df67f66cccd1281a4f4ec21dbacd4
3
+ metadata.gz: 8fa00c28b1cddf31875627709899e97cd22e68c2
4
+ data.tar.gz: 9dce9b4ee36202ef63065b676221622f420091f5
5
5
  SHA512:
6
- metadata.gz: a7ad10c37acef5698b6566e9d42a08b97a8a3c819e467945224deba9886d1fe3c2780d6e1eb5f95ad87639f59d16bbab58a031983b9bbd5ae7bef34c81e7eb82
7
- data.tar.gz: 0bab6a0db8c79e2ba3dce758710ee310178aba2f94d8c66f15bed2ce940c40c68f63e99e654f910d027565ff735552e4809141772f00995efbaa2e25da822bc0
6
+ metadata.gz: ce5b684201f61e8afc284c64b32e9470f468c93ea68b739815507b40c4ad69f703c766bb0eb4a834cabc019826bb519d0bb69f9ff9f0c97aa1afdc5ebd7eb2bc
7
+ data.tar.gz: 20732822287850a87b98828efd4e272f179237dcd0416960a0b066b20578675c36530869fc7d7aa9bc7ed269a7746c6da908d0337c78034aedbe4f7cfb2b86b9
@@ -1,6 +1,10 @@
1
1
  # ChangeLog
2
2
 
3
- ## 0.1.0 (2016-08-31)
3
+ ## 0.1.2 (2017-02-28)
4
+
5
+ * Output error detail when json parse failed.
6
+
7
+ ## 0.1.1 (2016-08-31)
4
8
 
5
9
  * Implement guess. (Use JRuby now.)
6
10
 
data/README.md CHANGED
@@ -5,7 +5,7 @@ The JSON with [JSONPath](http://goessner.net/articles/JsonPath/) parser plugin f
5
5
  ## Overview
6
6
 
7
7
  * **Plugin type**: parser
8
- * **Guess supported**: yes
8
+ * **Guess supported**: yes (A JSON data size supports up to 32KB. [#476](https://github.com/embulk/embulk/issues/476))
9
9
 
10
10
  ## Configuration
11
11
 
@@ -14,7 +14,7 @@ configurations {
14
14
  provided
15
15
  }
16
16
 
17
- version = "0.1.1"
17
+ version = "0.1.2"
18
18
 
19
19
  sourceCompatibility = 1.7
20
20
  targetCompatibility = 1.7
@@ -25,6 +25,7 @@ import org.msgpack.value.Value;
25
25
  import org.slf4j.Logger;
26
26
 
27
27
  import java.io.IOException;
28
+ import java.util.Locale;
28
29
  import java.util.Map;
29
30
 
30
31
  import static java.util.Locale.ENGLISH;
@@ -84,7 +85,7 @@ public class JsonpathParserPlugin
84
85
 
85
86
  setColumnNameValues(schema);
86
87
 
87
- logger.debug("JSONPath = " + jsonRoot);
88
+ logger.info("JSONPath = " + jsonRoot);
88
89
  final TimestampParser[] timestampParsers = Timestamps.newTimestampColumnParsers(task, task.getSchemaConfig());
89
90
  final JsonParser jsonParser = new JsonParser();
90
91
  final boolean stopOnInvalidRecord = task.getStopOnInvalidRecord();
@@ -95,8 +96,16 @@ public class JsonpathParserPlugin
95
96
  try (FileInputInputStream is = new FileInputInputStream(input)) {
96
97
  while (is.nextFile()) {
97
98
  // TODO more efficient handling.
99
+ Value value;
98
100
  String json = JsonPath.read(is, jsonRoot).toString();
99
- Value value = jsonParser.parse(json);
101
+ try {
102
+ value = jsonParser.parse(json);
103
+ }
104
+ catch (Exception ex) {
105
+ logger.error(String.format(Locale.ENGLISH, "Parse failed input data = '%s'", json));
106
+ throw new DataException(String.format(Locale.ENGLISH, "Parse failed reason = %s, input data = '%s'", ex.getMessage(), json));
107
+ }
108
+
100
109
  if (!value.isArrayValue()) {
101
110
  throw new JsonRecordValidateException("Json string is not representing array value.");
102
111
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embulk-parser-jsonpath
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Sato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-31 00:00:00.000000000 Z
11
+ date: 2017-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -110,7 +110,7 @@ files:
110
110
  - src/test/java/org/embulk/parser/jsonpath/cast/TestStringCast.java
111
111
  - classpath/accessors-smart-1.1.jar
112
112
  - classpath/asm-5.0.3.jar
113
- - classpath/embulk-parser-jsonpath-0.1.1.jar
113
+ - classpath/embulk-parser-jsonpath-0.1.2.jar
114
114
  - classpath/json-path-2.2.0.jar
115
115
  - classpath/json-smart-2.2.1.jar
116
116
  - classpath/slf4j-api-1.7.16.jar