Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
acb6dfb7
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看板
提交
acb6dfb7
编写于
8月 02, 2012
作者:
M
mullan
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
a35305d7
e8a3c691
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
66 addition
and
21 deletion
+66
-21
src/share/classes/java/lang/String.java
src/share/classes/java/lang/String.java
+28
-16
src/solaris/native/java/lang/java_props_md.c
src/solaris/native/java/lang/java_props_md.c
+38
-5
未找到文件。
src/share/classes/java/lang/String.java
浏览文件 @
acb6dfb7
/*
* Copyright (c) 1994, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 201
2
, 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
...
...
@@ -987,7 +987,8 @@ public final class String
/**
* Compares this string to the specified {@code StringBuffer}. The result
* is {@code true} if and only if this {@code String} represents the same
* sequence of characters as the specified {@code StringBuffer}.
* sequence of characters as the specified {@code StringBuffer}. This method
* synchronizes on the {@code StringBuffer}.
*
* @param sb
* The {@code StringBuffer} to compare this {@code String} against
...
...
@@ -999,15 +1000,29 @@ public final class String
* @since 1.4
*/
public
boolean
contentEquals
(
StringBuffer
sb
)
{
synchronized
(
sb
)
{
return
contentEquals
((
CharSequence
)
sb
);
return
contentEquals
((
CharSequence
)
sb
);
}
private
boolean
nonSyncContentEquals
(
AbstractStringBuilder
sb
)
{
char
v1
[]
=
value
;
char
v2
[]
=
sb
.
getValue
();
int
i
=
0
;
int
n
=
value
.
length
;
while
(
n
--
!=
0
)
{
if
(
v1
[
i
]
!=
v2
[
i
])
{
return
false
;
}
i
++;
}
return
true
;
}
/**
* Compares this string to the specified {@code CharSequence}. The result
* is {@code true} if and only if this {@code String} represents the same
* sequence of char values as the specified sequence.
* Compares this string to the specified {@code CharSequence}. The
* result is {@code true} if and only if this {@code String} represents the
* same sequence of char values as the specified sequence. Note that if the
* {@code CharSequence} is a {@code StringBuffer} then the method
* synchronizes on it.
*
* @param cs
* The sequence to compare this {@code String} against
...
...
@@ -1023,16 +1038,13 @@ public final class String
return
false
;
// Argument is a StringBuffer, StringBuilder
if
(
cs
instanceof
AbstractStringBuilder
)
{
char
v1
[]
=
value
;
char
v2
[]
=
((
AbstractStringBuilder
)
cs
).
getValue
();
int
i
=
0
;
int
n
=
value
.
length
;
while
(
n
--
!=
0
)
{
if
(
v1
[
i
]
!=
v2
[
i
])
return
false
;
i
++;
if
(
cs
instanceof
StringBuffer
)
{
synchronized
(
cs
)
{
return
nonSyncContentEquals
((
AbstractStringBuilder
)
cs
);
}
}
else
{
return
nonSyncContentEquals
((
AbstractStringBuilder
)
cs
);
}
return
true
;
}
// Argument is a String
if
(
cs
.
equals
(
this
))
...
...
src/solaris/native/java/lang/java_props_md.c
浏览文件 @
acb6dfb7
...
...
@@ -135,12 +135,12 @@ setPathEnvironment(char *envstring)
#define P_tmpdir "/var/tmp"
#endif
static
int
ParseLocale
(
int
cat
,
char
**
std_language
,
char
**
std_script
,
static
int
ParseLocale
(
JNIEnv
*
env
,
int
cat
,
char
**
std_language
,
char
**
std_script
,
char
**
std_country
,
char
**
std_variant
,
char
**
std_encoding
)
{
char
temp
[
64
]
;
char
*
temp
=
NULL
;
char
*
language
=
NULL
,
*
country
=
NULL
,
*
variant
=
NULL
,
*
encoding
=
NULL
;
char
*
p
,
encoding_variant
[
64
]
;
char
*
p
,
*
encoding_variant
;
char
*
lc
;
/* Query the locale set for the category */
...
...
@@ -156,6 +156,12 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
return
0
;
}
temp
=
malloc
(
strlen
(
lc
)
+
1
);
if
(
temp
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
0
;
}
if
(
cat
==
LC_CTYPE
)
{
/*
* Workaround for Solaris bug 4201684: Xlib doesn't like @euro
...
...
@@ -178,6 +184,13 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
if
(
lc
==
NULL
||
!
strcmp
(
lc
,
"C"
)
||
!
strcmp
(
lc
,
"POSIX"
))
{
lc
=
"en_US"
;
}
temp
=
malloc
(
strlen
(
lc
)
+
1
);
if
(
temp
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
0
;
}
#endif
/*
...
...
@@ -203,6 +216,13 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
* to a default country if that's possible. It's also used to map
* the Solaris locale aliases to their proper Java locale IDs.
*/
encoding_variant
=
malloc
(
strlen
(
temp
)
+
1
);
if
(
encoding_variant
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
0
;
}
if
((
p
=
strchr
(
temp
,
'.'
))
!=
NULL
)
{
strcpy
(
encoding_variant
,
p
);
/* Copy the leading '.' */
*
p
=
'\0'
;
...
...
@@ -214,7 +234,17 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
}
if
(
mapLookup
(
locale_aliases
,
temp
,
&
p
))
{
temp
=
realloc
(
temp
,
strlen
(
p
)
+
1
);
if
(
temp
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
0
;
}
strcpy
(
temp
,
p
);
encoding_variant
=
realloc
(
encoding_variant
,
strlen
(
temp
)
+
1
);
if
(
encoding_variant
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
0
;
}
// check the "encoding_variant" again, if any.
if
((
p
=
strchr
(
temp
,
'.'
))
!=
NULL
)
{
strcpy
(
encoding_variant
,
p
);
/* Copy the leading '.' */
...
...
@@ -326,6 +356,9 @@ static int ParseLocale(int cat, char ** std_language, char ** std_script,
#endif
}
free
(
temp
);
free
(
encoding_variant
);
return
1
;
}
...
...
@@ -480,13 +513,13 @@ GetJavaProperties(JNIEnv *env)
* and store these in the user.language, user.country, user.variant and
* file.encoding system properties. */
setlocale
(
LC_ALL
,
""
);
if
(
ParseLocale
(
LC_CTYPE
,
if
(
ParseLocale
(
env
,
LC_CTYPE
,
&
(
sprops
.
format_language
),
&
(
sprops
.
format_script
),
&
(
sprops
.
format_country
),
&
(
sprops
.
format_variant
),
&
(
sprops
.
encoding
)))
{
ParseLocale
(
LC_MESSAGES
,
ParseLocale
(
env
,
LC_MESSAGES
,
&
(
sprops
.
language
),
&
(
sprops
.
script
),
&
(
sprops
.
country
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录