added
error process
This commit is contained in:
parent
121e32d3b3
commit
6d11a0a70c
|
@ -2,6 +2,8 @@ package com.loafle.overflow.crawler.wmi;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Created by root on 17. 4. 12.
|
||||
*/
|
||||
|
@ -67,10 +69,29 @@ public class WMICrawlerLinux extends WMICrawlerOS {
|
|||
}
|
||||
|
||||
result = result.trim();
|
||||
|
||||
List<Map<String,String>> resultMapList = new ArrayList<Map<String, String>>();
|
||||
|
||||
int errIdx = result.indexOf("ERROR:");
|
||||
if(errIdx >= 0) {
|
||||
|
||||
int enterIdx = result.indexOf("\\n", errIdx);
|
||||
if(enterIdx < 0) enterIdx = result.length();
|
||||
String errStr = result.substring(errIdx + "ERROR:".length(), enterIdx);
|
||||
|
||||
|
||||
Map<String,String> map = new HashMap<>();
|
||||
|
||||
map.put("ERROR", errStr);
|
||||
resultMapList.add(map);
|
||||
return resultMapList;
|
||||
}
|
||||
|
||||
|
||||
String[] lines = result.split("\\n");
|
||||
String line = "";
|
||||
|
||||
List<Map<String,String>> resultMapList = new ArrayList<Map<String, String>>();
|
||||
|
||||
|
||||
List<String> columns = null;
|
||||
for (int indexI = 0 ; indexI < lines.length; ++indexI) {
|
||||
|
|
|
@ -52,11 +52,11 @@ public class WMICrawlerTest {
|
|||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
String id = "administrator";
|
||||
String pw = "!@#$qwer1234";
|
||||
String nameSpace = "root/cimv2";
|
||||
String query = "select * from Win32_OperatingSystem";
|
||||
String ip = "192.168.1.1";
|
||||
// String id = "administrator";
|
||||
// String pw = "!@#$qwer1234";
|
||||
// String nameSpace = "root/cimv2";
|
||||
// String query = "select * from Win32_OperatingSystem";
|
||||
// String ip = "192.168.1.1";
|
||||
|
||||
map.put("id", "administrator");
|
||||
map.put("pw", "!@#$qwer1234");
|
||||
|
|
Loading…
Reference in New Issue
Block a user