Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell11
提交
415a17d0
D
dragonwell11
项目概览
openanolis
/
dragonwell11
通知
7
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell11
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
415a17d0
编写于
4月 11, 2012
作者:
R
robm
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7143606: File.createTempFile should be improved for temporary files created by the platform.
Reviewed-by: sherman
上级
1be4b5a2
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
50 addition
and
37 deletion
+50
-37
jdk/src/macosx/classes/apple/applescript/AppleScriptEngine.java
...c/macosx/classes/apple/applescript/AppleScriptEngine.java
+3
-2
jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java
jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java
+3
-4
jdk/src/share/classes/java/awt/Font.java
jdk/src/share/classes/java/awt/Font.java
+4
-3
jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
...asses/javax/imageio/stream/FileCacheImageInputStream.java
+7
-3
jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java
...sses/javax/imageio/stream/FileCacheImageOutputStream.java
+7
-3
jdk/src/share/classes/javax/management/loading/MLet.java
jdk/src/share/classes/javax/management/loading/MLet.java
+5
-3
jdk/src/share/classes/sun/print/PSPrinterJob.java
jdk/src/share/classes/sun/print/PSPrinterJob.java
+3
-2
jdk/src/share/classes/sun/rmi/server/Activation.java
jdk/src/share/classes/sun/rmi/server/Activation.java
+3
-2
jdk/src/share/classes/sun/tools/jar/Main.java
jdk/src/share/classes/sun/tools/jar/Main.java
+2
-2
jdk/src/share/classes/sun/tools/native2ascii/Main.java
jdk/src/share/classes/sun/tools/native2ascii/Main.java
+4
-7
jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
+3
-2
jdk/src/solaris/classes/sun/print/UnixPrintJob.java
jdk/src/solaris/classes/sun/print/UnixPrintJob.java
+3
-2
jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
...src/solaris/classes/sun/print/UnixPrintServiceLookup.java
+3
-2
未找到文件。
jdk/src/macosx/classes/apple/applescript/AppleScriptEngine.java
浏览文件 @
415a17d0
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011,
2012,
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
...
...
@@ -26,6 +26,7 @@
package
apple.applescript
;
import
java.io.*
;
import
java.nio.file.Files
;
import
java.util.*
;
import
java.util.Map.Entry
;
...
...
@@ -297,7 +298,7 @@ public class AppleScriptEngine implements ScriptEngine {
File
tmpfile
;
FileWriter
tmpwrite
;
try
{
tmpfile
=
File
.
createTempFile
(
"AppleScriptEngine."
,
".scpt"
);
tmpfile
=
File
s
.
createTempFile
(
"AppleScriptEngine."
,
".scpt"
).
toFile
(
);
tmpwrite
=
new
FileWriter
(
tmpfile
);
// read in our input and write directly to tmpfile
...
...
jdk/src/share/classes/com/sun/java/util/jar/pack/Driver.java
浏览文件 @
415a17d0
/*
* Copyright (c) 2003, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
...
...
@@ -35,6 +35,7 @@ import java.io.InputStream;
import
java.io.OutputStream
;
import
java.io.PrintStream
;
import
java.text.MessageFormat
;
import
java.nio.file.Files
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
...
...
@@ -385,9 +386,7 @@ class Driver {
if
(
base
.
getParentFile
()
==
null
&&
suffix
.
equals
(
".bak"
))
where
=
new
File
(
"."
).
getAbsoluteFile
();
File
f
=
File
.
createTempFile
(
prefix
,
suffix
,
where
);
return
f
;
return
Files
.
createTempFile
(
where
.
toPath
(),
prefix
,
suffix
).
toFile
();
}
static
private
...
...
jdk/src/share/classes/java/awt/Font.java
浏览文件 @
415a17d0
/*
* Copyright (c) 1995, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 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
...
...
@@ -36,6 +36,7 @@ import java.awt.geom.Rectangle2D;
import
java.awt.peer.FontPeer
;
import
java.io.*
;
import
java.lang.ref.SoftReference
;
import
java.nio.file.Files
;
import
java.security.AccessController
;
import
java.security.PrivilegedExceptionAction
;
import
java.text.AttributedCharacterIterator.Attribute
;
...
...
@@ -831,7 +832,7 @@ public class Font implements java.io.Serializable
File
f
=
null
;
boolean
hasPerm
=
false
;
try
{
f
=
File
.
createTempFile
(
"+~JT"
,
".tmp"
,
null
);
f
=
File
s
.
createTempFile
(
"+~JT"
,
".tmp"
).
toFile
(
);
f
.
delete
();
f
=
null
;
hasPerm
=
true
;
...
...
@@ -881,7 +882,7 @@ public class Font implements java.io.Serializable
final
File
tFile
=
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
File
>()
{
public
File
run
()
throws
IOException
{
return
File
.
createTempFile
(
"+~JF"
,
".tmp"
,
null
);
return
File
s
.
createTempFile
(
"+~JF"
,
".tmp"
).
toFile
(
);
}
}
);
...
...
jdk/src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
浏览文件 @
415a17d0
/*
* Copyright (c) 2000, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
12
, 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
...
...
@@ -29,6 +29,7 @@ import java.io.File;
import
java.io.InputStream
;
import
java.io.IOException
;
import
java.io.RandomAccessFile
;
import
java.nio.file.Files
;
import
com.sun.imageio.stream.StreamCloser
;
import
com.sun.imageio.stream.StreamFinalizer
;
import
sun.java2d.Disposer
;
...
...
@@ -97,8 +98,11 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl {
throw
new
IllegalArgumentException
(
"Not a directory!"
);
}
this
.
stream
=
stream
;
this
.
cacheFile
=
File
.
createTempFile
(
"imageio"
,
".tmp"
,
cacheDir
);
if
(
cacheDir
==
null
)
this
.
cacheFile
=
Files
.
createTempFile
(
"imageio"
,
".tmp"
).
toFile
();
else
this
.
cacheFile
=
Files
.
createTempFile
(
cacheDir
.
toPath
(),
"imageio"
,
".tmp"
)
.
toFile
();
this
.
cache
=
new
RandomAccessFile
(
cacheFile
,
"rw"
);
this
.
closeAction
=
StreamCloser
.
createCloseAction
(
this
);
...
...
jdk/src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java
浏览文件 @
415a17d0
/*
* Copyright (c) 2000, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
12
, 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
...
...
@@ -29,6 +29,7 @@ import java.io.File;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.io.RandomAccessFile
;
import
java.nio.file.Files
;
import
com.sun.imageio.stream.StreamCloser
;
/**
...
...
@@ -83,8 +84,11 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl {
throw
new
IllegalArgumentException
(
"Not a directory!"
);
}
this
.
stream
=
stream
;
this
.
cacheFile
=
File
.
createTempFile
(
"imageio"
,
".tmp"
,
cacheDir
);
if
(
cacheDir
==
null
)
this
.
cacheFile
=
Files
.
createTempFile
(
"imageio"
,
".tmp"
).
toFile
();
else
this
.
cacheFile
=
Files
.
createTempFile
(
cacheDir
.
toPath
(),
"imageio"
,
".tmp"
)
.
toFile
();
this
.
cache
=
new
RandomAccessFile
(
cacheFile
,
"rw"
);
this
.
closeAction
=
StreamCloser
.
createCloseAction
(
this
);
...
...
jdk/src/share/classes/javax/management/loading/MLet.java
浏览文件 @
415a17d0
/*
* Copyright (c) 1999, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 20
12
, 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
...
...
@@ -44,6 +44,7 @@ import java.lang.reflect.Constructor;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URLStreamHandlerFactory
;
import
java.nio.file.Files
;
import
java.security.AccessController
;
import
java.security.PrivilegedAction
;
import
java.util.ArrayList
;
...
...
@@ -1160,8 +1161,9 @@ public class MLet extends java.net.URLClassLoader
try
{
File
directory
=
new
File
(
libraryDirectory
);
directory
.
mkdirs
();
File
file
=
File
.
createTempFile
(
libname
+
"."
,
null
,
directory
);
File
file
=
Files
.
createTempFile
(
directory
.
toPath
(),
libname
+
"."
,
null
)
.
toFile
();
file
.
deleteOnExit
();
FileOutputStream
fileOutput
=
new
FileOutputStream
(
file
);
try
{
...
...
jdk/src/share/classes/sun/print/PSPrinterJob.java
浏览文件 @
415a17d0
/*
* Copyright (c) 1998, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 20
12
, 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
...
...
@@ -97,6 +97,7 @@ import sun.font.FontUtilities;
import
java.nio.charset.*
;
import
java.nio.CharBuffer
;
import
java.nio.ByteBuffer
;
import
java.nio.file.Files
;
//REMIND: Remove use of this class when IPPPrintService is moved to share directory.
import
java.lang.reflect.Method
;
...
...
@@ -659,7 +660,7 @@ public class PSPrinterJob extends RasterPrinterJob {
* is not removed for some reason, request that it is
* removed when the VM exits.
*/
spoolFile
=
File
.
createTempFile
(
"javaprint"
,
".ps"
,
null
);
spoolFile
=
File
s
.
createTempFile
(
"javaprint"
,
".ps"
).
toFile
(
);
spoolFile
.
deleteOnExit
();
result
=
new
FileOutputStream
(
spoolFile
);
...
...
jdk/src/share/classes/sun/rmi/server/Activation.java
浏览文件 @
415a17d0
/*
* Copyright (c) 1997, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
12
, 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
...
...
@@ -43,6 +43,7 @@ import java.net.ServerSocket;
import
java.net.Socket
;
import
java.net.SocketAddress
;
import
java.net.SocketException
;
import
java.nio.file.Files
;
import
java.nio.channels.Channel
;
import
java.nio.channels.ServerSocketChannel
;
import
java.rmi.AccessException
;
...
...
@@ -1940,7 +1941,7 @@ public class Activation implements Serializable {
new
PrivilegedExceptionAction
<
Void
>()
{
public
Void
run
()
throws
IOException
{
File
file
=
File
.
createTempFile
(
"rmid-err"
,
null
,
null
);
File
s
.
createTempFile
(
"rmid-err"
,
null
).
toFile
(
);
PrintStream
errStream
=
new
PrintStream
(
new
FileOutputStream
(
file
));
System
.
setErr
(
errStream
);
...
...
jdk/src/share/classes/sun/tools/jar/Main.java
浏览文件 @
415a17d0
/*
* Copyright (c) 1996, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -137,7 +137,7 @@ class Main {
File
dir
=
file
.
getParentFile
();
if
(
dir
==
null
)
dir
=
new
File
(
"."
);
return
File
.
createTempFile
(
"jartmp"
,
null
,
dir
);
return
File
s
.
createTempFile
(
dir
.
toPath
(),
"jartmp"
,
null
).
toFile
(
);
}
private
boolean
ok
;
...
...
jdk/src/share/classes/sun/tools/native2ascii/Main.java
浏览文件 @
415a17d0
/*
* Copyright (c) 1996, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
...
...
@@ -71,6 +71,7 @@ import java.text.MessageFormat;
import
java.nio.charset.CharsetEncoder
;
import
java.nio.charset.Charset
;
import
java.nio.charset.IllegalCharsetNameException
;
import
java.nio.file.Files
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.charset.UnsupportedCharsetException
;
import
sun.tools.native2ascii.A2NFilter
;
...
...
@@ -240,9 +241,7 @@ public class Main {
if
(
tempDir
==
null
)
tempDir
=
new
File
(
System
.
getProperty
(
"user.dir"
));
tempFile
=
File
.
createTempFile
(
"_N2A"
,
".TMP"
,
tempDir
);
tempFile
=
Files
.
createTempFile
(
tempDir
.
toPath
(),
"_N2A"
,
".TMP"
).
toFile
();
tempFile
.
deleteOnExit
();
try
{
...
...
@@ -292,9 +291,7 @@ public class Main {
File
tempDir
=
f
.
getParentFile
();
if
(
tempDir
==
null
)
tempDir
=
new
File
(
System
.
getProperty
(
"user.dir"
));
tempFile
=
File
.
createTempFile
(
"_N2A"
,
".TMP"
,
tempDir
);
tempFile
=
Files
.
createTempFile
(
tempDir
.
toPath
(),
"_N2A"
,
".TMP"
).
toFile
();
tempFile
.
deleteOnExit
();
try
{
...
...
jdk/src/solaris/classes/sun/font/FcFontConfiguration.java
浏览文件 @
415a17d0
/*
* Copyright (c) 2008, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 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
...
...
@@ -33,6 +33,7 @@ import java.io.IOException;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
import
java.nio.charset.Charset
;
import
java.nio.file.Files
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Properties
;
...
...
@@ -387,7 +388,7 @@ public class FcFontConfiguration extends FontConfiguration {
File
fcInfoFile
=
getFcInfoFile
();
File
dir
=
fcInfoFile
.
getParentFile
();
dir
.
mkdirs
();
File
tempFile
=
File
.
createTempFile
(
"fcinfo"
,
null
,
dir
);
File
tempFile
=
File
s
.
createTempFile
(
dir
.
toPath
(),
"fcinfo"
,
null
).
toFile
(
);
FileOutputStream
fos
=
new
FileOutputStream
(
tempFile
);
props
.
store
(
fos
,
"JDK Font Configuration Generated File: *Do Not Edit*"
);
...
...
jdk/src/solaris/classes/sun/print/UnixPrintJob.java
浏览文件 @
415a17d0
/*
* Copyright (c) 2000, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
12
, 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
...
...
@@ -42,6 +42,7 @@ import java.io.PrintWriter;
import
java.io.Reader
;
import
java.io.StringWriter
;
import
java.io.UnsupportedEncodingException
;
import
java.nio.file.Files
;
import
java.util.Vector
;
import
javax.print.CancelablePrintJob
;
...
...
@@ -938,7 +939,7 @@ public class UnixPrintJob implements CancelablePrintJob {
* is not removed for some reason, request that it is
* removed when the VM exits.
*/
spoolFile
=
File
.
createTempFile
(
"javaprint"
,
".ps"
,
null
);
spoolFile
=
File
s
.
createTempFile
(
"javaprint"
,
".ps"
).
toFile
(
);
spoolFile
.
deleteOnExit
();
}
result
=
new
FileOutputStream
(
spoolFile
);
...
...
jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java
浏览文件 @
415a17d0
/*
* Copyright (c) 2000, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
12
, 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
...
...
@@ -51,6 +51,7 @@ import javax.print.attribute.standard.PrinterName;
import
java.io.File
;
import
java.io.FileReader
;
import
java.net.URL
;
import
java.nio.file.Files
;
/*
* Remind: This class uses solaris commands. We also need a linux
...
...
@@ -714,7 +715,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
Process
proc
;
BufferedReader
bufferedReader
=
null
;
File
f
=
File
.
createTempFile
(
"prn"
,
"xc"
);
File
f
=
File
s
.
createTempFile
(
"prn"
,
"xc"
).
toFile
(
);
cmd
[
2
]
=
cmd
[
2
]+
">"
+
f
.
getAbsolutePath
();
proc
=
Runtime
.
getRuntime
().
exec
(
cmd
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录