diff --git a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetCol.java b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetCol.java index 7f9100b..a3d5ecf 100644 --- a/src/main/java/com/loafle/overflow/crawler/result/OFResultSetCol.java +++ b/src/main/java/com/loafle/overflow/crawler/result/OFResultSetCol.java @@ -2,10 +2,7 @@ package com.loafle.overflow.crawler.result; import com.loafle.overflow.crawler.config.Item; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Created by root on 17. 4. 25. @@ -20,13 +17,8 @@ public class OFResultSetCol extends OFResultSet{ public void setMeta() { List meta = this.item.getQuery().getKeys(); - List arrayColumns = (List)this.item.getQuery().getQueryInfo().get("arrayColumns"); - for( int indexI = 0 ; indexI < arrayColumns.size(); ++indexI) { - meta.add(arrayColumns.get(indexI)); - } - if(this.meta == null) { this.meta = new HashMap<>(); } @@ -35,6 +27,11 @@ public class OFResultSetCol extends OFResultSet{ this.meta.put(meta.get(indexI), indexI); } + for( int indexI = 0 ; indexI < arrayColumns.size(); ++indexI) { + this.meta.put(arrayColumns.get(indexI), indexI+ meta.size()); + } + + } public Map parse() { @@ -73,7 +70,7 @@ public class OFResultSetCol extends OFResultSet{ metric = convertMetric(metric, arrayValue); - resultMap.put(metric, row.get(indexI)); + resultMap.put(metric, row.get(indexK)); } } @@ -86,14 +83,14 @@ public class OFResultSetCol extends OFResultSet{ private String convertMetric(String metric, List arrayValue) { - char convertChar = '$'; - String convertStr = "$"; + String convertChar = "$"; + String convertStr = null; for(int indexI = 0 ; indexI < arrayValue.size(); ++indexI) { - convertStr = convertChar + String.valueOf(indexI +1); + convertStr = convertChar + String.valueOf(indexI); - metric = metric.replaceFirst(convertStr, arrayValue.get(indexI)); + metric = metric.replace(convertStr, arrayValue.get(indexI)); }