From 21cf01b0c9641b20eb9038fb9ef7e86be2702356 Mon Sep 17 00:00:00 2001 From: snoop Date: Thu, 27 Apr 2017 10:32:24 +0900 Subject: [PATCH] fix metamap iter --- .../loafle/overflow/crawler/snmp/SNMPCrawler.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/loafle/overflow/crawler/snmp/SNMPCrawler.java b/src/main/java/com/loafle/overflow/crawler/snmp/SNMPCrawler.java index 88604bd..3c144e0 100644 --- a/src/main/java/com/loafle/overflow/crawler/snmp/SNMPCrawler.java +++ b/src/main/java/com/loafle/overflow/crawler/snmp/SNMPCrawler.java @@ -14,10 +14,7 @@ import org.snmp4j.smi.Address; import org.snmp4j.transport.DefaultUdpTransportMapping; import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Created by insanity on 17. 4. 10. @@ -149,9 +146,12 @@ public class SNMPCrawler extends Crawler { OFResultSet rs = OFResultSet.newInstance(item); - List row = new ArrayList<>(); - for (String key : map.keySet()) { - row.add(map.get(key)); + List row = new ArrayList<>(Arrays.asList(new String[map.size()])); + + Map metaMap = rs.getMeta(); + + for (Map.Entry info : metaMap.entrySet()) { + row.set(info.getValue().intValue(), map.get(info.getKey())); } rs.addRow(row);