Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
81e87995
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
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,发现更多精彩内容 >>
提交
81e87995
编写于
5月 12, 2015
作者:
O
okutsu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8055088: Optimization for locale resources loading isn't working
Reviewed-by: naoto
上级
6656a101
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
47 addition
and
35 deletion
+47
-35
make/gensrc/GensrcLocaleDataMetaInfo.gmk
make/gensrc/GensrcLocaleDataMetaInfo.gmk
+9
-2
src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java
...hare/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java
+5
-1
src/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java
...es/sun/util/locale/provider/JRELocaleProviderAdapter.java
+5
-1
src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
...locale/provider/LocaleDataMetaInfo-XLocales.java.template
+7
-1
src/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java
...asses/sun/util/locale/provider/LocaleProviderAdapter.java
+2
-2
src/share/classes/sun/util/resources/LocaleData.java
src/share/classes/sun/util/resources/LocaleData.java
+19
-28
未找到文件。
make/gensrc/GensrcLocaleDataMetaInfo.gmk
浏览文件 @
81e87995
#
# Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 201
5
, 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
...
...
@@ -34,7 +34,8 @@ LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/share/classes \
-name "TimeZoneNames_*.java" -o -name "TimeZoneNames_*.properties" -o \
-name "LocaleNames_*.java" -o -name "LocaleNames_*.properties" -o \
-name "CurrencyNames_*.java" -o -name "CurrencyNames_*.properties" -o \
-name "CalendarData_*.java" -o -name "CalendarData_*.properties")
-name "CalendarData_*.java" -o -name "CalendarData_*.properties" -o \
-name "BreakIteratorInfo_*.java" -o -name "BreakIteratorRules_*.java")
# Then translate the locale files into for example: FormatData_sv
LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
...
...
@@ -79,6 +80,12 @@ $(eval $(call CaptureLocale,FormatData))
#sun.text.resources.CollationData
$(eval $(call CaptureLocale,CollationData))
#sun.text.resources.BreakIteratorInfo
$(eval $(call CaptureLocale,BreakIteratorInfo))
#sun.text.resources.BreakIteratorRules
$(eval $(call CaptureLocale,BreakIteratorRules))
#sun.util.resources.TimeZoneNames
$(eval $(call CaptureLocale,TimeZoneNames))
...
...
src/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java
浏览文件 @
81e87995
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012,
2015,
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
...
...
@@ -30,6 +30,7 @@ import java.security.AccessController;
import
java.security.PrivilegedAction
;
import
java.text.spi.BreakIteratorProvider
;
import
java.text.spi.CollatorProvider
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.Locale
;
import
java.util.ResourceBundle
;
...
...
@@ -103,6 +104,9 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
protected
Set
<
String
>
createLanguageTagSet
(
String
category
)
{
ResourceBundle
rb
=
ResourceBundle
.
getBundle
(
"sun.util.cldr.CLDRLocaleDataMetaInfo"
,
Locale
.
ROOT
);
String
supportedLocaleString
=
rb
.
getString
(
category
);
if
(
supportedLocaleString
==
null
)
{
return
Collections
.
emptySet
();
}
Set
<
String
>
tagset
=
new
HashSet
<>();
StringTokenizer
tokens
=
new
StringTokenizer
(
supportedLocaleString
);
while
(
tokens
.
hasMoreTokens
())
{
...
...
src/share/classes/sun/util/locale/provider/JRELocaleProviderAdapter.java
浏览文件 @
81e87995
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, 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
...
...
@@ -34,6 +34,7 @@ import java.text.spi.DateFormatProvider;
import
java.text.spi.DateFormatSymbolsProvider
;
import
java.text.spi.DecimalFormatSymbolsProvider
;
import
java.text.spi.NumberFormatProvider
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.Locale
;
import
java.util.Set
;
...
...
@@ -356,6 +357,9 @@ public class JRELocaleProviderAdapter extends LocaleProviderAdapter implements R
protected
Set
<
String
>
createLanguageTagSet
(
String
category
)
{
String
supportedLocaleString
=
LocaleDataMetaInfo
.
getSupportedLocaleString
(
category
);
if
(
supportedLocaleString
==
null
)
{
return
Collections
.
emptySet
();
}
Set
<
String
>
tagset
=
new
HashSet
<>();
StringTokenizer
tokens
=
new
StringTokenizer
(
supportedLocaleString
);
while
(
tokens
.
hasMoreTokens
())
{
...
...
src/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
浏览文件 @
81e87995
/*
*
Copyright
(
c
)
2005
,
201
3
,
Oracle
and
/
or
its
affiliates
.
All
rights
reserved
.
*
Copyright
(
c
)
2005
,
201
5
,
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
...
...
@@ -57,6 +57,12 @@ public class LocaleDataMetaInfo {
resourceNameToLocales.put("
CollationData
",
"
#
CollationData_ENLocales
#
|
#
CollationData_NonENLocales
#
");
resourceNameToLocales.put("
BreakIteratorInfo
",
"
#
BreakIteratorInfo_ENLocales
#
|
#
BreakIteratorInfo_NonENLocales
#
");
resourceNameToLocales.put("
BreakIteratorRules
",
"
#
BreakIteratorRules_ENLocales
#
|
#
BreakIteratorRules_NonENLocales
#
");
resourceNameToLocales.put("
TimeZoneNames
",
"
#
TimeZoneNames_ENLocales
#
|
#
TimeZoneNames_NonENLocales
#
");
...
...
src/share/classes/sun/util/locale/provider/LocaleProviderAdapter.java
浏览文件 @
81e87995
/*
* Copyright (c) 2012, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 201
5
, 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
...
...
@@ -295,7 +295,7 @@ public abstract class LocaleProviderAdapter {
* A utility method for implementing the default LocaleServiceProvider.isSupportedLocale
* for the JRE, CLDR, and FALLBACK adapters.
*/
static
boolean
isSupportedLocale
(
Locale
locale
,
LocaleProviderAdapter
.
Type
type
,
Set
<
String
>
langtags
)
{
public
static
boolean
isSupportedLocale
(
Locale
locale
,
LocaleProviderAdapter
.
Type
type
,
Set
<
String
>
langtags
)
{
assert
type
==
Type
.
JRE
||
type
==
Type
.
CLDR
||
type
==
Type
.
FALLBACK
;
if
(
Locale
.
ROOT
.
equals
(
locale
))
{
return
true
;
...
...
src/share/classes/sun/util/resources/LocaleData.java
浏览文件 @
81e87995
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
5
, 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
...
...
@@ -48,8 +48,11 @@ import java.util.List;
import
java.util.Locale
;
import
java.util.MissingResourceException
;
import
java.util.ResourceBundle
;
import
java.util.Set
;
import
sun.util.locale.provider.JRELocaleProviderAdapter
;
import
sun.util.locale.provider.LocaleDataMetaInfo
;
import
sun.util.locale.provider.LocaleProviderAdapter
;
import
static
sun
.
util
.
locale
.
provider
.
LocaleProviderAdapter
.
Type
.
CLDR
;
import
static
sun
.
util
.
locale
.
provider
.
LocaleProviderAdapter
.
Type
.
JRE
;
/**
...
...
@@ -204,35 +207,23 @@ public class LocaleData {
@Override
public
List
<
Locale
>
getCandidateLocales
(
String
baseName
,
Locale
locale
)
{
List
<
Locale
>
candidates
=
super
.
getCandidateLocales
(
baseName
,
locale
);
/* Get the locale string list from LocaleDataMetaInfo class. */
String
localeString
=
LocaleDataMetaInfo
.
getSupportedLocaleString
(
baseName
);
if
(
localeString
!=
null
&&
localeString
.
length
()
!=
0
)
{
for
(
Iterator
<
Locale
>
l
=
candidates
.
iterator
();
l
.
hasNext
();)
{
Locale
loc
=
l
.
next
();
String
lstr
;
if
(
loc
.
getScript
().
length
()
>
0
)
{
lstr
=
loc
.
toLanguageTag
().
replace
(
'-'
,
'_'
);
}
else
{
lstr
=
loc
.
toString
();
int
idx
=
lstr
.
indexOf
(
"_#"
);
if
(
idx
>=
0
)
{
lstr
=
lstr
.
substring
(
0
,
idx
);
}
}
/* Every locale string in the locale string list returned from
the above getSupportedLocaleString is enclosed
within two white spaces so that we could check some locale
such as "en".
*/
if
(
lstr
.
length
()
!=
0
&&
localeString
.
indexOf
(
" "
+
lstr
+
" "
)
==
-
1
)
{
l
.
remove
();
// Weed out Locales which are known to have no resource bundles
int
lastDot
=
baseName
.
lastIndexOf
(
'.'
);
String
category
=
(
lastDot
>=
0
)
?
baseName
.
substring
(
lastDot
+
1
)
:
baseName
;
LocaleProviderAdapter
.
Type
type
=
baseName
.
contains
(
DOTCLDR
)
?
CLDR
:
JRE
;
LocaleProviderAdapter
adapter
=
LocaleProviderAdapter
.
forType
(
type
);
Set
<
String
>
langtags
=
((
JRELocaleProviderAdapter
)
adapter
).
getLanguageTagSet
(
category
);
if
(!
langtags
.
isEmpty
())
{
for
(
Iterator
<
Locale
>
itr
=
candidates
.
iterator
();
itr
.
hasNext
();)
{
if
(!
LocaleProviderAdapter
.
isSupportedLocale
(
itr
.
next
(),
type
,
langtags
))
{
itr
.
remove
();
}
}
}
// Force fallback to Locale.ENGLISH for CLDR time zone names support
if
(
locale
.
getLanguage
()
!=
"en"
&&
baseName
.
contains
(
CLDR
)
&&
baseName
.
endsWith
(
"TimeZoneNames"
))
{
&&
type
==
CLDR
&&
category
.
equals
(
"TimeZoneNames"
))
{
candidates
.
add
(
candidates
.
size
()
-
1
,
Locale
.
ENGLISH
);
}
return
candidates
;
...
...
@@ -254,7 +245,7 @@ public class LocaleData {
return
null
;
}
private
static
final
String
CLDR
=
".cldr"
;
private
static
final
String
DOT
CLDR
=
".cldr"
;
/**
* Changes baseName to its per-language package name and
...
...
@@ -275,8 +266,8 @@ public class LocaleData {
assert
JRE
.
getUtilResourcesPackage
().
length
()
==
JRE
.
getTextResourcesPackage
().
length
();
int
index
=
JRE
.
getUtilResourcesPackage
().
length
();
if
(
baseName
.
indexOf
(
CLDR
,
index
)
>
0
)
{
index
+=
CLDR
.
length
();
if
(
baseName
.
indexOf
(
DOT
CLDR
,
index
)
>
0
)
{
index
+=
DOT
CLDR
.
length
();
}
newBaseName
=
baseName
.
substring
(
0
,
index
+
1
)
+
lang
+
baseName
.
substring
(
index
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录