diff --git a/bindings/java/src/net/hyperic/sigar/util/Getline.java b/bindings/java/src/net/hyperic/sigar/util/Getline.java index 414fd3dd..b5b1e771 100644 --- a/bindings/java/src/net/hyperic/sigar/util/Getline.java +++ b/bindings/java/src/net/hyperic/sigar/util/Getline.java @@ -52,7 +52,7 @@ public class Getline { //XXX provide pure-java fallback String line = getline(prompt); if (addToHistory) { - histadd(line); + addToHistory(line); } return line; } @@ -64,6 +64,11 @@ public class Getline { } public void addToHistory(String line) { + if ((line == null) || + (line.length() == 0)) + { + return; + } histadd(line); } }