QueryImpl.java
26.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* javax.jcr.Item
* javax.jcr.Node
* javax.jcr.RangeIterator
* javax.jcr.RepositoryException
* javax.jcr.Session
* javax.jcr.Value
* javax.jcr.Workspace
* javax.jcr.query.Query
* javax.jcr.query.QueryManager
* javax.jcr.query.QueryResult
* javax.jcr.query.Row
* javax.jcr.query.RowIterator
* org.apache.commons.collections.ComparatorUtils
* org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter
* org.apache.jackrabbit.commons.iterator.RowIteratorAdapter
* org.apache.sling.api.resource.ResourceResolver
* org.slf4j.Logger
* org.slf4j.LoggerFactory
*/
package com.day.cq.search.impl.builder;
import com.day.cq.search.Predicate;
import com.day.cq.search.PredicateGroup;
import com.day.cq.search.Query;
import com.day.cq.search.eval.EvaluationContext;
import com.day.cq.search.eval.PredicateEvaluator;
import com.day.cq.search.facets.Bucket;
import com.day.cq.search.facets.Facet;
import com.day.cq.search.facets.FacetExtractor;
import com.day.cq.search.impl.builder.EvaluationContextImpl;
import com.day.cq.search.impl.builder.FacetCache;
import com.day.cq.search.impl.builder.PropertyComparator;
import com.day.cq.search.impl.builder.QueryBuilderImpl;
import com.day.cq.search.impl.builder.RootEvaluator;
import com.day.cq.search.impl.result.EmptySearchResult;
import com.day.cq.search.impl.result.SearchResultImpl;
import com.day.cq.search.result.SearchResult;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import javax.jcr.Item;
import javax.jcr.Node;
import javax.jcr.RangeIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
import javax.jcr.Workspace;
import javax.jcr.query.QueryManager;
import javax.jcr.query.QueryResult;
import javax.jcr.query.Row;
import javax.jcr.query.RowIterator;
import org.apache.commons.collections.ComparatorUtils;
import org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter;
import org.apache.jackrabbit.commons.iterator.RowIteratorAdapter;
import org.apache.sling.api.resource.ResourceResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class QueryImpl
implements Query {
private static final Logger log = LoggerFactory.getLogger(QueryImpl.class);
private final Session session;
private final QueryBuilderImpl queryBuilder;
private final PredicateGroup rootPredicate;
private SearchResult result;
private ResourceResolver resourceResolver;
private Iterable<Row> rows;
private Map<String, PredicateEvaluator> evaluators = new HashMap<String, PredicateEvaluator>();
private String xpath;
private String filteringPredicates;
private Map<FacetExtractor, List<Predicate>> facetExtractors;
public QueryImpl(PredicateGroup rootPredicate, Session session, QueryBuilderImpl queryBuilder) {
this.rootPredicate = rootPredicate;
this.session = session;
this.queryBuilder = queryBuilder;
}
@Override
public SearchResult getResult() {
if (this.result == null) {
this.result = this.execute();
}
return this.result;
}
@Override
public PredicateGroup getPredicates() {
return this.rootPredicate;
}
@Override
public void registerPredicateEvaluator(String type, PredicateEvaluator evaluator) {
if (type != null && type.length() > 0 && evaluator != null) {
this.evaluators.put(type, evaluator);
}
}
@Override
public Query refine(Bucket bucket) {
PredicateGroup targetRoot;
Predicate p = bucket.getPredicate();
if (this.rootPredicate.allRequired()) {
int pos;
targetRoot = this.rootPredicate.clone(true);
Predicate origPredicate = this.rootPredicate.getByName(p.getPath());
if (origPredicate != null && (pos = this.rootPredicate.indexOf(origPredicate)) >= 0) {
targetRoot.remove(pos);
}
targetRoot.add(p.clone(true));
} else {
targetRoot = new PredicateGroup();
targetRoot.setAllRequired(true);
targetRoot.add(p.clone(true));
targetRoot.add(this.rootPredicate.clone(true));
}
return new QueryImpl(targetRoot, this.session, this.queryBuilder);
}
@Override
public void setExcerpt(boolean excerpt) {
RootEvaluator.setExcerpt(this.rootPredicate, excerpt);
}
@Override
public boolean getExcerpt() {
return RootEvaluator.isExcerpt(this.rootPredicate);
}
@Override
public long getStart() {
try {
return Long.parseLong(this.rootPredicate.get("offset", "0"));
}
catch (NumberFormatException e) {
return 0;
}
}
@Override
public void setStart(long start) {
if (start < 0) {
this.rootPredicate.set("offset", "0");
} else {
this.rootPredicate.set("offset", Long.toString(start));
}
}
@Override
public long getHitsPerPage() {
try {
return Long.parseLong(this.rootPredicate.get("limit", "10"));
}
catch (NumberFormatException e) {
return 10;
}
}
@Override
public void setHitsPerPage(long hitsPerPage) {
if (hitsPerPage < 0) {
this.rootPredicate.set("limit", "10");
} else {
this.rootPredicate.set("limit", Long.toString(hitsPerPage));
}
}
public boolean guessTotal() {
String value = this.rootPredicate.get("guessTotal");
if (value != null) {
try {
if (Long.parseLong(value) >= 0) {
return true;
}
}
catch (NumberFormatException e) {
return "on".equals(value) || "true".equals(value);
}
}
return false;
}
public long getMaxTotal() {
try {
return Long.parseLong(this.rootPredicate.get("guessTotal", "-1"));
}
catch (NumberFormatException e) {
return -1;
}
}
public Session getSession() {
return this.session;
}
public ResourceResolver getResourceResolver() {
if (this.resourceResolver == null) {
this.resourceResolver = this.queryBuilder.createResourceResolver(this.session);
}
return this.resourceResolver;
}
public PredicateEvaluator getPredicateEvaluator(String type) {
if ("orderby".equals(type)) {
return null;
}
if (this.evaluators.containsKey(type)) {
return this.evaluators.get(type);
}
PredicateEvaluator evaluator = this.queryBuilder.getComponent(PredicateEvaluator.class, type, null);
if (evaluator == null) {
log.warn("no PredicateEvaluator found for '{}'", (Object)type);
}
this.evaluators.put(type, evaluator);
return evaluator;
}
private void releasePredicateEvaluators() {
for (PredicateEvaluator pe : this.evaluators.values()) {
this.queryBuilder.releaseComponent(pe);
}
this.evaluators.clear();
}
public Set<String> getExcerptPropertyNames() {
return this.queryBuilder.getExcerptPropertyNames();
}
public Iterable<Row> getRows() {
return this.rows;
}
public Map<String, Facet> extractFacets() {
if (this.facetExtractors == null) {
throw new IllegalStateException("Query.getFacets() can only be called after a successful call to getResult()");
}
long time = System.currentTimeMillis();
FacetCache facetCache = this.queryBuilder.getFacetCache();
Map<String, Facet> facets = facetCache.get(this.rootPredicate);
if (facets != null) {
log.debug("facets returned from cache, took {} ms", (Object)(System.currentTimeMillis() - time));
return facets;
}
facets = new HashMap<String, Facet>();
if (this.facetExtractors.size() == 0) {
return facets;
}
if (log.isDebugEnabled()) {
StringBuilder builder = new StringBuilder();
for (FacetExtractor facetExtractor : this.facetExtractors.keySet()) {
builder.append(facetExtractor).append(" => {\n");
List<Predicate> predicates = this.facetExtractors.get(facetExtractor);
for (Predicate p : predicates) {
builder.append(" ").append(p.getPath()).append("\n");
}
builder.append("}\n");
}
log.debug("facet extractors:\n{}", (Object)builder.toString());
}
try {
for (Row row : this.getRows()) {
String path = row.getValue("jcr:path").getString();
Node node = (Node)this.session.getItem(path);
if (node == null) continue;
for (FacetExtractor extractor : this.facetExtractors.keySet()) {
extractor.handleNode(node);
}
}
}
catch (RepositoryException e) {
log.error("could not extract facets for search result", (Throwable)e);
}
for (FacetExtractor facetExtractor : this.facetExtractors.keySet()) {
List<Predicate> predicates = this.facetExtractors.get(facetExtractor);
Facet facet = facetExtractor.getFacet();
if (facet == null) continue;
for (Predicate p : predicates) {
facets.put(p.getPath(), facet);
}
}
facetCache.put(this.rootPredicate, facets);
log.debug("facet extraction took {} ms", (Object)(System.currentTimeMillis() - time));
return facets;
}
public String getStatement() {
return this.xpath;
}
public String getFilteringPredicates() {
return this.filteringPredicates;
}
private String getFilteringPredicates(EvaluationContextImpl context) {
if (this.filteringPredicates == null) {
this.filteringPredicates = context.getRootEvaluator().listFilteringPredicates(context.getRootPredicate(), context);
}
return this.filteringPredicates;
}
private boolean isFiltering(EvaluationContextImpl context) {
return this.getFilteringPredicates(context).length() > 0;
}
private QueryResult executeXpath(RootEvaluator rootEvaluator, EvaluationContextImpl context, boolean sorting) {
try {
long xpathTime = System.currentTimeMillis();
this.xpath = rootEvaluator.getXPathExpression(this.rootPredicate, context);
log.debug("xpath query: {}", (Object)this.xpath);
if ("//*".equals(this.xpath)) {
if (this.isFiltering(context) || sorting) {
log.warn("full xpath repository query!");
} else {
log.debug("empty predicates, returning empty result set");
return null;
}
}
QueryManager qm = this.session.getWorkspace().getQueryManager();
QueryResult queryResult = qm.createQuery(this.xpath, "xpath").execute();
log.debug("xpath query creation took {} ms", (Object)(System.currentTimeMillis() - xpathTime));
return queryResult;
}
catch (RepositoryException e) {
log.warn("Could not run xpath query", (Throwable)e);
return null;
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
protected SearchResult execute() {
SearchResultImpl searchResult;
if (this.rootPredicate.isEmpty()) {
log.debug("empty query, returning empty result set");
return new EmptySearchResult(0);
}
if (log.isDebugEnabled()) {
log.debug("executing query (URL):\n" + this.rootPredicate.toURL());
log.debug("executing query (predicate tree):\n" + this.rootPredicate.toString());
}
long start = System.currentTimeMillis();
RootEvaluator rootEvaluator = this.queryBuilder.createRootEvaluator();
EvaluationContextImpl context = new EvaluationContextImpl(this, rootEvaluator);
Comparator<Row> comparator = this.extractOrderByPredicates(rootEvaluator, context);
RowIterator finalRows = RowIteratorAdapter.EMPTY;
Optional<FilteringRowIterator> filteringIter = new Optional<FilteringRowIterator>();
try {
long xpathTotal;
long total;
QueryResult xpathResult = this.executeXpath(rootEvaluator, context, comparator != null);
if (xpathResult == null) {
EmptySearchResult emptySearchResult = new EmptySearchResult(System.currentTimeMillis() - start);
return emptySearchResult;
}
if (this.isFiltering(context) && log.isDebugEnabled()) {
log.debug("filtering predicates: {}", (Object)this.getFilteringPredicates(context));
}
Optional<RowIterator> xpathIter = new Optional<RowIterator>();
this.rows = this.isFiltering(context) ? new RowIterable(xpathResult, xpathIter, filteringIter, context) : new RowIterable(xpathResult, xpathIter, filteringIter, null);
boolean mustCount = false;
boolean guessTotal = this.guessTotal();
if (guessTotal) {
xpathTotal = -1;
log.debug(">> xpath query result not counted because of 'p.guessTotal'");
} else {
xpathTotal = xpathResult.getRows().getSize();
if (xpathTotal >= 0) {
log.debug(">> xpath query returned {} results (getSize)", (Object)xpathTotal);
if (this.isFiltering(context)) {
mustCount = true;
}
} else {
mustCount = true;
}
}
if (comparator != null) {
log.debug("sorting result set...");
long sortTime = System.currentTimeMillis();
long max = 0;
if (guessTotal) {
max = this.getMaxTotal();
if (max < this.getStart() + this.getHitsPerPage()) {
max = this.getStart() + this.getHitsPerPage();
}
} else {
log.debug("consider using 'p.guessTotal' to avoid out of memory issues with custom sorting");
}
total = 0;
ArrayList<Row> list = new ArrayList<Row>();
for (Row r : this.rows) {
list.add(r);
++total;
if (!guessTotal || (long)list.size() <= max * 2) continue;
Collections.sort(list, comparator);
QueryImpl.keepFirst(list, max);
}
Collections.sort(list, comparator);
if (guessTotal) {
QueryImpl.keepFirst(list, max);
}
this.rows = list;
if (log.isDebugEnabled()) {
if (xpathTotal < 0) {
xpathTotal = xpathIter.get().getPosition();
log.debug(">> xpath query returned {} results (fetched for sorting)", (Object)xpathTotal);
}
if (this.isFiltering(context)) {
log.debug(">> after filtering there are {} results", (Object)total);
log.debug("filtering overhead was {} ms", (Object)filteringIter.get().getFilteringTime());
filteringIter.set(null);
}
}
log.debug("sorting took {} ms", (Object)(System.currentTimeMillis() - sortTime));
} else if (mustCount) {
total = this.count(this.rows.iterator());
if (log.isDebugEnabled()) {
if (xpathTotal < 0) {
xpathTotal = xpathIter.get().getPosition();
log.debug(">> xpath query returned {} results (iterated)", (Object)xpathTotal);
}
if (this.isFiltering(context)) {
log.debug(">> after filtering there are {} results", (Object)total);
log.debug("filtering overhead was {} ms", (Object)filteringIter.get().getFilteringTime());
filteringIter.set(null);
}
if (this.getStart() + this.getHitsPerPage() < total) {
log.debug("consider using 'p.guessTotal' if you don't need the full total with every query");
}
}
} else {
total = xpathTotal;
}
finalRows = new RowIteratorAdapter((RangeIterator)new RangeIteratorAdapter(this.rows.iterator(), total));
this.facetExtractors = new HashMap<FacetExtractor, List<Predicate>>();
this.collectFacetExtractors(this.rootPredicate, this.facetExtractors, context);
}
catch (RepositoryException e) {
log.warn("Could not execute query", (Throwable)e);
}
finally {
searchResult = new SearchResultImpl(this, finalRows, this.getStart(), this.getHitsPerPage(), start, filteringIter, log);
rootEvaluator.cleanup();
this.resetOrderByPredicates();
this.releasePredicateEvaluators();
}
return searchResult;
}
private Comparator<Row> extractOrderByPredicates(RootEvaluator rootEvaluator, EvaluationContext context) {
ArrayList<Comparator<Row>> comparators = new ArrayList<Comparator<Row>>();
boolean atLeastOneCustomComparator = false;
for (Predicate p : this.rootPredicate) {
Comparator<Row> customComparator;
if (!"orderby".equals(p.getType()) || !p.hasNonEmptyValue("orderby")) continue;
p.setIgnored(true);
String orderBy = p.get("orderby");
boolean ascending = p.get("sort", "asc").equals("asc");
boolean ignoreCase = p.get("case", "").equals("ignore");
if (orderBy.startsWith("@")) {
String prop = orderBy.substring(1);
rootEvaluator.addOrderBySpec(prop, ascending, ignoreCase);
comparators.add(this.getComparator(new PropertyComparator(prop, context), ascending));
continue;
}
Predicate predForOrder = this.rootPredicate.getByPath(orderBy);
PredicateEvaluator pe = predForOrder != null ? context.getPredicateEvaluator(predForOrder.getType()) : context.getPredicateEvaluator(orderBy);
if (pe == null) {
log.warn("predicate referenced by orderby-predicate not found: {}", (Object)orderBy);
continue;
}
String[] props = pe.getOrderByProperties(predForOrder, context);
if (props != null) {
for (String prop : props) {
rootEvaluator.addOrderBySpec(prop, ascending, ignoreCase);
comparators.add(this.getComparator(new PropertyComparator(prop, context), ascending));
}
}
if ((customComparator = pe.getOrderByComparator(predForOrder, context)) == null) continue;
atLeastOneCustomComparator = true;
log.debug("custom order by comparator: {}", (Object)orderBy);
comparators.add(this.getComparator(customComparator, ascending));
}
if (atLeastOneCustomComparator) {
return ComparatorUtils.chainedComparator(comparators);
}
return null;
}
private Comparator<Row> getComparator(Comparator<Row> c, boolean ascending) {
if (ascending) {
return c;
}
return Collections.reverseOrder(c);
}
private void resetOrderByPredicates() {
for (Predicate p : this.rootPredicate) {
if (!"orderby".equals(p.getType()) || !p.hasNonEmptyValue("orderby")) continue;
p.setIgnored(false);
}
}
private void collectFacetExtractors(Predicate predicate, Map<FacetExtractor, List<Predicate>> extractors, EvaluationContext context) {
if (predicate instanceof PredicateGroup) {
PredicateGroup group = (PredicateGroup)predicate;
for (Predicate child : group) {
this.collectFacetExtractors(child, extractors, context);
}
} else {
FacetExtractor extractor;
PredicateEvaluator evaluator = this.getPredicateEvaluator(predicate.getType());
if (evaluator != null && (extractor = evaluator.getFacetExtractor(predicate, context)) != null) {
if (extractors.containsKey(extractor)) {
extractors.get(extractor).add(predicate);
} else {
ArrayList<Predicate> predicates = new ArrayList<Predicate>();
predicates.add(predicate);
extractors.put(extractor, predicates);
}
}
}
}
public <E> long count(Iterator<E> iter) {
long count = 0;
if (iter != null) {
while (iter.hasNext()) {
iter.next();
++count;
}
}
return count;
}
private static <E> void keepFirst(ArrayList<E> list, long keep) {
while ((long)list.size() > keep) {
list.remove(list.size() - 1);
}
}
public class Optional<E> {
private E obj;
public Optional() {
this.obj = null;
}
public E get() {
return this.obj;
}
public void set(E obj) {
this.obj = obj;
}
}
private class RowIterAdapter
implements Iterator<Row> {
private RowIterator source;
private RowIterAdapter(RowIterator source) {
this.source = source;
}
@Override
public boolean hasNext() {
return this.source.hasNext();
}
@Override
public Row next() {
return this.source.nextRow();
}
@Override
public void remove() {
this.source.remove();
}
}
public class FilteringRowIterator
implements Iterator<Row> {
private final RowIterator sourceIter;
private final EvaluationContextImpl context;
private boolean fetchedNext;
private Row next;
private long filteringTimeNanos;
public FilteringRowIterator(RowIterator sourceIter, EvaluationContextImpl context) {
this.filteringTimeNanos = 0;
this.sourceIter = sourceIter;
this.context = context;
this.fetchedNext = false;
this.next = null;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
private void fetchNext() {
if (!this.fetchedNext) {
this.fetchedNext = true;
while (this.sourceIter.hasNext()) {
Row row = this.sourceIter.nextRow();
long start = System.nanoTime();
try {
if (!this.context.getRootEvaluator().includes(this.context.getRootPredicate(), row, this.context)) continue;
if (log.isTraceEnabled()) {
try {
log.trace("adding row to result after filtering: {}", (Object)row.getValue("jcr:path").getString());
}
catch (RepositoryException ignored) {
// empty catch block
}
}
this.next = row;
return;
}
finally {
this.filteringTimeNanos += System.nanoTime() - start;
continue;
}
}
this.next = null;
}
}
@Override
public boolean hasNext() {
this.fetchNext();
return this.next != null;
}
@Override
public Row next() {
this.fetchNext();
if (this.next != null) {
this.fetchedNext = false;
return this.next;
}
throw new NoSuchElementException();
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
public long getFilteringTime() {
return this.filteringTimeNanos / 1000000;
}
}
private class RowIterable
implements Iterable<Row> {
private final QueryResult xpathResult;
private final Optional<RowIterator> xpathIter;
private final Optional<FilteringRowIterator> filteringIter;
private final EvaluationContextImpl context;
public RowIterable(QueryResult xpathResult, Optional<RowIterator> xpathIter, Optional<FilteringRowIterator> filteringIter, EvaluationContextImpl context) {
this.xpathResult = xpathResult;
this.xpathIter = xpathIter;
this.filteringIter = filteringIter;
this.context = context;
}
@Override
public Iterator<Row> iterator() {
try {
RowIterator rows = this.xpathResult.getRows();
if (this.xpathIter.get() == null) {
this.xpathIter.set(rows);
}
if (this.context != null) {
FilteringRowIterator iter = new FilteringRowIterator(rows, this.context);
if (this.filteringIter.get() == null) {
this.filteringIter.set(iter);
}
return iter;
}
return new RowIterAdapter(rows);
}
catch (RepositoryException e) {
log.error("Could not get row iterator from result", (Throwable)e);
return Collections.emptyList().iterator();
}
}
}
}