Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
1da6abc3
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看板
提交
1da6abc3
编写于
9月 30, 2013
作者:
N
naoto
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
Reviewed-by: ksrini, akhil
上级
74e9320e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
160 addition
and
27 deletion
+160
-27
src/windows/bin/cmdtoargs.c
src/windows/bin/cmdtoargs.c
+49
-27
test/tools/launcher/I18NArgTest.java
test/tools/launcher/I18NArgTest.java
+111
-0
未找到文件。
src/windows/bin/cmdtoargs.c
浏览文件 @
1da6abc3
...
@@ -53,6 +53,16 @@ typedef struct {
...
@@ -53,6 +53,16 @@ typedef struct {
static
StdArg
*
stdargs
;
static
StdArg
*
stdargs
;
static
int
stdargc
;
static
int
stdargc
;
static
int
copyCh
(
USHORT
ch
,
char
*
dest
)
{
if
(
HIBYTE
(
ch
)
==
0
)
{
*
dest
=
(
char
)
ch
;
return
1
;
}
else
{
*
((
USHORT
*
)
dest
)
=
ch
;
return
2
;
}
}
static
char
*
next_arg
(
char
*
cmdline
,
char
*
arg
,
jboolean
*
wildcard
)
{
static
char
*
next_arg
(
char
*
cmdline
,
char
*
arg
,
jboolean
*
wildcard
)
{
char
*
src
=
cmdline
;
char
*
src
=
cmdline
;
...
@@ -61,31 +71,43 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
...
@@ -61,31 +71,43 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
int
quotes
=
0
;
int
quotes
=
0
;
int
slashes
=
0
;
int
slashes
=
0
;
char
prev
=
0
;
// "prev"/"ch" may contain either a single byte, or a double byte
char
ch
=
0
;
// character encoded in CP_ACP.
USHORT
prev
=
0
;
USHORT
ch
=
0
;
int
i
;
int
i
;
jboolean
done
=
JNI_FALSE
;
jboolean
done
=
JNI_FALSE
;
int
charLength
;
*
wildcard
=
JNI_FALSE
;
*
wildcard
=
JNI_FALSE
;
while
((
ch
=
*
src
)
!=
0
&&
!
done
)
{
while
(
!
done
)
{
charLength
=
CharNextExA
(
CP_ACP
,
src
,
0
)
-
src
;
if
(
charLength
==
0
)
{
break
;
}
else
if
(
charLength
==
1
)
{
ch
=
(
USHORT
)(
UCHAR
)
src
[
0
];
}
else
{
ch
=
((
USHORT
*
)
src
)[
0
];
}
switch
(
ch
)
{
switch
(
ch
)
{
case
'"'
:
case
L
'"'
:
if
(
separator
)
{
if
(
separator
)
{
done
=
JNI_TRUE
;
done
=
JNI_TRUE
;
break
;
break
;
}
}
if
(
prev
==
'\\'
)
{
if
(
prev
==
L
'\\'
)
{
for
(
i
=
1
;
i
<
slashes
;
i
+=
2
)
{
for
(
i
=
1
;
i
<
slashes
;
i
+=
2
)
{
*
dest
++
=
prev
;
dest
+=
copyCh
(
prev
,
dest
)
;
}
}
if
(
slashes
%
2
==
1
)
{
if
(
slashes
%
2
==
1
)
{
*
dest
++
=
ch
;
dest
+=
copyCh
(
ch
,
dest
)
;
}
else
{
}
else
{
quotes
++
;
quotes
++
;
}
}
}
else
if
(
prev
==
'"'
&&
quotes
%
2
==
0
)
{
}
else
if
(
prev
==
L
'"'
&&
quotes
%
2
==
0
)
{
quotes
++
;
quotes
++
;
*
dest
++
=
ch
;
// emit every other consecutive quote
dest
+=
copyCh
(
ch
,
dest
)
;
// emit every other consecutive quote
}
else
if
(
quotes
==
0
)
{
}
else
if
(
quotes
==
0
)
{
quotes
++
;
// starting quote
quotes
++
;
// starting quote
}
else
{
}
else
{
...
@@ -94,7 +116,7 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
...
@@ -94,7 +116,7 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
slashes
=
0
;
slashes
=
0
;
break
;
break
;
case
'\\'
:
case
L
'\\'
:
slashes
++
;
slashes
++
;
if
(
separator
)
{
if
(
separator
)
{
done
=
JNI_TRUE
;
done
=
JNI_TRUE
;
...
@@ -102,23 +124,23 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
...
@@ -102,23 +124,23 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
}
}
break
;
break
;
case
' '
:
case
L
' '
:
case
'\t'
:
case
L
'\t'
:
if
(
prev
==
'\\'
)
{
if
(
prev
==
L
'\\'
)
{
for
(
i
=
0
;
i
<
slashes
;
i
++
)
{
for
(
i
=
0
;
i
<
slashes
;
i
++
)
{
*
dest
++
=
prev
;
dest
+=
copyCh
(
prev
,
dest
)
;
}
}
}
}
if
(
quotes
%
2
==
1
)
{
if
(
quotes
%
2
==
1
)
{
*
dest
++
=
ch
;
dest
+=
copyCh
(
ch
,
dest
)
;
}
else
{
}
else
{
separator
=
JNI_TRUE
;
separator
=
JNI_TRUE
;
}
}
slashes
=
0
;
slashes
=
0
;
break
;
break
;
case
'*'
:
case
L
'*'
:
case
'?'
:
case
L
'?'
:
if
(
separator
)
{
if
(
separator
)
{
done
=
JNI_TRUE
;
done
=
JNI_TRUE
;
separator
=
JNI_FALSE
;
separator
=
JNI_FALSE
;
...
@@ -127,36 +149,36 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
...
@@ -127,36 +149,36 @@ static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
if
(
quotes
%
2
==
0
)
{
if
(
quotes
%
2
==
0
)
{
*
wildcard
=
JNI_TRUE
;
*
wildcard
=
JNI_TRUE
;
}
}
if
(
prev
==
'\\'
)
{
if
(
prev
==
L
'\\'
)
{
for
(
i
=
0
;
i
<
slashes
;
i
++
)
{
for
(
i
=
0
;
i
<
slashes
;
i
++
)
{
*
dest
++
=
prev
;
dest
+=
copyCh
(
prev
,
dest
)
;
}
}
}
}
*
dest
++
=
ch
;
dest
+=
copyCh
(
ch
,
dest
)
;
break
;
break
;
default:
default:
if
(
prev
==
'\\'
)
{
if
(
prev
==
L
'\\'
)
{
for
(
i
=
0
;
i
<
slashes
;
i
++
)
{
for
(
i
=
0
;
i
<
slashes
;
i
++
)
{
*
dest
++
=
prev
;
dest
+=
copyCh
(
prev
,
dest
)
;
}
}
*
dest
++
=
ch
;
dest
+=
copyCh
(
ch
,
dest
)
;
}
else
if
(
separator
)
{
}
else
if
(
separator
)
{
done
=
JNI_TRUE
;
done
=
JNI_TRUE
;
}
else
{
}
else
{
*
dest
++
=
ch
;
dest
+=
copyCh
(
ch
,
dest
)
;
}
}
slashes
=
0
;
slashes
=
0
;
}
}
if
(
!
done
)
{
if
(
!
done
)
{
prev
=
ch
;
prev
=
ch
;
src
++
;
src
+=
charLength
;
}
}
}
}
if
(
prev
==
'\\'
)
{
if
(
prev
==
L
'\\'
)
{
for
(
i
=
0
;
i
<
slashes
;
i
++
)
{
for
(
i
=
0
;
i
<
slashes
;
i
++
)
{
*
dest
++
=
prev
;
dest
+=
copyCh
(
prev
,
dest
)
;
}
}
}
}
*
dest
=
0
;
*
dest
=
0
;
...
...
test/tools/launcher/I18NArgTest.java
0 → 100644
浏览文件 @
1da6abc3
/*
* Copyright (c) 2013, 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 8016110
* @summary verify Japanese character in an argument are treated correctly
* @compile -XDignore.symbol.file I18NArgTest.java
* @run main I18NArgTest
*/
import
java.io.IOException
;
public
class
I18NArgTest
extends
TestHelper
{
public
static
void
main
(
String
...
args
)
throws
IOException
{
if
(!
isWindows
)
{
return
;
}
if
(!
"MS932"
.
equals
(
System
.
getProperty
(
"sun.jnu.encoding"
)))
{
System
.
err
.
println
(
"MS932 encoding not set, test skipped"
);
return
;
}
if
(
args
.
length
==
0
)
{
execTest
(
0x30bd
);
// MS932 Katakana SO, 0x835C
}
else
{
testCharacters
(
args
);
}
}
static
void
execTest
(
int
unicodeValue
)
{
String
hexValue
=
Integer
.
toHexString
(
unicodeValue
);
String
unicodeStr
=
Character
.
toString
((
char
)
unicodeValue
);
execTest
(
"\""
+
unicodeStr
+
"\""
,
hexValue
);
execTest
(
"\\"
+
unicodeStr
+
"\\"
,
hexValue
);
execTest
(
" "
+
unicodeStr
+
" "
,
hexValue
);
execTest
(
"'"
+
unicodeStr
+
"'"
,
hexValue
);
execTest
(
"\t"
+
unicodeStr
+
"\t"
,
hexValue
);
execTest
(
"*"
+
unicodeStr
+
"*"
,
hexValue
);
execTest
(
"?"
+
unicodeStr
+
"?"
,
hexValue
);
execTest
(
"\""
+
unicodeStr
+
unicodeStr
+
"\""
,
hexValue
+
hexValue
);
execTest
(
"\\"
+
unicodeStr
+
unicodeStr
+
"\\"
,
hexValue
+
hexValue
);
execTest
(
" "
+
unicodeStr
+
unicodeStr
+
" "
,
hexValue
+
hexValue
);
execTest
(
"'"
+
unicodeStr
+
unicodeStr
+
"'"
,
hexValue
+
hexValue
);
execTest
(
"\t"
+
unicodeStr
+
unicodeStr
+
"\t"
,
hexValue
+
hexValue
);
execTest
(
"*"
+
unicodeStr
+
unicodeStr
+
"*"
,
hexValue
+
hexValue
);
execTest
(
"?"
+
unicodeStr
+
unicodeStr
+
"?"
,
hexValue
+
hexValue
);
execTest
(
"\""
+
unicodeStr
+
"a"
+
unicodeStr
+
"\""
,
hexValue
+
"61"
+
hexValue
);
execTest
(
"\\"
+
unicodeStr
+
"a"
+
unicodeStr
+
"\\"
,
hexValue
+
"61"
+
hexValue
);
execTest
(
" "
+
unicodeStr
+
"a"
+
unicodeStr
+
" "
,
hexValue
+
"61"
+
hexValue
);
execTest
(
"'"
+
unicodeStr
+
"a"
+
unicodeStr
+
"'"
,
hexValue
+
"61"
+
hexValue
);
execTest
(
"\t"
+
unicodeStr
+
"a"
+
unicodeStr
+
"\t"
,
hexValue
+
"61"
+
hexValue
);
execTest
(
"*"
+
unicodeStr
+
"a"
+
unicodeStr
+
"*"
,
hexValue
+
"61"
+
hexValue
);
execTest
(
"?"
+
unicodeStr
+
"a"
+
unicodeStr
+
"?"
,
hexValue
+
"61"
+
hexValue
);
execTest
(
"\""
+
unicodeStr
+
"\u00b1"
+
unicodeStr
+
"\""
,
hexValue
+
"b1"
+
hexValue
);
execTest
(
"\\"
+
unicodeStr
+
"\u00b1"
+
unicodeStr
+
"\\"
,
hexValue
+
"b1"
+
hexValue
);
execTest
(
" "
+
unicodeStr
+
"\u00b1"
+
unicodeStr
+
" "
,
hexValue
+
"b1"
+
hexValue
);
execTest
(
"'"
+
unicodeStr
+
"\u00b1"
+
unicodeStr
+
"'"
,
hexValue
+
"b1"
+
hexValue
);
execTest
(
"\t"
+
unicodeStr
+
"\u00b1"
+
unicodeStr
+
"\t"
,
hexValue
+
"b1"
+
hexValue
);
execTest
(
"*"
+
unicodeStr
+
"\u00b1"
+
unicodeStr
+
"*"
,
hexValue
+
"b1"
+
hexValue
);
execTest
(
"?"
+
unicodeStr
+
"\u00b1"
+
unicodeStr
+
"?"
,
hexValue
+
"b1"
+
hexValue
);
}
static
void
execTest
(
String
unicodeStr
,
String
hexValue
)
{
TestResult
tr
=
doExec
(
javaCmd
,
"-Dtest.src="
+
TEST_SOURCES_DIR
.
getAbsolutePath
(),
"-Dtest.classes="
+
TEST_CLASSES_DIR
.
getAbsolutePath
(),
"-cp"
,
TEST_CLASSES_DIR
.
getAbsolutePath
(),
"I18NArgTest"
,
unicodeStr
,
hexValue
);
System
.
out
.
println
(
tr
.
testOutput
);
if
(!
tr
.
isOK
())
{
System
.
err
.
println
(
tr
);
throw
new
RuntimeException
(
"test fails"
);
}
}
static
void
testCharacters
(
String
...
args
)
{
String
input
=
args
[
0
];
String
expected
=
args
[
1
];
String
hexValue
=
""
;
for
(
int
i
=
0
;
i
<
input
.
length
();
i
++)
{
hexValue
=
hexValue
.
concat
(
Integer
.
toHexString
((
int
)
input
.
charAt
(
i
)));
}
System
.
out
.
println
(
"input:"
+
input
);
System
.
out
.
println
(
"expected:"
+
expected
);
System
.
out
.
println
(
"obtained:"
+
hexValue
);
if
(!
hexValue
.
contains
(
expected
))
{
String
message
=
"Error: output does not contain expected value"
+
"expected:"
+
expected
+
" obtained:"
+
hexValue
;
throw
new
RuntimeException
(
message
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录