KARAF-2899 - NPE when running features:listUrl
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/c6cb968c Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/c6cb968c Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/c6cb968c Branch: refs/heads/karaf-2.3.x Commit: c6cb968c27d3c8620ecf59d18cabe7f30cdebfe6 Parents: 0c4370f Author: Jonathan Anstey <jans...@gmail.com> Authored: Thu Apr 10 14:05:22 2014 -0230 Committer: Jonathan Anstey <jans...@gmail.com> Committed: Thu Apr 10 14:05:22 2014 -0230 ---------------------------------------------------------------------- .../karaf/features/command/ListUrlCommand.java | 26 +++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/karaf/blob/c6cb968c/features/command/src/main/java/org/apache/karaf/features/command/ListUrlCommand.java ---------------------------------------------------------------------- diff --git a/features/command/src/main/java/org/apache/karaf/features/command/ListUrlCommand.java b/features/command/src/main/java/org/apache/karaf/features/command/ListUrlCommand.java index 63c16e2..64e9f61 100644 --- a/features/command/src/main/java/org/apache/karaf/features/command/ListUrlCommand.java +++ b/features/command/src/main/java/org/apache/karaf/features/command/ListUrlCommand.java @@ -52,21 +52,23 @@ public class ListUrlCommand extends FeaturesCommandSupport { if ((repos != null) && (repos.length > 0)) { for (int i = 0; i < repos.length; i++) { - URI uri = repos[i].getURI(); + if (repos[i] != null) { + URI uri = repos[i].getURI(); - String line = ""; - line += repos[i].isValid() ? " true " : " false"; + String line = ""; + line += repos[i].isValid() ? " true " : " false"; - try { - admin.validateRepository(uri); - // append valid flag if validation mode is tuned on - line += !validation ? "" : " true "; - } catch (Exception e) { - line += !validation ? "" : " false "; - verboseOutput += uri + ":" + e.getMessage() + "\n"; - } + try { + admin.validateRepository(uri); + // append valid flag if validation mode is tuned on + line += !validation ? "" : " true "; + } catch (Exception e) { + line += !validation ? "" : " false "; + verboseOutput += uri + ":" + e.getMessage() + "\n"; + } - System.out.println(line + " " + uri); + System.out.println(line + " " + uri); + } } if (verbose) {