Prechádzať zdrojové kódy

Updated regex for split

Raymond Edah 7 rokov pred
rodič
commit
be502df6ca

+ 1 - 1
src/main/java/nu/ltd/fp/se/collector/MeminfoCollector.java

@@ -87,7 +87,7 @@ public class MeminfoCollector extends AbstractMetricCollector implements MetricC
       // Skip the 1st 3 lines in the meminfo file
       while ((line = reader.readLine()) != null) {
         if (i > 2) {
-          String[] tokens = line.split(" ");
+          String[] tokens = line.split("\\s+");
           System.out.println("DEBUG: tokens[0]" + tokens[0]);
           System.out.println("DEBUG: tokens[1]" + tokens[1]);
           memInfo.put(tokens[0], Double.parseDouble(tokens[1]) * 1024);