< prev index next >

src/java.base/share/classes/sun/net/smtp/SmtpClient.java

Print this page
rev 14210 : 8154231: Simplify access to System properties from JDK code
Reviewed-by: rriggs

@@ -23,14 +23,14 @@
  * questions.
  */
 
 package sun.net.smtp;
 
-import java.util.StringTokenizer;
 import java.io.*;
 import java.net.*;
 import sun.net.TransferProtocolClient;
+import sun.security.action.GetPropertyAction;
 
 /**
  * This class implements the SMTP client.
  * You can send a piece of mail by creating a new SmtpClient, calling
  * the "to" method to add destinations, calling "from" to name the

@@ -155,12 +155,11 @@
             } catch(Exception e) {
             }
         }
         try {
             String s;
-            mailhost = java.security.AccessController.doPrivileged(
-                    new sun.security.action.GetPropertyAction("mail.host"));
+            mailhost = GetPropertyAction.getProperty("mail.host");
             if (mailhost != null) {
                 openServer(mailhost);
                 return;
             }
         } catch(Exception e) {

@@ -182,12 +181,11 @@
     public SmtpClient(int to) throws IOException {
         super();
         setConnectTimeout(to);
         try {
             String s;
-            mailhost = java.security.AccessController.doPrivileged(
-                    new sun.security.action.GetPropertyAction("mail.host"));
+            mailhost = GetPropertyAction.getProperty("mail.host");
             if (mailhost != null) {
                 openServer(mailhost);
                 return;
             }
         } catch(Exception e) {
< prev index next >