Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
4367f712
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看板
提交
4367f712
编写于
9月 07, 2011
作者:
M
mchung
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7078024: Update JDK service tag for JDK 8
Reviewed-by: paulk
上级
83fe1bfa
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
137 addition
and
114 deletion
+137
-114
make/com/sun/servicetag/Makefile
make/com/sun/servicetag/Makefile
+1
-1
src/share/classes/com/sun/servicetag/Installer.java
src/share/classes/com/sun/servicetag/Installer.java
+32
-67
src/share/classes/com/sun/servicetag/resources/javase_servicetag.properties
...com/sun/servicetag/resources/javase_servicetag.properties
+29
-0
test/com/sun/servicetag/JavaServiceTagTest.java
test/com/sun/servicetag/JavaServiceTagTest.java
+37
-23
test/com/sun/servicetag/JavaServiceTagTest1.java
test/com/sun/servicetag/JavaServiceTagTest1.java
+38
-23
未找到文件。
make/com/sun/servicetag/Makefile
浏览文件 @
4367f712
...
...
@@ -47,7 +47,7 @@ FILES_copy = $(SERVICETAG_RESOURCES_DIR)/product_registration.xsd \
# Add all properties files to the FILES_copy list
SWORDFISH_properties
:=
$(
shell
\
$(CD)
$(SHARE_SRC)
/classes/com/sun/servicetag/resources
;
\
$(FIND)
.
-name
'javase_*
_swordfish
.properties'
-print
;
\
$(FIND)
.
-name
'javase_*.properties'
-print
;
\
)
FILES_copy
+=
$(
shell
\
for
f
in
$(SWORDFISH_properties)
;
do
\
...
...
src/share/classes/com/sun/servicetag/Installer.java
浏览文件 @
4367f712
...
...
@@ -61,8 +61,8 @@ public class Installer {
private
static
RegistrationData
registration
;
private
static
boolean
supportRegistration
;
private
static
String
registerHtmlParent
;
private
static
Set
<
Locale
>
supportedLocales
=
new
HashSet
<
Locale
>();
private
static
Properties
s
wordfish
Props
=
null
;
private
static
Set
<
Locale
>
supportedLocales
=
new
HashSet
<>();
private
static
Properties
s
vcTag
Props
=
null
;
private
static
String
[]
jreArchs
=
null
;
static
{
String
dir
=
System
.
getProperty
(
SVCTAG_DIR_PATH
);
...
...
@@ -94,7 +94,7 @@ public class Installer {
boolean
cleanup
=
false
;
try
{
// Check if we have the swordfish entries for this JRE version
if
(
loadS
wordfishEntrie
s
()
==
null
)
{
if
(
loadS
erviceTagProp
s
()
==
null
)
{
return
null
;
}
...
...
@@ -144,18 +144,14 @@ public class Installer {
return
registration
;
}
if
(
regXmlFile
.
exists
())
{
BufferedInputStream
in
=
null
;
try
{
in
=
new
BufferedInputStream
(
new
FileInputStream
(
regXmlFile
));
try
(
BufferedInputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
regXmlFile
)))
{
registration
=
RegistrationData
.
loadFromXML
(
in
);
}
catch
(
IllegalArgumentException
ex
)
{
System
.
err
.
println
(
"Error: Bad registration data \""
+
regXmlFile
+
"\":"
+
ex
.
getMessage
());
throw
ex
;
}
finally
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
}
else
{
registration
=
new
RegistrationData
();
...
...
@@ -186,18 +182,14 @@ public class Installer {
deleteRegistrationHtmlPage
();
getRegistrationHtmlPage
();
BufferedOutputStream
out
=
null
;
try
{
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
regXmlFile
));
try
(
BufferedOutputStream
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
regXmlFile
)))
{
getRegistrationData
().
storeToXML
(
out
);
}
catch
(
IllegalArgumentException
ex
)
{
System
.
err
.
println
(
"Error: Bad registration data \""
+
regXmlFile
+
"\":"
+
ex
.
getMessage
());
throw
ex
;
}
finally
{
if
(
out
!=
null
)
{
out
.
close
();
}
}
}
...
...
@@ -206,11 +198,9 @@ public class Installer {
* or empty set if file not exists.
*/
private
static
Set
<
String
>
getInstalledURNs
()
throws
IOException
{
Set
<
String
>
urnSet
=
new
HashSet
<
String
>();
Set
<
String
>
urnSet
=
new
HashSet
<>();
if
(
serviceTagFile
.
exists
())
{
BufferedReader
in
=
null
;
try
{
in
=
new
BufferedReader
(
new
FileReader
(
serviceTagFile
));
try
(
BufferedReader
in
=
new
BufferedReader
(
new
FileReader
(
serviceTagFile
)))
{
String
urn
;
while
((
urn
=
in
.
readLine
())
!=
null
)
{
urn
=
urn
.
trim
();
...
...
@@ -218,10 +208,6 @@ public class Installer {
urnSet
.
add
(
urn
);
}
}
}
finally
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
}
return
urnSet
;
...
...
@@ -237,9 +223,9 @@ public class Installer {
private
static
ServiceTag
[]
getJavaServiceTagArray
()
throws
IOException
{
RegistrationData
regData
=
getRegistrationData
();
Set
<
ServiceTag
>
svcTags
=
regData
.
getServiceTags
();
Set
<
ServiceTag
>
result
=
new
HashSet
<
ServiceTag
>();
Set
<
ServiceTag
>
result
=
new
HashSet
<>();
Properties
props
=
loadS
wordfishEntrie
s
();
Properties
props
=
loadS
erviceTagProp
s
();
String
jdkUrn
=
props
.
getProperty
(
"servicetag.jdk.urn"
);
String
jreUrn
=
props
.
getProperty
(
"servicetag.jre.urn"
);
for
(
ServiceTag
st
:
svcTags
)
{
...
...
@@ -343,8 +329,7 @@ public class Installer {
}
private
static
ServiceTag
newServiceTag
(
String
svcTagSource
)
throws
IOException
{
// Load the swoRDFish information for the service tag creation
Properties
props
=
loadSwordfishEntries
();
Properties
props
=
loadServiceTagProps
();
// Determine the product URN and name
String
productURN
;
...
...
@@ -442,52 +427,35 @@ public class Installer {
return
;
}
PrintWriter
out
=
null
;
try
{
out
=
new
PrintWriter
(
serviceTagFile
);
try
(
PrintWriter
out
=
new
PrintWriter
(
serviceTagFile
))
{
ServiceTag
[]
javaSvcTags
=
getJavaServiceTagArray
();
for
(
ServiceTag
st
:
javaSvcTags
)
{
// Write the instance_run to the servicetag file
String
instanceURN
=
st
.
getInstanceURN
();
out
.
println
(
instanceURN
);
}
}
finally
{
if
(
out
!=
null
)
{
out
.
close
();
}
}
}
/**
* Load the values associated with the swoRDFish metadata entries
* for Java SE. The swoRDFish metadata entries are different for
* different release.
* Load the properties for generating Java SE service tags.
*
* @param version Version of Java SE
*/
private
static
synchronized
Properties
loadS
wordfishEntrie
s
()
throws
IOException
{
if
(
s
wordfish
Props
!=
null
)
{
return
s
wordfish
Props
;
private
static
synchronized
Properties
loadS
erviceTagProp
s
()
throws
IOException
{
if
(
s
vcTag
Props
!=
null
)
{
return
s
vcTag
Props
;
}
// The version string for Java SE 6 is 1.6.0
// We just need the minor number in the version string
int
version
=
Util
.
getJdkVersion
();
String
filename
=
"/com/sun/servicetag/resources/javase_"
+
version
+
"_swordfish.properties"
;
InputStream
in
=
Installer
.
class
.
getResourceAsStream
(
filename
);
if
(
in
==
null
)
{
return
null
;
}
swordfishProps
=
new
Properties
();
try
{
swordfishProps
.
load
(
in
);
}
finally
{
in
.
close
();
// For Java SE 8 and later releases, JDK and JRE both use
// the same product number. The sworRDFish metadata were
// for legacy Sun part number.
String
filename
=
"/com/sun/servicetag/resources/javase_servicetag.properties"
;
try
(
InputStream
in
=
Installer
.
class
.
getResourceAsStream
(
filename
))
{
svcTagProps
=
new
Properties
();
svcTagProps
.
load
(
in
);
}
return
s
wordfish
Props
;
return
s
vcTag
Props
;
}
/**
...
...
@@ -546,7 +514,7 @@ public class Installer {
return
jreArchs
;
}
Set
<
String
>
archs
=
new
HashSet
<
String
>();
Set
<
String
>
archs
=
new
HashSet
<>();
String
os
=
System
.
getProperty
(
"os.name"
);
if
(
os
.
equals
(
"SunOS"
)
||
os
.
equals
(
"Linux"
))
{
...
...
@@ -681,16 +649,16 @@ public class Installer {
String
country
=
locale
.
getCountry
();
String
variant
=
locale
.
getVariant
();
List
<
Locale
>
locales
=
new
ArrayList
<
Locale
>(
3
);
List
<
Locale
>
locales
=
new
ArrayList
<>(
3
);
if
(
variant
.
length
()
>
0
)
{
locales
.
add
(
locale
);
}
if
(
country
.
length
()
>
0
)
{
locales
.
add
((
locales
.
size
()
==
0
)
?
locales
.
add
((
locales
.
isEmpty
()
)
?
locale
:
new
Locale
(
language
,
country
,
""
));
}
if
(
language
.
length
()
>
0
)
{
locales
.
add
((
locales
.
size
()
==
0
)
?
locales
.
add
((
locales
.
isEmpty
()
)
?
locale
:
new
Locale
(
language
,
""
,
""
));
}
return
locales
;
...
...
@@ -788,14 +756,11 @@ public class Installer {
// Format the registration data in one single line
StringBuilder
payload
=
new
StringBuilder
();
String
xml
=
regData
.
toString
().
replaceAll
(
"\""
,
"%22"
);
BufferedReader
reader
=
new
BufferedReader
(
new
StringReader
(
xml
));
try
{
try
(
BufferedReader
reader
=
new
BufferedReader
(
new
StringReader
(
xml
)))
{
String
line
=
null
;
while
((
line
=
reader
.
readLine
())
!=
null
)
{
payload
.
append
(
line
.
trim
());
}
}
finally
{
reader
.
close
();
}
String
resourceFilename
=
"/com/sun/servicetag/resources/register"
;
...
...
src/share/classes/com/sun/servicetag/resources/javase_servicetag.properties
0 → 100644
浏览文件 @
4367f712
# Copyright (c) 2011, 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. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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.
servicetag.jdk.urn
=
Q8549
servicetag.jdk.name
=
Java Development Kit
servicetag.jre.urn
=
Q8549
servicetag.jre.name
=
Java Runtime Environment
servicetag.parent.urn
=
Q8549
servicetag.parent.name
=
Java Platform, Standard Edition
test/com/sun/servicetag/JavaServiceTagTest.java
浏览文件 @
4367f712
...
...
@@ -25,7 +25,7 @@
/*
* @test
* @bug 6622366
* @bug 6622366
7078024
* @summary Basic Test for ServiceTag.getJavaServiceTag()
* Disable creating the service tag in the system registry.
* Verify the existence of registration.xml file and the
...
...
@@ -86,23 +86,42 @@ public class JavaServiceTagTest {
}
}
/**
* Tests if the running platform is a JDK.
*/
static
boolean
isJDK
()
{
// Determine the JRE path by checking the existence of
// <HOME>/jre/lib and <HOME>/lib.
String
javaHome
=
System
.
getProperty
(
"java.home"
);
String
jrepath
=
javaHome
+
File
.
separator
+
"jre"
;
File
f
=
new
File
(
jrepath
,
"lib"
);
if
(!
f
.
exists
())
{
// java.home usually points to the JRE path
jrepath
=
javaHome
;
}
return
jrepath
.
endsWith
(
File
.
separator
+
"jre"
);
}
private
static
void
checkServiceTag
(
ServiceTag
st
)
throws
IOException
{
Properties
props
=
loadSwordfishEntries
();
if
(
st
.
getProductURN
().
equals
(
props
.
getProperty
(
"servicetag.jdk.urn"
)))
{
if
(!
st
.
getProductName
().
equals
(
props
.
getProperty
(
"servicetag.jdk.name"
)))
{
Properties
props
=
loadServiceTagProps
();
// jdk 8 and later, JDK and JRE have the same product URN.
String
jdkUrn
=
props
.
getProperty
(
"servicetag.jdk.urn"
);
String
jreUrn
=
props
.
getProperty
(
"servicetag.jre.urn"
);
boolean
isJdk
=
isJDK
();
if
(
isJdk
)
{
if
(!
st
.
getProductURN
().
equals
(
jdkUrn
)
||
!
st
.
getProductName
().
equals
(
props
.
getProperty
(
"servicetag.jdk.name"
)))
{
throw
new
RuntimeException
(
"Product URN and name don't match."
);
}
}
else
if
(
st
.
getProductURN
().
equals
(
props
.
getProperty
(
"servicetag.jre.urn"
)))
{
if
(!
st
.
getProductName
().
equals
(
props
.
getProperty
(
"servicetag.jre.name"
)))
{
}
else
{
if
(!
st
.
getProductURN
().
equals
(
jreUrn
)
||
!
st
.
getProductName
().
equals
(
props
.
getProperty
(
"servicetag.jre.name"
)))
{
throw
new
RuntimeException
(
"Product URN and name don't match."
);
}
}
else
{
throw
new
RuntimeException
(
"Unexpected product_urn: "
+
st
.
getProductURN
());
}
if
(!
st
.
getProductVersion
().
equals
(
System
.
getProperty
(
"java.version"
)))
{
...
...
@@ -160,18 +179,13 @@ public class JavaServiceTagTest {
}
}
private
static
Properties
loadS
wordfishEntrie
s
()
private
static
Properties
loadS
erviceTagProp
s
()
throws
IOException
{
int
version
=
sun
.
misc
.
Version
.
jdkMinorVersion
();
String
filename
=
"/com/sun/servicetag/resources/javase_"
+
version
+
"_swordfish.properties"
;
InputStream
in
=
Installer
.
class
.
getClass
().
getResourceAsStream
(
filename
);
Properties
props
=
new
Properties
();
try
{
String
filename
=
"/com/sun/servicetag/resources/javase_servicetag.properties"
;
try
(
InputStream
in
=
Installer
.
class
.
getClass
().
getResourceAsStream
(
filename
))
{
Properties
props
=
new
Properties
();
props
.
load
(
in
);
}
finally
{
in
.
close
();
return
props
;
}
return
props
;
}
}
test/com/sun/servicetag/JavaServiceTagTest1.java
浏览文件 @
4367f712
...
...
@@ -25,7 +25,7 @@
/*
* @test
* @bug 6622366
* @bug 6622366
7078024
* @summary Basic Test for ServiceTag.getJavaServiceTag(String)
* to verify that the registration.xml and servicetag files
* are both created correctly.
...
...
@@ -157,25 +157,45 @@ public class JavaServiceTagTest1 {
return
svctag
;
}
/**
* Tests if the running platform is a JDK.
*/
static
boolean
isJDK
()
{
// Determine the JRE path by checking the existence of
// <HOME>/jre/lib and <HOME>/lib.
String
javaHome
=
System
.
getProperty
(
"java.home"
);
String
jrepath
=
javaHome
+
File
.
separator
+
"jre"
;
File
f
=
new
File
(
jrepath
,
"lib"
);
if
(!
f
.
exists
())
{
// java.home usually points to the JRE path
jrepath
=
javaHome
;
}
return
jrepath
.
endsWith
(
File
.
separator
+
"jre"
);
}
private
static
void
checkServiceTag
(
ServiceTag
st
,
String
source
)
throws
IOException
{
Properties
props
=
loadSwordfishEntries
();
if
(
st
.
getProductURN
().
equals
(
props
.
getProperty
(
"servicetag.jdk.urn"
)))
{
if
(!
st
.
getProductName
().
equals
(
props
.
getProperty
(
"servicetag.jdk.name"
)))
{
Properties
props
=
loadServiceTagProps
();
// jdk 8 and later, JDK and JRE have the same product URN.
String
jdkUrn
=
props
.
getProperty
(
"servicetag.jdk.urn"
);
String
jreUrn
=
props
.
getProperty
(
"servicetag.jre.urn"
);
boolean
isJdk
=
isJDK
();
if
(
isJdk
)
{
if
(!
st
.
getProductURN
().
equals
(
jdkUrn
)
||
!
st
.
getProductName
().
equals
(
props
.
getProperty
(
"servicetag.jdk.name"
)))
{
throw
new
RuntimeException
(
"Product URN and name don't match."
);
}
}
else
if
(
st
.
getProductURN
().
equals
(
props
.
getProperty
(
"servicetag.jre.urn"
)))
{
if
(!
st
.
getProductName
().
equals
(
props
.
getProperty
(
"servicetag.jre.name"
)))
{
}
else
{
if
(!
st
.
getProductURN
().
equals
(
jreUrn
)
||
!
st
.
getProductName
().
equals
(
props
.
getProperty
(
"servicetag.jre.name"
)))
{
throw
new
RuntimeException
(
"Product URN and name don't match."
);
}
}
else
{
throw
new
RuntimeException
(
"Unexpected product_urn: "
+
st
.
getProductURN
());
}
if
(!
st
.
getProductVersion
().
equals
(
System
.
getProperty
(
"java.version"
)))
{
throw
new
RuntimeException
(
"Unexpected product_version: "
+
...
...
@@ -233,18 +253,13 @@ public class JavaServiceTagTest1 {
}
}
private
static
Properties
loadS
wordfishEntrie
s
()
private
static
Properties
loadS
erviceTagProp
s
()
throws
IOException
{
int
version
=
sun
.
misc
.
Version
.
jdkMinorVersion
();
String
filename
=
"/com/sun/servicetag/resources/javase_"
+
version
+
"_swordfish.properties"
;
InputStream
in
=
Installer
.
class
.
getClass
().
getResourceAsStream
(
filename
);
Properties
props
=
new
Properties
();
try
{
String
filename
=
"/com/sun/servicetag/resources/javase_servicetag.properties"
;
try
(
InputStream
in
=
Installer
.
class
.
getClass
().
getResourceAsStream
(
filename
))
{
Properties
props
=
new
Properties
();
props
.
load
(
in
);
}
finally
{
in
.
close
();
return
props
;
}
return
props
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录