Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1f41b87f
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,发现更多精彩内容 >>
提交
1f41b87f
编写于
12月 28, 2012
作者:
P
peytoia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8005277: Regression in JDK 7 in Bidi implementation
Reviewed-by: okutsu
上级
3322bce3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
183 addition
and
34 deletion
+183
-34
src/share/classes/sun/text/bidi/BidiBase.java
src/share/classes/sun/text/bidi/BidiBase.java
+1
-2
test/java/text/Bidi/BidiConformance.java
test/java/text/Bidi/BidiConformance.java
+115
-32
test/java/text/Bidi/Bug8005277.java
test/java/text/Bidi/Bug8005277.java
+67
-0
未找到文件。
src/share/classes/sun/text/bidi/BidiBase.java
浏览文件 @
1f41b87f
...
...
@@ -3251,10 +3251,9 @@ public class BidiBase {
{
verifyValidParaOrLine
();
BidiLine
.
getRuns
(
this
);
if
(
run
Count
==
1
)
{
if
(
run
<
0
||
run
>=
runCount
)
{
return
getParaLevel
();
}
verifyIndex
(
run
,
0
,
runCount
);
getLogicalToVisualRunsMap
();
return
runs
[
logicalToVisualRunsMap
[
run
]].
level
;
}
...
...
test/java/text/Bidi/BidiConformance.java
浏览文件 @
1f41b87f
...
...
@@ -656,7 +656,6 @@ public class BidiConformance {
baseIsLTR4Constructor1
[
textNo
][
testNo
],
isLTR_isRTL4Constructor1
[
textNo
][
0
][
testNo
],
isLTR_isRTL4Constructor1
[
textNo
][
1
][
testNo
]);
System
.
out
.
println
(
bidi
.
toString
());
}
private
void
callTestEachMethod4Constructor2
(
int
textNo
,
...
...
@@ -668,7 +667,6 @@ System.out.println(bidi.toString());
baseIsLTR4Constructor2
[
textNo
][
flagNo
],
isLTR_isRTL4Constructor2
[
textNo
][
0
][
flagNo
],
isLTR_isRTL4Constructor2
[
textNo
][
1
][
flagNo
]);
System
.
out
.
println
(
bidi
.
toString
());
}
private
void
callTestEachMethod4Constructor3
(
int
textNo
,
...
...
@@ -680,7 +678,6 @@ System.out.println(bidi.toString());
baseIsLTR4Constructor3
[
textNo
][
dataNo
],
isLTR_isRTL4Constructor3
[
textNo
][
0
][
dataNo
],
isLTR_isRTL4Constructor3
[
textNo
][
1
][
dataNo
]);
System
.
out
.
println
(
bidi
.
toString
());
}
private
StringBuilder
sb
=
new
StringBuilder
();
...
...
@@ -934,59 +931,145 @@ System.out.println(bidi.toString());
System
.
out
.
println
(
"*** Test getRunLevel()"
);
String
str
=
"ABC 123"
;
int
length
=
str
.
length
();
Bidi
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_LEFT_TO_RIGHT
);
try
{
if
(
bidi
.
getRunLevel
(-
1
)
!=
0
||
// runCount - 2
if
(
bidi
.
getRunLevel
(-
1
)
!=
0
||
// runCount - 2
(out of range)
bidi
.
getRunLevel
(
0
)
!=
0
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
0
||
// runCount
bidi
.
getRunLevel
(
2
)
!=
0
)
{
// runCount + 1
errorHandling
(
"getRunLevel() should return 0"
+
" when getRunCount() is 1."
);
bidi
.
getRunLevel
(
1
)
!=
0
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
0
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception "
+
"when getRunCount() is 1."
);
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
str
=
"ABC "
+
HebrewABC
+
" 123"
;
length
=
str
.
length
();
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_LEFT_TO_RIGHT
);
try
{
if
(
bidi
.
getRunLevel
(-
1
)
!=
0
||
// runCount - 4 (out of range)
bidi
.
getRunLevel
(
0
)
!=
0
||
// runCount - 3
bidi
.
getRunLevel
(
1
)
!=
1
||
// runCount - 2
bidi
.
getRunLevel
(
2
)
!=
2
||
// runCount - 1
bidi
.
getRunLevel
(
3
)
!=
0
||
// runCount (out of range)
bidi
.
getRunLevel
(
4
)
!=
0
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
str
=
"ABC"
;
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_LEFT_TO_RIGHT
);
try
{
bidi
.
getRunLevel
(-
1
);
errorHandling
(
"getRunLevel() should throw an AIOoBE "
+
"when run is -1(too small)."
);
if
(
bidi
.
getRunLevel
(-
1
)
!=
0
||
// runCount - 2 (out of range)
bidi
.
getRunLevel
(
0
)
!=
0
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
0
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
0
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
catch
(
IllegalArgumentException
e
)
{
errorHandling
(
"getRunLevel() should not throw an IAE "
+
"but an AIOoBE when run is -1(too small)."
);
str
=
"ABC"
;
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_RIGHT_TO_LEFT
);
try
{
if
(
bidi
.
getRunLevel
(-
1
)
!=
1
||
// runCount - 2 (out of range)
bidi
.
getRunLevel
(
0
)
!=
2
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
1
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
1
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
str
=
"ABC"
;
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_DEFAULT_LEFT_TO_RIGHT
);
try
{
bidi
.
getRunLevel
(
0
);
bidi
.
getRunLevel
(
1
);
bidi
.
getRunLevel
(
2
);
if
(
bidi
.
getRunLevel
(-
1
)
!=
0
||
// runCount - 2 (out of range)
bidi
.
getRunLevel
(
0
)
!=
0
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
0
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
0
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception"
+
" when run is from 0 to 2(runCount-1)."
);
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
str
=
"ABC"
;
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_DEFAULT_RIGHT_TO_LEFT
);
try
{
bidi
.
getRunLevel
(
3
);
errorHandling
(
"getRunLevel() should throw an AIOoBE"
+
" when run is 3(same as runCount)."
);
if
(
bidi
.
getRunLevel
(-
1
)
!=
0
||
// runCount - 2 (out of range)
bidi
.
getRunLevel
(
0
)
!=
0
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
0
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
0
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
catch
(
IllegalArgumentException
e
)
{
errorHandling
(
"getRunLevel() should not throw an IAE "
+
"but an AIOoBE when run is 3(same as runCount)."
);
str
=
HebrewABC
;
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_LEFT_TO_RIGHT
);
try
{
if
(
bidi
.
getRunLevel
(-
1
)
!=
0
||
// runCount - 2 (out of range)
bidi
.
getRunLevel
(
0
)
!=
1
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
0
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
0
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
str
=
HebrewABC
;
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_RIGHT_TO_LEFT
);
try
{
if
(
bidi
.
getRunLevel
(-
1
)
!=
1
||
// runCount - 2 (out of range)
bidi
.
getRunLevel
(
0
)
!=
1
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
1
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
1
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
str
=
HebrewABC
;
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_DEFAULT_LEFT_TO_RIGHT
);
try
{
if
(
bidi
.
getRunLevel
(-
1
)
!=
1
||
// runCount - 2 (out of range)
bidi
.
getRunLevel
(
0
)
!=
1
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
1
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
1
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
str
=
HebrewABC
;
bidi
=
new
Bidi
(
str
,
Bidi
.
DIRECTION_DEFAULT_RIGHT_TO_LEFT
);
try
{
if
(
bidi
.
getRunLevel
(-
1
)
!=
1
||
// runCount - 2 (out of range)
bidi
.
getRunLevel
(
0
)
!=
1
||
// runCount - 1
bidi
.
getRunLevel
(
1
)
!=
1
||
// runCount (out of range)
bidi
.
getRunLevel
(
2
)
!=
1
)
{
// runCount + 1 (out of range)
errorHandling
(
"Incorrect getRunLevel() value(s)."
);
}
}
catch
(
Exception
e
)
{
errorHandling
(
"getRunLevel() should not throw an exception: "
+
e
);
}
}
...
...
test/java/text/Bidi/Bug8005277.java
0 → 100644
浏览文件 @
1f41b87f
/*
* Copyright (c) 2012, 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 8005277
* @summary verify that Bidi.getRunLevel() returns a corect level.
*/
import
java.text.Bidi
;
public
class
Bug8005277
{
public
static
void
main
(
String
[]
args
)
{
boolean
err
=
false
;
String
string
=
"\u05D0\u05D1\u05D2"
;
Bidi
bidi
=
new
Bidi
(
string
,
Bidi
.
DIRECTION_LEFT_TO_RIGHT
);
int
result
=
bidi
.
getRunCount
();
if
(
result
!=
1
)
{
System
.
err
.
println
(
"Incorrect run count: "
+
result
);
err
=
true
;
}
result
=
bidi
.
getRunStart
(
0
);
if
(
result
!=
0
)
{
System
.
err
.
println
(
"Incorrect run start: "
+
result
);
err
=
true
;
}
result
=
bidi
.
getRunLimit
(
0
);
if
(
result
!=
3
)
{
System
.
err
.
println
(
"Incorrect run limit: "
+
result
);
err
=
true
;
}
result
=
bidi
.
getRunLevel
(
0
);
if
(
result
!=
1
)
{
System
.
err
.
println
(
"Incorrect run level: "
+
result
);
err
=
true
;
}
if
(
err
)
{
throw
new
RuntimeException
(
"Failed."
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录