mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8344189: Cleanup code in sun.net.www.protocol.mailto.MailToURLConnection and sun.net.smtp after JEP 486 integration
Reviewed-by: dfuchs
This commit is contained in:
parent
73fd8919f5
commit
f3168082b8
2 changed files with 4 additions and 24 deletions
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import sun.net.TransferProtocolClient;
|
import sun.net.TransferProtocolClient;
|
||||||
import sun.security.action.GetPropertyAction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements the SMTP client.
|
* This class implements the SMTP client.
|
||||||
|
@ -167,7 +166,7 @@ public class SmtpClient extends TransferProtocolClient {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
String s;
|
String s;
|
||||||
mailhost = GetPropertyAction.privilegedGetProperty("mail.host");
|
mailhost = System.getProperty("mail.host");
|
||||||
if (mailhost != null) {
|
if (mailhost != null) {
|
||||||
openServer(mailhost);
|
openServer(mailhost);
|
||||||
return;
|
return;
|
||||||
|
@ -193,7 +192,7 @@ public class SmtpClient extends TransferProtocolClient {
|
||||||
setConnectTimeout(to);
|
setConnectTimeout(to);
|
||||||
try {
|
try {
|
||||||
String s;
|
String s;
|
||||||
mailhost = GetPropertyAction.privilegedGetProperty("mail.host");
|
mailhost = System.getProperty("mail.host");
|
||||||
if (mailhost != null) {
|
if (mailhost != null) {
|
||||||
openServer(mailhost);
|
openServer(mailhost);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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.URL;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.SocketPermission;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.security.Permission;
|
|
||||||
|
|
||||||
import jdk.internal.util.StaticProperty;
|
import jdk.internal.util.StaticProperty;
|
||||||
import sun.net.www.*;
|
import sun.net.www.*;
|
||||||
|
@ -48,7 +46,6 @@ public class MailToURLConnection extends URLConnection {
|
||||||
OutputStream os = null;
|
OutputStream os = null;
|
||||||
|
|
||||||
SmtpClient client;
|
SmtpClient client;
|
||||||
Permission permission;
|
|
||||||
private int connectTimeout = -1;
|
private int connectTimeout = -1;
|
||||||
private int readTimeout = -1;
|
private int readTimeout = -1;
|
||||||
|
|
||||||
|
@ -67,12 +64,6 @@ public class MailToURLConnection extends URLConnection {
|
||||||
String getFromAddress() {
|
String getFromAddress() {
|
||||||
String str = System.getProperty("user.fromaddr");
|
String str = System.getProperty("user.fromaddr");
|
||||||
if (str == null) {
|
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();
|
str = StaticProperty.userName();
|
||||||
if (str != null) {
|
if (str != null) {
|
||||||
String host = System.getProperty("mail.host");
|
String host = System.getProperty("mail.host");
|
||||||
|
@ -112,16 +103,6 @@ public class MailToURLConnection extends URLConnection {
|
||||||
return os;
|
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
|
@Override
|
||||||
public void setConnectTimeout(int timeout) {
|
public void setConnectTimeout(int timeout) {
|
||||||
if (timeout < 0)
|
if (timeout < 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue