TempFileHelper java.lang.IllegalArgumentException: Invalid prefix or suffix
Michael Hall
mik3hall at gmail.com
Tue Aug 31 17:41:21 UTC 2021
> On Aug 31, 2021, at 12:39 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 31/08/2021 18:27, Michael Hall wrote:
>> :
>>
>> Slightly different results…
>>
>> public class SecTemp {
>>
>> public static void main(String... args) throws java.io.IOException {
>> System.setSecurityManager(new SecurityManager());
>> java.io.File tmpfile = java.nio.file.Files.createTempFile("AppleScriptEngine.", ".scpt").toFile();
>> }
>> }
>>
>> java SecTemp
>> WARNING: A terminally deprecated method in java.lang.System has been called
>> WARNING: System::setSecurityManager has been called by SecTemp (file:/Users/mjh/ <file:///Users/mjh/>)
>> WARNING: Please consider reporting this to the maintainers of SecTemp
>> WARNING: System::setSecurityManager will be removed in a future release
>> Exception in thread "main" java.lang.SecurityException: Unable to create temporary file or directory
>> at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:141)
>> at java.base/java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:159)
>> at java.base/java.nio.file.Files.createTempFile(Files.java:923)
>> at SecTemp.main(SecTemp.java:6)
>
> This is because it hasn't been granted permission to create files in ${java.io.tmpdir}. I would expect this behavior is every JDK release.
>
> -Alan
Ah, this one I didn’t test on any other release. If I provide an ‘all’ policy?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20210831/893df673/attachment.htm>
More information about the nio-dev
mailing list