cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Citaire (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (CXF-1924) Infinite loop in FileUtils.getDefaultTempDir() when "java.io.tmpdir" directory does not exist
Date Sat, 11 Dec 2010 18:59:01 GMT

    [ https://issues.apache.org/jira/browse/CXF-1924?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12969844#action_12969844
] 

Eric Citaire edited comment on CXF-1924 at 12/11/10 1:57 PM:
-------------------------------------------------------------

I'd like to reopen this issue because it still goes in an infinite loop when the property
is set to an non-*writable* directory. The fix doesn't check that.

May be something like this would prevent an infinite loop :

{{s = System.getProperty("java.io.tmpdir");}}
{{File checkExists = new File(s);}}
{{if (!checkExists.exists() || !checkExists.isDirectory() || !checkExists.canWrite()) {}}
  {{throw new RuntimeException("The directory "}}
    {{+ checkExists.getAbsolutePath()}}
    {{+ " is not a writable directory");}}
{{}}}
{{File f = new File(s, "cxf-tmp-" + x);}}
{{for (int attempts=0; attempts<10; attempts++) {}}
  {{x = (int)(Math.random() * 1000000);}}
  {{f = new File(s, "cxf-tmp-" + x);}}
  {{if (f.mkdir()) break;}}
{{}}}


Thank you.

      was (Author: eric.citaire):
    I'd like to reopen this issue because it still goes in an infinite loop when the property
is set to an non-*writable* directory. The fix doesn't check that.

May be something like this would prevent an infinite loop :

{{s = System.getProperty("java.io.tmpdir");}}
{{File checkExists = new File(s);}}
{{if (!checkExists.exists() || !checkExists.isDirectory() || !checkExists.canWrite()) {}}
  {{throw new RuntimeException("The directory "}}
    {{+ checkExists.getAbsolutePath()}}
    {{+ " is not a writable directory");}}
{{}}}
{{File f = new File(s, "cxf-tmp-" + x);}}
{{for (int attempts=0; attempts<10; attempts++) {}}
  {{x = (int)(Math.random() * 1000000);}}
  {{f = new File(s, "cxf-tmp-" + x);}}
{{}}}


Thank you.
  
> Infinite loop in FileUtils.getDefaultTempDir() when "java.io.tmpdir" directory does not
exist
> ---------------------------------------------------------------------------------------------
>
>                 Key: CXF-1924
>                 URL: https://issues.apache.org/jira/browse/CXF-1924
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.1.4, 2.2
>            Reporter: Jarek Gawor
>            Assignee: Sean O'Callaghan
>             Fix For: 2.0.10, 2.1.4
>
>
> FileUtils.getDefaultTempDir() can go into a infinite loop when the "java.io.tmpdir" system
property is set to an non-existent directory. Here's the code that causes the problem:
>             s = System.getProperty("java.io.tmpdir");
>             File f = new File(s, "cxf-tmp-" + x);
>             while (!f.mkdir()) {
>                 x = (int)(Math.random() * 1000000);
>                 f = new File(s, "cxf-tmp-" + x);
>             }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message