diff --git a/pom.xml b/pom.xml
index 9546591..0774620 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
common.toolkit
common-toolkit
common-toolkit
- 0.0.4
+ 0.0.4-SNAPSHOT
jar
@@ -35,7 +35,7 @@
build210
3.1
1.7
- 2.2
+ 20090211
2.1
@@ -143,7 +143,7 @@
- apache-httpclient
+ commons-httpclient
commons-httpclient
${httpclient.version}
@@ -236,7 +236,7 @@
- apache-httpclient
+ commons-httpclient
commons-httpclient
diff --git a/src/main/java/common/toolkit/java/util/io/SSHUtil.java b/src/main/java/common/toolkit/java/util/io/SSHUtil.java
index 76dae3b..f470d5f 100644
--- a/src/main/java/common/toolkit/java/util/io/SSHUtil.java
+++ b/src/main/java/common/toolkit/java/util/io/SSHUtil.java
@@ -10,6 +10,7 @@
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import ch.ethz.ssh2.Connection;
@@ -135,16 +136,21 @@ private static HostPerformanceEntity getHostPerformance( Connection conn ) throw
// 第四行通常是这样:
// Mem: 1572988k total, 1490452k used, 82536k free, 138300k
// buffers
- String[] memArray = line.replace( MEM_USAGE_STRING, EMPTY_STRING ).split( COMMA );
- totalMem = StringUtil.trimToEmpty( memArray[0].replace( "total", EMPTY_STRING ) ).replace( "k", EMPTY_STRING );
- freeMem = StringUtil.trimToEmpty( memArray[2].replace( "free", EMPTY_STRING ) ).replace( "k", EMPTY_STRING );
- buffersMem = StringUtil.trimToEmpty( memArray[3].replace( "buffers", EMPTY_STRING ) ).replace( "k", EMPTY_STRING );
+
+ // updated by hengyunabc
+ // 有可能是这样的:
+ // KiB Mem: 8085056 total, 7557820 used, 527236 free, 385016 buffers
+ // 所以这里的字符串处理不对,直接改为匹配数字即可。
+ List list = StringUtil.findAllByRegex(line, "\\d+");
+ totalMem = list.get(0);
+ freeMem = list.get(1);
+ buffersMem = list.get(2);
} else if ( 5 == lineNum ) {
// 第四行通常是这样:
// Swap: 2096472k total, 252k used, 2096220k free, 788540k
// cached
- String[] memArray = line.replace( SWAP_USAGE_STRING, EMPTY_STRING ).split( COMMA );
- cachedMem = StringUtil.trimToEmpty( memArray[3].replace( "cached", EMPTY_STRING ) ).replace( "k", EMPTY_STRING );
+ List list = StringUtil.findAllByRegex(line, "\\d+");
+ cachedMem = list.get(3);
if ( StringUtil.isBlank( totalMem, freeMem, buffersMem, cachedMem ) )
throw new Exception( "Error when get system performance of ip: " + conn.getHostname()