Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c3bad3fb
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c3bad3fb
编写于
3月 09, 2017
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
9b651bb0
b72f5155
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
229 addition
and
14 deletion
+229
-14
.hgtags
.hgtags
+2
-0
src/share/classes/sun/net/ftp/impl/FtpClient.java
src/share/classes/sun/net/ftp/impl/FtpClient.java
+15
-4
src/share/classes/sun/net/smtp/SmtpClient.java
src/share/classes/sun/net/smtp/SmtpClient.java
+14
-4
src/share/classes/sun/net/www/http/HttpClient.java
src/share/classes/sun/net/www/http/HttpClient.java
+5
-1
src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
...re/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
+33
-3
src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
...asses/sun/security/util/AbstractAlgorithmConstraints.java
+1
-1
src/windows/native/java/lang/java_props_md.c
src/windows/native/java/lang/java_props_md.c
+4
-1
test/sun/net/ftp/FtpURLConnectionLeak.java
test/sun/net/ftp/FtpURLConnectionLeak.java
+155
-0
未找到文件。
.hgtags
浏览文件 @
c3bad3fb
...
...
@@ -687,4 +687,6 @@ af0e709d28f9124dd2c37069e0bf4c0751248c61 jdk8u131-b05
3c7f99282d1b5e29f7466bf25fb6878bfebfc58a jdk8u131-b06
f5d0aadb4d1ca74eda4e98cc0030f1618ef4c870 jdk8u131-b07
6e362e6002abc39c63fc8ab4bcebf08e273f5a94 jdk8u131-b08
40d00399869d8a28cfecf360234f340e9e0ad3b1 jdk8u131-b09
c0091a673d766ce2e76a945bab6de325fe78dd88 jdk8u131-b10
a160009bbe1417d85f1c0eec890fdb17391b3637 jdk8u141-b00
src/share/classes/sun/net/ftp/impl/FtpClient.java
浏览文件 @
c3bad3fb
/*
* Copyright (c) 2009, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 201
7
, 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
...
...
@@ -517,7 +517,8 @@ public class FtpClient extends sun.net.ftp.FtpClient {
* @return <code>true</code> if the command was successful
* @throws IOException
*/
private
boolean
issueCommand
(
String
cmd
)
throws
IOException
{
private
boolean
issueCommand
(
String
cmd
)
throws
IOException
,
sun
.
net
.
ftp
.
FtpProtocolException
{
if
(!
isConnected
())
{
throw
new
IllegalStateException
(
"Not connected"
);
}
...
...
@@ -528,6 +529,12 @@ public class FtpClient extends sun.net.ftp.FtpClient {
// ignore...
}
}
if
(
cmd
.
indexOf
(
'\n'
)
!=
-
1
)
{
sun
.
net
.
ftp
.
FtpProtocolException
ex
=
new
sun
.
net
.
ftp
.
FtpProtocolException
(
"Illegal FTP command"
);
ex
.
initCause
(
new
IllegalArgumentException
(
"Illegal carriage return"
));
throw
ex
;
}
sendServer
(
cmd
+
"\r\n"
);
return
readReply
();
}
...
...
@@ -1120,7 +1127,10 @@ public class FtpClient extends sun.net.ftp.FtpClient {
*/
public
void
close
()
throws
IOException
{
if
(
isConnected
())
{
issueCommand
(
"QUIT"
);
try
{
issueCommand
(
"QUIT"
);
}
catch
(
FtpProtocolException
e
)
{
}
loggedIn
=
false
;
}
disconnect
();
...
...
@@ -1898,7 +1908,8 @@ public class FtpClient extends sun.net.ftp.FtpClient {
return
null
;
}
private
boolean
sendSecurityData
(
byte
[]
buf
)
throws
IOException
{
private
boolean
sendSecurityData
(
byte
[]
buf
)
throws
IOException
,
sun
.
net
.
ftp
.
FtpProtocolException
{
BASE64Encoder
encoder
=
new
BASE64Encoder
();
String
s
=
encoder
.
encode
(
buf
);
return
issueCommand
(
"ADAT "
+
s
);
...
...
src/share/classes/sun/net/smtp/SmtpClient.java
浏览文件 @
c3bad3fb
/*
* Copyright (c) 1995, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 201
7
, 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
...
...
@@ -43,6 +43,7 @@ import sun.net.TransferProtocolClient;
public
class
SmtpClient
extends
TransferProtocolClient
{
private
static
int
DEFAULT_SMTP_PORT
=
25
;
String
mailhost
;
SmtpPrintStream
message
;
...
...
@@ -74,6 +75,10 @@ public class SmtpClient extends TransferProtocolClient {
}
public
void
to
(
String
s
)
throws
IOException
{
if
(
s
.
indexOf
(
'\n'
)
!=
-
1
)
{
throw
new
IOException
(
"Illegal SMTP command"
,
new
IllegalArgumentException
(
"Illegal carriage return"
));
}
int
st
=
0
;
int
limit
=
s
.
length
();
int
pos
=
0
;
...
...
@@ -116,16 +121,21 @@ public class SmtpClient extends TransferProtocolClient {
}
public
void
from
(
String
s
)
throws
IOException
{
if
(
s
.
startsWith
(
"<"
))
if
(
s
.
indexOf
(
'\n'
)
!=
-
1
)
{
throw
new
IOException
(
"Illegal SMTP command"
,
new
IllegalArgumentException
(
"Illegal carriage return"
));
}
if
(
s
.
startsWith
(
"<"
))
{
issueCommand
(
"mail from: "
+
s
+
"\r\n"
,
250
);
else
}
else
{
issueCommand
(
"mail from: <"
+
s
+
">\r\n"
,
250
);
}
}
/** open a SMTP connection to host <i>host</i>. */
private
void
openServer
(
String
host
)
throws
IOException
{
mailhost
=
host
;
openServer
(
mailhost
,
25
);
openServer
(
mailhost
,
DEFAULT_SMTP_PORT
);
issueCommand
(
"helo "
+
InetAddress
.
getLocalHost
().
getHostName
()+
"\r\n"
,
250
);
}
...
...
src/share/classes/sun/net/www/http/HttpClient.java
浏览文件 @
c3bad3fb
...
...
@@ -952,7 +952,11 @@ public class HttpClient extends NetworkClient {
pi
.
setContentType
(
responses
.
findValue
(
"content-type"
));
}
if
(
isKeepingAlive
())
{
// If disableKeepAlive == true, the client will not be returned
// to the cache. But we still need to use a keepalive stream to
// allow the multi-message authentication exchange on the connection
boolean
useKeepAliveStream
=
isKeepingAlive
()
||
disableKeepAlive
;
if
(
useKeepAliveStream
)
{
// Wrap KeepAliveStream if keep alive is enabled.
logFinest
(
"KeepAlive stream used: "
+
url
);
serverInput
=
new
KeepAliveStream
(
serverInput
,
pi
,
cl
,
this
);
...
...
src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java
浏览文件 @
c3bad3fb
/*
* Copyright (c) 1994, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
6
, 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
...
...
@@ -298,6 +298,13 @@ public class FtpURLConnection extends URLConnection {
// Just keep throwing for now.
throw
e
;
}
catch
(
FtpProtocolException
fe
)
{
if
(
ftp
!=
null
)
{
try
{
ftp
.
close
();
}
catch
(
IOException
ioe
)
{
fe
.
addSuppressed
(
ioe
);
}
}
throw
new
IOException
(
fe
);
}
try
{
...
...
@@ -480,11 +487,34 @@ public class FtpURLConnection extends URLConnection {
msgh
.
add
(
"content-type"
,
"text/plain"
);
msgh
.
add
(
"access-type"
,
"directory"
);
}
catch
(
IOException
ex
)
{
throw
new
FileNotFoundException
(
fullpath
);
FileNotFoundException
fnfe
=
new
FileNotFoundException
(
fullpath
);
if
(
ftp
!=
null
)
{
try
{
ftp
.
close
();
}
catch
(
IOException
ioe
)
{
fnfe
.
addSuppressed
(
ioe
);
}
}
throw
fnfe
;
}
catch
(
FtpProtocolException
ex2
)
{
throw
new
FileNotFoundException
(
fullpath
);
FileNotFoundException
fnfe
=
new
FileNotFoundException
(
fullpath
);
if
(
ftp
!=
null
)
{
try
{
ftp
.
close
();
}
catch
(
IOException
ioe
)
{
fnfe
.
addSuppressed
(
ioe
);
}
}
throw
fnfe
;
}
}
catch
(
FtpProtocolException
ftpe
)
{
if
(
ftp
!=
null
)
{
try
{
ftp
.
close
();
}
catch
(
IOException
ioe
)
{
ftpe
.
addSuppressed
(
ioe
);
}
}
throw
new
IOException
(
ftpe
);
}
setProperties
(
msgh
);
...
...
src/share/classes/sun/security/util/AbstractAlgorithmConstraints.java
浏览文件 @
c3bad3fb
/*
* Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016
,
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
...
...
src/windows/native/java/lang/java_props_md.c
浏览文件 @
c3bad3fb
/*
* Copyright (c) 1998, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
6
, 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
...
...
@@ -466,7 +466,9 @@ GetJavaProperties(JNIEnv* env)
* Windows Server 2008 R2 6 1 (!VER_NT_WORKSTATION)
* Windows 8 6 2 (VER_NT_WORKSTATION)
* Windows Server 2012 6 2 (!VER_NT_WORKSTATION)
* Windows Server 2012 R2 6 3 (!VER_NT_WORKSTATION)
* Windows 10 10 0 (VER_NT_WORKSTATION)
* Windows Server 2016 10 0 (!VER_NT_WORKSTATION)
*
* This mapping will presumably be augmented as new Windows
* versions are released.
...
...
@@ -540,6 +542,7 @@ GetJavaProperties(JNIEnv* env)
}
}
else
{
switch
(
minorVersion
)
{
case
0
:
sprops
.
os_name
=
"Windows Server 2016"
;
break
;
default:
sprops
.
os_name
=
"Windows NT (unknown)"
;
}
}
...
...
test/sun/net/ftp/FtpURLConnectionLeak.java
0 → 100644
浏览文件 @
c3bad3fb
/*
* Copyright (c) 2016, 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 7167293
* @summary FtpURLConnection doesn't close FTP connection when FileNotFoundException is thrown
* @library ../www/ftptest/
* @build FtpServer FtpCommandHandler FtpAuthHandler FtpFileSystemHandler
* @run main FtpURLConnectionLeak
*/
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.URL
;
public
class
FtpURLConnectionLeak
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
FtpServer
server
=
new
FtpServer
(
0
);
server
.
setFileSystemHandler
(
new
CustomFileSystemHandler
(
"/"
));
server
.
setAuthHandler
(
new
MyAuthHandler
());
int
port
=
server
.
getLocalPort
();
server
.
start
();
URL
url
=
new
URL
(
"ftp://localhost:"
+
port
+
"/filedoesNotExist.txt"
);
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
try
{
InputStream
stream
=
url
.
openStream
();
}
catch
(
FileNotFoundException
expectedFirstTimeAround
)
{
// should always reach this point since the path does not exist
}
catch
(
IOException
expected
)
{
System
.
out
.
println
(
"caught expected "
+
expected
);
int
times
=
1
;
do
{
// give some time to close the connection...
System
.
out
.
println
(
"sleeping... "
+
times
);
Thread
.
sleep
(
times
*
1000
);
}
while
(
server
.
activeClientsCount
()
>
0
&&
times
++
<
5
);
if
(
server
.
activeClientsCount
()
>
0
)
{
server
.
killClients
();
throw
new
RuntimeException
(
"URLConnection didn't close the"
+
" FTP connection on FileNotFoundException"
);
}
}
finally
{
server
.
terminate
();
}
}
}
static
class
CustomFileSystemHandler
implements
FtpFileSystemHandler
{
private
String
currentDir
;
public
CustomFileSystemHandler
(
String
path
)
{
currentDir
=
path
;
}
@Override
public
boolean
cd
(
String
path
)
{
currentDir
=
path
;
return
true
;
}
@Override
public
boolean
cdUp
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
String
pwd
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
boolean
fileExists
(
String
name
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
InputStream
getFile
(
String
name
)
{
return
null
;
//return null so that server will return 550 File not found.
}
@Override
public
long
getFileSize
(
String
name
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
InputStream
listCurrentDir
()
{
return
null
;
}
@Override
public
OutputStream
putFile
(
String
name
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
boolean
removeFile
(
String
name
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
boolean
mkdir
(
String
name
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
boolean
rename
(
String
from
,
String
to
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
}
static
class
MyAuthHandler
implements
FtpAuthHandler
{
@Override
public
int
authType
()
{
return
0
;
}
@Override
public
boolean
authenticate
(
String
user
,
String
password
)
{
return
true
;
}
@Override
public
boolean
authenticate
(
String
user
,
String
password
,
String
account
)
{
return
true
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录