-
Bug
-
Resolution: Fixed
-
P2
-
6u85, 7u40, 8
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8072266 | 7u85 | Ivan Gerasimov | P2 | Resolved | Fixed | b01 |
JDK-8044175 | 7u80 | Ivan Gerasimov | P2 | Resolved | Fixed | b03 |
JDK-8064654 | 7u79 | Ivan Gerasimov | P2 | Resolved | Fixed | b01 |
JDK-8064486 | 7u76 | Ivan Gerasimov | P2 | Closed | Fixed | b08 |
JDK-8055214 | 6u91 | Ivan Gerasimov | P2 | Closed | Fixed | b01 |
This is the regression introduced with fix for JDK-8013827. The code now checks if file exists before creating new temp file as oppose to earlier where an attempt was made to create file.
Code snippet:
File f;
try {
do {
f = TempDirectory.generateFile(prefix, suffix, tmpdir);
} while (f.exists());
if (!f.createNewFile())
throw new IOException("Unable to create temporary file");
} catch (SecurityException se) {
The call to f.exists now needs "read" permission to be provided for applications which only need to write temp file.
Error:
java.security.AccessControlException: access denied
Exception stack trace:
java.security.AccessControlException: access denied ("java.io.FilePermission" "/tmp/abcd#4910205138484207578.tmp" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:453)
at java.security.AccessController.checkPermission(AccessController.java:820)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at java.io.File.exists(File.java:814)
at java.io.File.createTempFile(File.java:2003)
Code snippet:
File f;
try {
do {
f = TempDirectory.generateFile(prefix, suffix, tmpdir);
} while (f.exists());
if (!f.createNewFile())
throw new IOException("Unable to create temporary file");
} catch (SecurityException se) {
The call to f.exists now needs "read" permission to be provided for applications which only need to write temp file.
Error:
java.security.AccessControlException: access denied
Exception stack trace:
java.security.AccessControlException: access denied ("java.io.FilePermission" "/tmp/abcd#4910205138484207578.tmp" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:453)
at java.security.AccessController.checkPermission(AccessController.java:820)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at java.io.File.exists(File.java:814)
at java.io.File.createTempFile(File.java:2003)
- backported by
-
JDK-8044175 File.createTempFile requires unnecessary "read" permission
-
- Resolved
-
-
JDK-8064654 File.createTempFile requires unnecessary "read" permission
-
- Resolved
-
-
JDK-8072266 File.createTempFile requires unnecessary "read" permission
-
- Resolved
-
-
JDK-8055214 File.createTempFile requires unnecessary "read" permission
-
- Closed
-
-
JDK-8064486 File.createTempFile requires unnecessary "read" permission
-
- Closed
-