src/jdk.dns.client/share/classes/jdk/dns/client/internal/ResourceClassType.java
branchaefimov-dns-client-branch
changeset 58971 465a15dd6bed
parent 58870 35c438a6d45c
--- a/src/jdk.dns.client/share/classes/jdk/dns/client/internal/ResourceClassType.java	Thu Nov 07 18:44:09 2019 +0000
+++ b/src/jdk.dns.client/share/classes/jdk/dns/client/internal/ResourceClassType.java	Thu Nov 07 18:46:06 2019 +0000
@@ -25,8 +25,7 @@
 
 package jdk.dns.client.internal;
 
-import jdk.dns.client.AddressFamily;
-import jdk.dns.client.ex.DnsInvalidAttributeIdentifierException;
+import jdk.dns.client.ex.DnsResolverException;
 
 public class ResourceClassType {
     int rrclass;
@@ -49,8 +48,8 @@
         ResourceClassType[] cts;
         try {
             cts = ResourceClassType.attrIdsToClassesAndTypes(typeFromAddressFamily(addressFamily));
-        } catch (DnsInvalidAttributeIdentifierException e) {
-            return new ResourceClassType(ResourceRecord.QTYPE_STAR);
+        } catch (DnsResolverException e) {
+            return new ResourceClassType(ResourceRecord.TYPE_ANY);
         }
         return ResourceClassType.getClassAndTypeToQuery(cts);
     }
@@ -68,7 +67,7 @@
 
 
     public static ResourceClassType[] attrIdsToClassesAndTypes(String[] attrIds)
-            throws DnsInvalidAttributeIdentifierException {
+            throws DnsResolverException {
         if (attrIds == null) {
             return null;
         }
@@ -81,10 +80,10 @@
     }
 
     private static ResourceClassType fromAttrId(String attrId)
-            throws DnsInvalidAttributeIdentifierException {
+            throws DnsResolverException {
 
         if (attrId.isEmpty()) {
-            throw new DnsInvalidAttributeIdentifierException(
+            throw new DnsResolverException(
                     "Attribute ID cannot be empty");
         }
         int rrclass;
@@ -98,7 +97,7 @@
             String className = attrId.substring(0, space);
             rrclass = ResourceRecord.getRrclass(className);
             if (rrclass < 0) {
-                throw new DnsInvalidAttributeIdentifierException(
+                throw new DnsResolverException(
                         "Unknown resource record class '" + className + '\'');
             }
         }
@@ -107,7 +106,7 @@
         String typeName = attrId.substring(space + 1);
         rrtype = ResourceRecord.getType(typeName);
         if (rrtype < 0) {
-            throw new DnsInvalidAttributeIdentifierException(
+            throw new DnsResolverException(
                     "Unknown resource record type '" + typeName + '\'');
         }
 
@@ -128,7 +127,7 @@
             throw new RuntimeException("Internal DNS resolver error");
         } else if (cts.length == 0) {
             // No records are requested, but we need to ask for something.
-            rrtype = ResourceRecord.QTYPE_STAR;
+            rrtype = ResourceRecord.TYPE_ANY;
         } else {
             rrclass = ResourceRecord.CLASS_INTERNET;
             rrtype = cts[0].rrtype;
@@ -137,7 +136,7 @@
                     throw new RuntimeException("Internal error: Only CLASS_INTERNET is supported");
                 }
                 if (rrtype != cts[i].rrtype) {
-                    rrtype = ResourceRecord.QTYPE_STAR;
+                    rrtype = ResourceRecord.TYPE_ANY;
                 }
             }
         }