< prev index next >

src/windows/classes/sun/net/dns/ResolverConfigurationImpl.java

Print this page
rev 1563 : 6969683: Generify ResolverConfiguration codes
Reviewed-by: alanb, chegar
rev 1564 : 7090158: Networking Libraries don't build with javac -Werror
7125055: ContentHandler.getContent API changed in error
Summary: Minor changes to networking java files to remove warnings
Reviewed-by: chegar, weijun, hawtin, alanb
Contributed-by: kurchi.subhra.hazra@oracle.com, sasha_bu@hotmail.com

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -26,11 +26,10 @@
 package sun.net.dns;
 
 import java.util.List;
 import java.util.LinkedList;
 import java.util.StringTokenizer;
-import java.io.IOException;
 
 /*
  * An implementation of sun.net.ResolverConfiguration for Windows.
  */
 

@@ -56,17 +55,17 @@
     // DNS suffix list and name servers populated by native method
     private static String os_searchlist;
     private static String os_nameservers;
 
     // Cached lists
-    private static LinkedList searchlist;
-    private static LinkedList nameservers;
+    private static LinkedList<String> searchlist;
+    private static LinkedList<String> nameservers;
 
     // Parse string that consists of token delimited by space or commas
     // and return LinkedHashMap
-    private LinkedList stringToList(String str) {
-        LinkedList ll = new LinkedList();
+    private LinkedList<String> stringToList(String str) {
+        LinkedList<String> ll = new LinkedList<String>();
 
         // comma and space are valid delimites
         StringTokenizer st = new StringTokenizer(str, ", ");
         while (st.hasMoreTokens()) {
             String s = st.nextToken();

@@ -110,25 +109,27 @@
 
     ResolverConfigurationImpl() {
         opts = new OptionsImpl();
     }
 
-    public List searchlist() {
+    @SuppressWarnings("unchecked") // clone()
+    public List<String> searchlist() {
         synchronized (lock) {
             loadConfig();
 
             // List is mutable so return a shallow copy
-            return (List)searchlist.clone();
+            return (List<String>)searchlist.clone();
         }
     }
 
-    public List nameservers() {
+    @SuppressWarnings("unchecked") // clone()
+    public List<String> nameservers() {
         synchronized (lock) {
             loadConfig();
 
             // List is mutable so return a shallow copy
-            return (List)nameservers.clone();
+            return (List<String>)nameservers.clone();
          }
     }
 
     public Options options() {
         return opts;
< prev index next >