From f3168082b809dfe39afdf7064a83e7a39a1d3094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eirik=20Bj=C3=B8rsn=C3=B8s?= Date: Fri, 15 Nov 2024 19:22:30 +0000 Subject: [PATCH] 8344189: Cleanup code in sun.net.www.protocol.mailto.MailToURLConnection and sun.net.smtp after JEP 486 integration Reviewed-by: dfuchs --- .../classes/sun/net/smtp/SmtpClient.java | 7 +++---- .../protocol/mailto/MailToURLConnection.java | 21 +------------------ 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/java.base/share/classes/sun/net/smtp/SmtpClient.java b/src/java.base/share/classes/sun/net/smtp/SmtpClient.java index 59c60ce70dc..494bcf19987 100644 --- a/src/java.base/share/classes/sun/net/smtp/SmtpClient.java +++ b/src/java.base/share/classes/sun/net/smtp/SmtpClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2024, 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 @@ -28,7 +28,6 @@ package sun.net.smtp; import java.io.*; import java.net.*; import sun.net.TransferProtocolClient; -import sun.security.action.GetPropertyAction; /** * This class implements the SMTP client. @@ -167,7 +166,7 @@ public class SmtpClient extends TransferProtocolClient { } try { String s; - mailhost = GetPropertyAction.privilegedGetProperty("mail.host"); + mailhost = System.getProperty("mail.host"); if (mailhost != null) { openServer(mailhost); return; @@ -193,7 +192,7 @@ public class SmtpClient extends TransferProtocolClient { setConnectTimeout(to); try { String s; - mailhost = GetPropertyAction.privilegedGetProperty("mail.host"); + mailhost = System.getProperty("mail.host"); if (mailhost != null) { openServer(mailhost); return; diff --git a/src/java.base/share/classes/sun/net/www/protocol/mailto/MailToURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/mailto/MailToURLConnection.java index 555279f71ee..7791d07a8ca 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/mailto/MailToURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/mailto/MailToURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, 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 @@ -27,9 +27,7 @@ package sun.net.www.protocol.mailto; import java.net.URL; import java.net.InetAddress; -import java.net.SocketPermission; import java.io.*; -import java.security.Permission; import jdk.internal.util.StaticProperty; import sun.net.www.*; @@ -48,7 +46,6 @@ public class MailToURLConnection extends URLConnection { OutputStream os = null; SmtpClient client; - Permission permission; private int connectTimeout = -1; private int readTimeout = -1; @@ -67,12 +64,6 @@ public class MailToURLConnection extends URLConnection { String getFromAddress() { String str = System.getProperty("user.fromaddr"); if (str == null) { - // Perform the property security check for user.name - @SuppressWarnings("removal") - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPropertyAccess("user.name"); - } str = StaticProperty.userName(); if (str != null) { String host = System.getProperty("mail.host"); @@ -112,16 +103,6 @@ public class MailToURLConnection extends URLConnection { return os; } - @Override - public Permission getPermission() throws IOException { - if (permission == null) { - connect(); - String host = client.getMailHost() + ":" + 25; - permission = new SocketPermission(host, "connect"); - } - return permission; - } - @Override public void setConnectTimeout(int timeout) { if (timeout < 0)