# HG changeset patch # User Jon VanAlten # Date 1349296219 14400 # Node ID ea7e9573f3165ec5c5fa08ac20a8144b20621eda # Parent 9ee910cf722d8af30d955ac4729a6b7f855c11fd# Parent 4323e78903afd0180537e67e3252577ac118158d Merge. diff -r 9ee910cf722d -r ea7e9573f316 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/LocaleResources.java --- 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, diff -r 9ee910cf722d -r ea7e9573f316 client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/FindObjectsCommand.java --- 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 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 results = heapDump.searchObjects(searchTerm, limit); diff -r 9ee910cf722d -r ea7e9573f316 client/heapdumper/src/main/resources/com/redhat/thermostat/client/heap/strings.properties --- 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