src/share/classes/com/sun/jndi/dns/ZoneNode.java

Print this page

        

@@ -53,11 +53,11 @@
  */
 
 
 class ZoneNode extends NameNode {
 
-    private SoftReference contentsRef = null;   // the zone's namespace
+    private SoftReference<NameNode> contentsRef = null;   // the zone's namespace
     private long serialNumber = -1;     // the zone data's serial number
     private Date expiration = null;     // time when the zone's data expires
 
     ZoneNode(String label) {
         super(label);

@@ -86,11 +86,11 @@
     /*
      * Returns the zone's contents, or null if the zone is not populated.
      */
     synchronized NameNode getContents() {
         return (contentsRef != null)
-                ? (NameNode) contentsRef.get()
+                ? contentsRef.get()
                 : null;
     }
 
     /*
      * Has this zone's data expired?

@@ -128,11 +128,11 @@
         // assert (zone.size() == (depth() + 1));       // +1 due to root label
 
         NameNode newContents = new NameNode(null);
 
         for (int i = 0; i < rrs.answer.size(); i++) {
-            ResourceRecord rr = (ResourceRecord) rrs.answer.elementAt(i);
+            ResourceRecord rr = rrs.answer.elementAt(i);
             DnsName n = rr.getName();
 
             // Ignore resource records whose names aren't within the zone's
             // domain.  Also skip records of the zone's top node, since
             // the zone's root NameNode is already in place.

@@ -142,13 +142,13 @@
                     nnode.setZoneCut(true);
                 }
             }
         }
         // The zone's SOA record is the first record in the answer section.
-        ResourceRecord soa = (ResourceRecord) rrs.answer.firstElement();
+        ResourceRecord soa = rrs.answer.firstElement();
         synchronized (this) {
-            contentsRef = new SoftReference(newContents);
+            contentsRef = new SoftReference<NameNode>(newContents);
             serialNumber = getSerialNumber(soa);
             setExpiration(getMinimumTtl(soa));
             return newContents;
         }
     }