Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
cfb3eca4
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看板
提交
cfb3eca4
编写于
11月 01, 2018
作者:
I
itakiguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8211382: ISO2022JP and GB18030 NIO converter issues
Reviewed-by: sherman, rriggs
上级
030e4c7d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
100 addition
and
5 deletion
+100
-5
src/share/classes/sun/nio/cs/ext/GB18030.java
src/share/classes/sun/nio/cs/ext/GB18030.java
+1
-1
src/share/classes/sun/nio/cs/ext/ISO2022_JP.java
src/share/classes/sun/nio/cs/ext/ISO2022_JP.java
+2
-2
test/sun/nio/cs/TestGB18030.java
test/sun/nio/cs/TestGB18030.java
+82
-0
test/sun/nio/cs/TestISO2022JP.java
test/sun/nio/cs/TestISO2022JP.java
+15
-2
未找到文件。
src/share/classes/sun/nio/cs/ext/GB18030.java
浏览文件 @
cfb3eca4
...
...
@@ -12518,7 +12518,7 @@ public class GB18030
dst.put(getChar(offset));
else if (offset >= 0x830D && offset <= 0x93A8)
dst.put((char)(offset + 0x6557));
else if (offset >= 0x93A9 && offset <= 0x99F
9
)
else if (offset >= 0x93A9 && offset <= 0x99F
B
)
dst.put(getChar(offset));
// Supplemental UCS planes handled via surrogates
else if (offset >= 0x2E248 && offset < 0x12E248) {
...
...
src/share/classes/sun/nio/cs/ext/ISO2022_JP.java
浏览文件 @
cfb3eca4
...
...
@@ -309,7 +309,7 @@ public class ISO2022_JP
break
;
case
JISX0201_1976_KANA:
case
SHIFTOUT:
if
(
b1
>
0x
60
)
{
if
(
b1
>
0x
5f
)
{
return
CoderResult
.
malformedForLength
(
inputSize
);
}
da
[
dp
++]
=
(
char
)(
b1
+
0xff40
);
...
...
@@ -430,7 +430,7 @@ public class ISO2022_JP
break
;
case
JISX0201_1976_KANA:
case
SHIFTOUT:
if
(
b1
>
0x
60
)
{
if
(
b1
>
0x
5f
)
{
return
CoderResult
.
malformedForLength
(
inputSize
);
}
dst
.
put
((
char
)(
b1
+
0xff40
));
...
...
test/sun/nio/cs/TestGB18030.java
0 → 100644
浏览文件 @
cfb3eca4
/*
* Copyright (c) 2018, 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 8211382
* @summary Check GB18030
* @modules jdk.charsets
*/
import
java.io.*
;
import
java.nio.*
;
import
java.nio.charset.*
;
public
class
TestGB18030
{
public
static
void
gb18030_1
(
boolean
useDirect
)
throws
Exception
{
for
(
char
ch
:
new
char
[]{
'\
uFFFE
'
,
'\
uFFFF
'
})
{
char
[]
ca
=
new
char
[]{
ch
};
Charset
cs
=
Charset
.
forName
(
"GB18030"
);
CharsetEncoder
ce
=
cs
.
newEncoder
();
CharsetDecoder
cd
=
cs
.
newDecoder
();
CharBuffer
cb
=
CharBuffer
.
wrap
(
ca
);
ByteBuffer
bb
;
if
(
useDirect
)
{
bb
=
ByteBuffer
.
allocateDirect
(
(
int
)
Math
.
ceil
(
ce
.
maxBytesPerChar
()));
}
else
{
bb
=
ByteBuffer
.
allocate
(
(
int
)
Math
.
ceil
(
ce
.
maxBytesPerChar
()));
}
CoderResult
cr
=
ce
.
encode
(
cb
,
bb
,
true
);
if
(!
cr
.
isUnderflow
())
{
throw
new
RuntimeException
(
String
.
format
(
"Encoder Error: \\u%04X: direct=%b: %s"
,
(
int
)
ch
,
useDirect
,
cr
.
toString
()));
}
bb
.
position
(
0
);
cb
=
CharBuffer
.
allocate
((
int
)
Math
.
ceil
(
cd
.
maxCharsPerByte
()*
bb
.
limit
()));
cr
=
cd
.
decode
(
bb
,
cb
,
true
);
if
(!
cr
.
isUnderflow
())
{
throw
new
RuntimeException
(
String
.
format
(
"Decoder Error: \\u%04X: direct=%b: %s"
,
(
int
)
ch
,
useDirect
,
cr
.
toString
()));
}
if
(
ca
[
0
]
!=
cb
.
get
(
0
))
{
throw
new
RuntimeException
(
String
.
format
(
"direct=%b: \\u%04X <> \\u%04X"
,
useDirect
,
(
int
)
ca
[
0
],
(
int
)
cb
.
get
(
0
)));
}
}
}
public
static
void
main
(
String
args
[])
throws
Exception
{
gb18030_1
(
false
);
gb18030_1
(
true
);
}
}
test/sun/nio/cs/TestISO2022JP.java
浏览文件 @
cfb3eca4
/*
* Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008,
2018,
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
...
...
@@ -22,7 +22,7 @@
*/
/* @test
@bug 4626545 4879522 4913711 4119445
@bug 4626545 4879522 4913711 4119445
8211382
@summary Check full coverage encode/decode for ISO-2022-JP
*/
...
...
@@ -608,5 +608,18 @@ public class TestISO2022JP {
if
(
encoded
[
i
]
!=
expected
[
i
])
throw
new
Exception
(
"ISO-2022-JP Decoder error"
);
}
// Test for 11 iso2022jp decoder
encoded
=
new
byte
[]
{
(
byte
)
0x1B
,
(
byte
)
0x28
,
(
byte
)
0x49
,
(
byte
)
0x60
,
(
byte
)
0x1B
,
(
byte
)
0x28
,
(
byte
)
0x42
,
};
String
unexpectedStr
=
"\uffa0"
;
String
expectedStr
=
"\ufffd"
;
if
(
new
String
(
encoded
,
"ISO2022JP"
).
equals
(
unexpectedStr
))
{
throw
new
Exception
(
"ISO2022JP Decoder error: \\uFFA0"
);
}
else
if
(!
new
String
(
encoded
,
"ISO2022JP"
).
equals
(
expectedStr
))
{
throw
new
Exception
(
"ISO2022JP Decoder error: \\uFFFD"
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录