Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
aeea96ec
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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,发现更多精彩内容 >>
提交
aeea96ec
编写于
11月 04, 2013
作者:
M
michaelm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8027687: The constructors of URLPermission class do not behave as described in javad
Reviewed-by: chegar, mduigou
上级
f7f2f7e1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
4 deletion
+50
-4
src/share/classes/java/net/HostPortrange.java
src/share/classes/java/net/HostPortrange.java
+34
-2
src/share/classes/java/net/URLPermission.java
src/share/classes/java/net/URLPermission.java
+4
-1
test/java/net/URLPermission/URLPermissionTest.java
test/java/net/URLPermission/URLPermissionTest.java
+12
-1
未找到文件。
src/share/classes/java/net/HostPortrange.java
浏览文件 @
aeea96ec
...
...
@@ -114,7 +114,7 @@ class HostPortrange {
if
(
hoststr
.
equals
(
"*"
))
{
hoststr
=
""
;
}
else
if
(
hoststr
.
startsWith
(
"*."
))
{
hoststr
=
hoststr
.
substring
(
1
).
toLowerCase
();
// leave the '.' ?
hoststr
=
toLowerCase
(
hoststr
.
substring
(
1
));
}
else
{
throw
new
IllegalArgumentException
(
"invalid host wildcard specification"
);
}
...
...
@@ -147,7 +147,7 @@ class HostPortrange {
hoststr
=
sb
.
toString
();
}
else
{
// regular domain name
hoststr
=
hoststr
.
toLowerCase
(
);
hoststr
=
toLowerCase
(
hoststr
);
}
}
}
...
...
@@ -161,6 +161,38 @@ class HostPortrange {
}
}
static
final
int
CASE_DIFF
=
'A'
-
'a'
;
/**
* Convert to lower case, and check that all chars are ascii
* alphanumeric, '-' or '.' only.
*/
static
String
toLowerCase
(
String
s
)
{
int
len
=
s
.
length
();
StringBuilder
sb
=
null
;
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
if
((
c
>=
'a'
&&
c
<=
'z'
)
||
(
c
==
'.'
))
{
if
(
sb
!=
null
)
sb
.
append
(
c
);
}
else
if
((
c
>=
'0'
&&
c
<=
'9'
)
||
(
c
==
'-'
))
{
if
(
sb
!=
null
)
sb
.
append
(
c
);
}
else
if
(
c
>=
'A'
&&
c
<=
'Z'
)
{
if
(
sb
==
null
)
{
sb
=
new
StringBuilder
(
len
);
sb
.
append
(
s
,
0
,
i
);
}
sb
.
append
((
char
)(
c
-
CASE_DIFF
));
}
else
{
throw
new
IllegalArgumentException
(
"Invalid characters in hostname"
);
}
}
return
sb
==
null
?
s
:
sb
.
toString
();
}
public
boolean
literal
()
{
return
literal
;
}
...
...
src/share/classes/java/net/URLPermission.java
浏览文件 @
aeea96ec
...
...
@@ -426,7 +426,10 @@ public final class URLPermission extends Permission {
this
.
ssp
=
url
.
substring
(
delim
+
1
);
if
(!
ssp
.
startsWith
(
"//"
))
{
this
.
authority
=
new
Authority
(
scheme
,
ssp
.
toLowerCase
());
if
(!
ssp
.
equals
(
"*"
))
{
throw
new
IllegalArgumentException
(
"invalid URL string"
);
}
this
.
authority
=
new
Authority
(
scheme
,
"*"
);
return
;
}
String
authpath
=
ssp
.
substring
(
2
);
...
...
test/java/net/URLPermission/URLPermissionTest.java
浏览文件 @
aeea96ec
...
...
@@ -186,6 +186,14 @@ public class URLPermissionTest {
imtest
(
"http:*"
,
"https://www.foo.com/a/b/c"
,
false
),
imtest
(
"http:*"
,
"http://www.foo.com/a/b/c"
,
true
),
imtest
(
"http:*"
,
"http://foo/bar"
,
true
),
imtest
(
"http://WWW.foO.cOM/a/b/*"
,
"http://wwW.foo.com/a/b/c"
,
true
),
imtest
(
"http://wWw.fOo.cOm/a/b/*"
,
"http://Www.foo.com/a/b/*"
,
true
),
imtest
(
"http://www.FOO.com/"
,
"http://www.foo.COM/"
,
true
),
imtest
(
"http://66ww-w.F-O012O.com/"
,
"http://66ww-w.f-o012o.COM/"
,
true
),
imtest
(
"http://xn--ire-9la.com/"
,
"http://xn--ire-9la.COM/"
,
true
),
imtest
(
"http://x/"
,
"http://X/"
,
true
),
imtest
(
"http://x/"
,
"http://x/"
,
true
),
imtest
(
"http://X/"
,
"http://X/"
,
true
),
imtest
(
"http://foo/bar"
,
"https://foo/bar"
,
false
)
};
...
...
@@ -194,9 +202,12 @@ public class URLPermissionTest {
static
Test
[]
exceptionTests
=
{
extest
(
"http://1.2.3.4.5/a/b/c"
),
extest
(
"http://www.*.com"
),
//extest("http://www.foo.com:1-X"),
extest
(
"http://[foo.com]:99"
),
extest
(
"http://[fec0::X]:99"
),
extest
(
"http:\\www.foo.com"
),
extest
(
"http://w_09ww.foo.com"
),
extest
(
"http://w&09ww.foo.com/p"
),
extest
(
"http://www+foo.com"
),
extest
(
"http:"
)
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录