Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
424ededc
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看板
提交
424ededc
编写于
11月 18, 2010
作者:
A
alanb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7000913: (bf) CharBuffer.wrap, slice, position, slice leads to CharBuffer with incorrect offser
Reviewed-by: forax
上级
28c5302b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
3 deletion
+19
-3
src/share/classes/java/nio/StringCharBuffer.java
src/share/classes/java/nio/StringCharBuffer.java
+1
-1
test/java/nio/Buffer/StringCharBufferSliceTest.java
test/java/nio/Buffer/StringCharBufferSliceTest.java
+18
-2
未找到文件。
src/share/classes/java/nio/StringCharBuffer.java
浏览文件 @
424ededc
...
@@ -47,7 +47,7 @@ class StringCharBuffer // package-private
...
@@ -47,7 +47,7 @@ class StringCharBuffer // package-private
0
,
0
,
this
.
remaining
(),
this
.
remaining
(),
this
.
remaining
(),
this
.
remaining
(),
this
.
position
());
offset
+
this
.
position
());
}
}
private
StringCharBuffer
(
CharSequence
s
,
private
StringCharBuffer
(
CharSequence
s
,
...
...
test/java/nio/Buffer/StringCharBufferSliceTest.java
浏览文件 @
424ededc
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
*/
*/
/* @test
/* @test
* @bug 4997655
* @bug 4997655
7000913
* @summary (bf) CharBuffer.slice() on wrapped CharSequence results in wrong position
* @summary (bf) CharBuffer.slice() on wrapped CharSequence results in wrong position
*/
*/
...
@@ -75,12 +75,27 @@ public class StringCharBufferSliceTest {
...
@@ -75,12 +75,27 @@ public class StringCharBufferSliceTest {
}
}
}
}
System
.
out
.
println
(
">>> StringCharBufferSliceTest-main: testing slice with result of slice"
);
buff
.
position
(
0
);
buff
.
limit
(
buff
.
capacity
());
slice
=
buff
.
slice
();
for
(
int
i
=
0
;
i
<
4
;
i
++)
{
slice
.
position
(
i
);
CharBuffer
nextSlice
=
slice
.
slice
();
if
(
nextSlice
.
position
()
!=
0
)
throw
new
RuntimeException
(
"New buffer's position should be zero"
);
if
(!
nextSlice
.
equals
(
slice
))
throw
new
RuntimeException
(
"New buffer should be equal"
);
slice
=
nextSlice
;
}
System
.
out
.
println
(
System
.
out
.
println
(
">>> StringCharBufferSliceTest-main: testing toString."
);
">>> StringCharBufferSliceTest-main: testing toString."
);
buff
.
position
(
4
);
buff
.
position
(
4
);
buff
.
limit
(
7
);
buff
.
limit
(
7
);
slice
=
buff
.
slice
();
slice
=
buff
.
slice
();
if
(!
slice
.
toString
().
equals
(
"tes"
))
{
if
(!
slice
.
toString
().
equals
(
"tes"
))
{
throw
new
RuntimeException
(
"bad toString() after slice(): "
+
slice
.
toString
());
throw
new
RuntimeException
(
"bad toString() after slice(): "
+
slice
.
toString
());
}
}
...
@@ -104,6 +119,7 @@ public class StringCharBufferSliceTest {
...
@@ -104,6 +119,7 @@ public class StringCharBufferSliceTest {
||
dupe
.
charAt
(
2
)
!=
's'
||
dupe
.
charAt
(
3
)
!=
't'
)
{
||
dupe
.
charAt
(
2
)
!=
's'
||
dupe
.
charAt
(
3
)
!=
't'
)
{
throw
new
RuntimeException
(
"bad duplicate() after slice(): '"
+
dupe
+
"'"
);
throw
new
RuntimeException
(
"bad duplicate() after slice(): '"
+
dupe
+
"'"
);
}
}
System
.
out
.
println
(
">>> StringCharBufferSliceTest-main: done!"
);
System
.
out
.
println
(
">>> StringCharBufferSliceTest-main: done!"
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录