Mercurial > hg > release > thermostat-0.4
changeset 654:ea7e9573f316
Merge.
author | Jon VanAlten <vanaltj@gmail.com> |
---|---|
date | Wed, 03 Oct 2012 16:30:19 -0400 |
parents | 9ee910cf722d (current diff) 4323e78903af (diff) |
children | ec2d7827cfae |
files | client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java client/heapdumper/src/main/resources/com/redhat/thermostat/client/heap/strings.properties |
diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java Tue Oct 02 17:43:44 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java Wed Oct 03 16:30:19 2012 -0400 @@ -51,6 +51,7 @@ INVALID_LIMIT, HEAP_ID_NOT_FOUND, HEAP_ID_REQUIRED, + SEARCH_TERM_REQUIRED, COMMAND_HEAP_DUMP_DONE,
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java Tue Oct 02 17:43:44 2012 -0400 +++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java Wed Oct 03 16:30:19 2012 -0400 @@ -37,6 +37,7 @@ package com.redhat.thermostat.client.heap.cli; import java.util.Collection; +import java.util.List; import com.redhat.thermostat.client.heap.LocaleResources; import com.redhat.thermostat.client.heap.Translate; @@ -73,7 +74,18 @@ ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.HEAP_ID_NOT_FOUND, heapId)); return; } - String searchTerm = ctx.getArguments().getNonOptionArguments().get(0); + + List<String> terms = ctx.getArguments().getNonOptionArguments(); + if (terms.size() == 0) { + ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.SEARCH_TERM_REQUIRED)); + return; + } + String searchTerm = terms.get(0); + if (searchTerm.trim().length() == 0) { + ctx.getConsole().getOutput().println(Translate.localize(LocaleResources.SEARCH_TERM_REQUIRED)); + return; + } + String limitArg = ctx.getArguments().getArgument(LIMIT_ARG); int limit = parseLimit(limitArg); Collection<String> results = heapDump.searchObjects(searchTerm, limit);
--- a/client/heapdumper/src/main/resources/com/redhat/thermostat/client/heap/strings.properties Tue Oct 02 17:43:44 2012 -0400 +++ b/client/heapdumper/src/main/resources/com/redhat/thermostat/client/heap/strings.properties Wed Oct 03 16:30:19 2012 -0400 @@ -11,6 +11,8 @@ INVALID_LIMIT = Invalid limit {0} HEAP_ID_NOT_FOUND = Heap ID not found: {0} HEAP_ID_REQUIRED = Heap ID required +SEARCH_TERM_REQUIRED = A search term is required + COMMAND_HEAP_DUMP_DONE = Done