Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
777a1ff2
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看板
提交
777a1ff2
编写于
8月 07, 2014
作者:
S
serb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8054372: Cleanup of com.sun.media.sound packages
Reviewed-by: azvegint, prr
上级
54e6ab14
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
136 deletion
+55
-136
src/share/classes/com/sun/media/sound/JDK13Services.java
src/share/classes/com/sun/media/sound/JDK13Services.java
+7
-5
src/share/classes/com/sun/media/sound/JSSecurityManager.java
src/share/classes/com/sun/media/sound/JSSecurityManager.java
+1
-28
src/share/classes/com/sun/media/sound/Platform.java
src/share/classes/com/sun/media/sound/Platform.java
+11
-55
src/share/classes/com/sun/media/sound/SoftSynthesizer.java
src/share/classes/com/sun/media/sound/SoftSynthesizer.java
+36
-48
未找到文件。
src/share/classes/com/sun/media/sound/JDK13Services.java
浏览文件 @
777a1ff2
/*
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
4
, 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
...
...
@@ -25,6 +25,8 @@
package
com.sun.media.sound
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -176,11 +178,11 @@ public final class JDK13Services {
&&
!
Sequencer
.
class
.
equals
(
typeClass
))
{
return
null
;
}
String
value
;
String
propertyName
=
typeClass
.
getName
();
value
=
JSSecurityManager
.
getProperty
(
propertyName
);
String
name
=
typeClass
.
getName
()
;
String
value
=
AccessController
.
doPrivileged
(
(
PrivilegedAction
<
String
>)
()
->
System
.
getProperty
(
name
)
);
if
(
value
==
null
)
{
value
=
getProperties
().
getProperty
(
propertyN
ame
);
value
=
getProperties
().
getProperty
(
n
ame
);
}
if
(
""
.
equals
(
value
))
{
value
=
null
;
...
...
src/share/classes/com/sun/media/sound/JSSecurityManager.java
浏览文件 @
777a1ff2
/*
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
4
, 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
...
...
@@ -73,33 +73,6 @@ final class JSSecurityManager {
}
}
static
String
getProperty
(
final
String
propertyName
)
{
String
propertyValue
;
if
(
hasSecurityManager
())
{
if
(
Printer
.
debug
)
Printer
.
debug
(
"using JDK 1.2 security to get property"
);
try
{
PrivilegedAction
<
String
>
action
=
new
PrivilegedAction
<
String
>()
{
public
String
run
()
{
try
{
return
System
.
getProperty
(
propertyName
);
}
catch
(
Throwable
t
)
{
return
null
;
}
}
};
propertyValue
=
AccessController
.
doPrivileged
(
action
);
}
catch
(
Exception
e
)
{
if
(
Printer
.
debug
)
Printer
.
debug
(
"not using JDK 1.2 security to get properties"
);
propertyValue
=
System
.
getProperty
(
propertyName
);
}
}
else
{
if
(
Printer
.
debug
)
Printer
.
debug
(
"not using JDK 1.2 security to get properties"
);
propertyValue
=
System
.
getProperty
(
propertyName
);
}
return
propertyValue
;
}
/** Load properties from a file.
This method tries to load properties from the filename give into
the passed properties object.
...
...
src/share/classes/com/sun/media/sound/Platform.java
浏览文件 @
777a1ff2
/*
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
4
, 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
...
...
@@ -74,17 +74,6 @@ final class Platform {
// intel is little-endian. sparc is big-endian.
private
static
boolean
bigEndian
;
// this is the value of the "java.home" system property. i am looking it up here
// for use when trying to load the soundbank, just so
// that all the privileged code is localized in this file....
private
static
String
javahome
;
// this is the value of the "java.class.path" system property
private
static
String
classpath
;
static
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">> Platform.java: static"
);
...
...
@@ -129,26 +118,6 @@ final class Platform {
return
signed8
;
}
/**
* Obtain javahome.
* $$kk: 04.16.99: this is *bad*!!
*/
static
String
getJavahome
()
{
return
javahome
;
}
/**
* Obtain classpath.
* $$jb: 04.21.99: this is *bad* too!!
*/
static
String
getClasspath
()
{
return
classpath
;
}
// PRIVATE METHODS
/**
...
...
@@ -157,21 +126,13 @@ final class Platform {
private
static
void
loadLibraries
()
{
if
(
Printer
.
trace
)
Printer
.
trace
(
">>Platform.loadLibraries"
);
try
{
// load the main library
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
@Override
public
Void
run
()
{
System
.
loadLibrary
(
libNameMain
);
return
null
;
}
});
// just for the heck of it...
loadedLibs
|=
LIB_MAIN
;
}
catch
(
SecurityException
e
)
{
if
(
Printer
.
err
)
Printer
.
err
(
"Security exception loading main native library. JavaSound requires access to these resources."
);
throw
(
e
);
}
// load the main library
AccessController
.
doPrivileged
((
PrivilegedAction
<
Void
>)
()
->
{
System
.
loadLibrary
(
libNameMain
);
return
null
;
});
// just for the heck of it...
loadedLibs
|=
LIB_MAIN
;
// now try to load extra libs. They are defined at compile time in the Makefile
// with the define EXTRA_SOUND_JNI_LIBS
...
...
@@ -181,12 +142,9 @@ final class Platform {
while
(
st
.
hasMoreTokens
())
{
final
String
lib
=
st
.
nextToken
();
try
{
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Void
>()
{
@Override
public
Void
run
()
{
System
.
loadLibrary
(
lib
);
return
null
;
}
AccessController
.
doPrivileged
((
PrivilegedAction
<
Void
>)
()
->
{
System
.
loadLibrary
(
lib
);
return
null
;
});
if
(
lib
.
equals
(
libNameALSA
))
{
...
...
@@ -239,7 +197,5 @@ final class Platform {
// $$fb 2002-03-06: implement check for endianness in native. Facilitates porting !
bigEndian
=
nIsBigEndian
();
signed8
=
nIsSigned8
();
// Solaris on Sparc: signed, all others unsigned
javahome
=
JSSecurityManager
.
getProperty
(
"java.home"
);
classpath
=
JSSecurityManager
.
getProperty
(
"java.class.path"
);
}
}
src/share/classes/com/sun/media/sound/SoftSynthesizer.java
浏览文件 @
777a1ff2
/*
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 201
4
, 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
...
...
@@ -28,6 +28,7 @@ package com.sun.media.sound;
import
java.io.BufferedInputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
...
...
@@ -732,31 +733,28 @@ public final class SoftSynthesizer implements AudioSynthesizer,
* Save generated soundbank to disk for faster future use.
*/
OutputStream
out
=
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
OutputStream
>()
{
public
OutputStream
run
()
{
try
{
File
userhome
=
new
File
(
System
.
getProperty
(
"user.home"
),
".gervill"
);
if
(!
userhome
.
exists
())
userhome
.
mkdirs
();
File
emg_soundbank_file
=
new
File
(
userhome
,
"soundbank-emg.sf2"
);
if
(
emg_soundbank_file
.
exists
())
return
null
;
return
new
FileOutputStream
(
emg_soundbank_file
);
}
catch
(
IOException
e
)
{
}
catch
(
SecurityException
e
)
{
.
doPrivileged
((
PrivilegedAction
<
OutputStream
>)
()
->
{
try
{
File
userhome
=
new
File
(
System
.
getProperty
(
"user.home"
),
".gervill"
);
if
(!
userhome
.
exists
())
{
userhome
.
mkdirs
();
}
return
null
;
File
emg_soundbank_file
=
new
File
(
userhome
,
"soundbank-emg.sf2"
);
if
(
emg_soundbank_file
.
exists
())
{
return
null
;
}
return
new
FileOutputStream
(
emg_soundbank_file
);
}
catch
(
final
FileNotFoundException
ignored
)
{
}
return
null
;
});
if
(
out
!=
null
)
{
try
{
((
SF2Soundbank
)
defaultSoundBank
).
save
(
out
);
out
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
final
IOException
ignored
)
{
}
}
}
...
...
@@ -846,26 +844,24 @@ public final class SoftSynthesizer implements AudioSynthesizer,
private
Properties
getStoredProperties
()
{
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
Properties
>()
{
public
Properties
run
()
{
Properties
p
=
new
Properties
();
String
notePath
=
"/com/sun/media/sound/softsynthesizer"
;
try
{
Preferences
prefroot
=
Preferences
.
userRoot
();
if
(
prefroot
.
nodeExists
(
notePath
))
{
Preferences
prefs
=
prefroot
.
node
(
notePath
);
String
[]
prefs_keys
=
prefs
.
keys
();
for
(
String
prefs_key
:
prefs_keys
)
{
String
val
=
prefs
.
get
(
prefs_key
,
null
);
if
(
val
!=
null
)
p
.
setProperty
(
prefs_key
,
val
);
.
doPrivileged
((
PrivilegedAction
<
Properties
>)
()
->
{
Properties
p
=
new
Properties
();
String
notePath
=
"/com/sun/media/sound/softsynthesizer"
;
try
{
Preferences
prefroot
=
Preferences
.
userRoot
();
if
(
prefroot
.
nodeExists
(
notePath
))
{
Preferences
prefs
=
prefroot
.
node
(
notePath
);
String
[]
prefs_keys
=
prefs
.
keys
();
for
(
String
prefs_key
:
prefs_keys
)
{
String
val
=
prefs
.
get
(
prefs_key
,
null
);
if
(
val
!=
null
)
{
p
.
setProperty
(
prefs_key
,
val
);
}
}
}
catch
(
BackingStoreException
e
)
{
}
catch
(
SecurityException
e
)
{
}
return
p
;
}
catch
(
final
BackingStoreException
ignored
)
{
}
return
p
;
});
}
...
...
@@ -1044,7 +1040,6 @@ public final class SoftSynthesizer implements AudioSynthesizer,
return
;
}
synchronized
(
control_mutex
)
{
Throwable
causeException
=
null
;
try
{
if
(
line
!=
null
)
{
// can throw IllegalArgumentException
...
...
@@ -1117,24 +1112,17 @@ public final class SoftSynthesizer implements AudioSynthesizer,
weakstream
.
sourceDataLine
=
sourceDataLine
;
}
}
catch
(
LineUnavailableException
e
)
{
causeException
=
e
;
}
catch
(
IllegalArgumentException
e
)
{
causeException
=
e
;
}
catch
(
SecurityException
e
)
{
causeException
=
e
;
}
if
(
causeException
!=
null
)
{
if
(
isOpen
())
}
catch
(
final
LineUnavailableException
|
SecurityException
|
IllegalArgumentException
e
)
{
if
(
isOpen
())
{
close
();
}
// am: need MidiUnavailableException(Throwable) ctor!
MidiUnavailableException
ex
=
new
MidiUnavailableException
(
"Can not open line"
);
ex
.
initCause
(
causeException
);
ex
.
initCause
(
e
);
throw
ex
;
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录