From fd31e22d92dc9ec4aca5c36d9f914cb4d0e11455 Mon Sep 17 00:00:00 2001 From: davidb Date: Tue, 22 Jun 2010 15:05:45 -0400 Subject: [PATCH] handle having no trust anchors more gracefully. --- src/com/verisign/cl/DNSSECValTool.java | 6 ++++++ src/com/verisign/tat/dnssec/TrustAnchorStore.java | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/com/verisign/cl/DNSSECValTool.java b/src/com/verisign/cl/DNSSECValTool.java index e29bf4a..be4cdb8 100644 --- a/src/com/verisign/cl/DNSSECValTool.java +++ b/src/com/verisign/cl/DNSSECValTool.java @@ -203,6 +203,12 @@ public class DNSSECValTool { } // Log our set of trusted keys + List trustedKeys = validator.listTrustedKeys(); + if (trustedKeys.size() == 0) { + System.err.println("ERROR: no trusted keys found/provided."); + return; + } + for (String key : validator.listTrustedKeys()) { System.out.println("Trusted Key: " + key); } diff --git a/src/com/verisign/tat/dnssec/TrustAnchorStore.java b/src/com/verisign/tat/dnssec/TrustAnchorStore.java index 9e30fb9..bd35e78 100644 --- a/src/com/verisign/tat/dnssec/TrustAnchorStore.java +++ b/src/com/verisign/tat/dnssec/TrustAnchorStore.java @@ -86,6 +86,10 @@ public class TrustAnchorStore { public List listTrustAnchors() { List res = new ArrayList(); + if (mMap == null) { + return res; + } + for (Map.Entry entry : mMap.entrySet()) { for (Iterator i = entry.getValue().rrs(); i.hasNext();) { DNSKEYRecord r = (DNSKEYRecord) i.next();