From b5f768dc898ec90214416d0265abdb3d43abc497 Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Wed, 26 Apr 2017 12:12:25 +0900 Subject: [PATCH] result set --- .../java/com/loafle/overflow/crawler/result/OFResultSet.java | 4 ++++ .../com/loafle/overflow/crawler/result/OFResultSetRow.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSet.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSet.java index ad66770..4ceadba 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSet.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSet.java @@ -1,6 +1,7 @@ package com.loafle.overflow.crawler.result; import com.loafle.overflow.crawler.config.Item; +import com.loafle.overflow.crawler.config.MappingInfo; import java.util.ArrayList; import java.util.HashMap; @@ -42,6 +43,9 @@ public abstract class OFResultSet { // methods static public OFResultSet newInstance(Item item) { + if (item.getMappingInfo() == null) { + item.setMappingInfo(new MappingInfo()); + } String type = (String) item.getMappingInfo().getParseDirection(); if (type != null && type.equals("row")) { return new OFResultSetRow(item); diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java index 5757aaa..b5371e2 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetRow.java @@ -77,7 +77,7 @@ public class OFResultSetRow extends OFResultSet{ for (String keyColumn: keyColumns) { String row = data.get(this.meta.get(keyColumn)); for (int i =0 ; i < keys.size() ; ++i) { - if (row.equals(keys.get(i))) { + if (row.equals(keys.get(i).getKey())) { findIndex = i; find = true; break;