File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed
metafacture-json/src/main/java/org/metafacture/json Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -132,18 +132,24 @@ public void resetRecordCount() {
132
132
@ Override
133
133
public void process (final String json ) {
134
134
assert !isClosed ();
135
- final List <String > records = recordPath .isEmpty () ? Arrays .asList (json )
136
- : matches (JsonPath .read (json , recordPath ));
137
- records .forEach (record -> {
138
- createParser (record );
139
- try {
140
- decode ();
141
- } catch (final IOException e ) {
142
- throw new MetafactureException (e );
143
- } finally {
144
- closeParser ();
145
- }
146
- });
135
+ if (recordPath .isEmpty ()) {
136
+ processRecord (json );
137
+ } else {
138
+ matches (JsonPath .read (json , recordPath )).forEach (record -> {
139
+ processRecord (record );
140
+ });
141
+ }
142
+ }
143
+
144
+ private void processRecord (String record ) {
145
+ createParser (record );
146
+ try {
147
+ decode ();
148
+ } catch (final IOException e ) {
149
+ throw new MetafactureException (e );
150
+ } finally {
151
+ closeParser ();
152
+ }
147
153
}
148
154
149
155
private List <String > matches (Object obj ) {
You can’t perform that action at this time.
0 commit comments