You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@creadur.apache.org by "Hugo Hirsch (Created) (JIRA)" <ji...@apache.org> on 2011/11/29 22:31:40 UTC

[jira] [Created] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Return value of mkdirs() is not checked and no error handling occurs
--------------------------------------------------------------------

                 Key: RAT-109
                 URL: https://issues.apache.org/jira/browse/RAT-109
             Project: RAT
          Issue Type: Bug
    Affects Versions: 0.9
         Environment: Revision: 1208077

            Reporter: Hugo Hirsch


The code contains calls to mkdir() without checking its return value.

Patch attached for classes:
*       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
*       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
*       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Posted by "Stefan Bodewig (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RAT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Bodewig resolved RAT-109.
--------------------------------

    Resolution: Fixed

should be fixed with svn revision 1208763
                
> Return value of mkdirs() is not checked and no error handling occurs
> --------------------------------------------------------------------
>
>                 Key: RAT-109
>                 URL: https://issues.apache.org/jira/browse/RAT-109
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: Revision: 1208077
>            Reporter: Hugo Hirsch
>             Fix For: 0.9
>
>         Attachments: RAT106errorPatch.diff, RAT109checkmkdirsReturnValue.patch
>
>
> The code contains calls to mkdir() without checking its return value.
> Patch attached for classes:
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
> *       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Posted by "Hugo Hirsch (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RAT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hugo Hirsch updated RAT-109:
----------------------------

    Attachment: RAT109checkmkdirsReturnValue.patch
    
> Return value of mkdirs() is not checked and no error handling occurs
> --------------------------------------------------------------------
>
>                 Key: RAT-109
>                 URL: https://issues.apache.org/jira/browse/RAT-109
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: Revision: 1208077
>            Reporter: Hugo Hirsch
>         Attachments: RAT109checkmkdirsReturnValue.patch
>
>
> The code contains calls to mkdir() without checking its return value.
> Patch attached for classes:
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
> *       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Posted by "Stefan Bodewig (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RAT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Bodewig resolved RAT-109.
--------------------------------

    Resolution: Fixed

applied with svn revision 1208826

                
> Return value of mkdirs() is not checked and no error handling occurs
> --------------------------------------------------------------------
>
>                 Key: RAT-109
>                 URL: https://issues.apache.org/jira/browse/RAT-109
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: Revision: 1208077
>            Reporter: Hugo Hirsch
>             Fix For: 0.9
>
>         Attachments: RAT106errorPatch.diff, RAT109checkmkdirsReturnValue.patch
>
>
> The code contains calls to mkdir() without checking its return value.
> Patch attached for classes:
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
> *       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Posted by "Hugo Hirsch (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RAT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hugo Hirsch updated RAT-109:
----------------------------

    Attachment: RAT106errorPatch.diff

Verified that John is/was right.
                
> Return value of mkdirs() is not checked and no error handling occurs
> --------------------------------------------------------------------
>
>                 Key: RAT-109
>                 URL: https://issues.apache.org/jira/browse/RAT-109
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: Revision: 1208077
>            Reporter: Hugo Hirsch
>             Fix For: 0.9
>
>         Attachments: RAT106errorPatch.diff, RAT109checkmkdirsReturnValue.patch
>
>
> The code contains calls to mkdir() without checking its return value.
> Patch attached for classes:
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
> *       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Posted by "David Crossley (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RAT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Crossley closed RAT-109.
------------------------------

       Resolution: Fixed
    Fix Version/s: 0.9

Thanks. Patch applied.
                
> Return value of mkdirs() is not checked and no error handling occurs
> --------------------------------------------------------------------
>
>                 Key: RAT-109
>                 URL: https://issues.apache.org/jira/browse/RAT-109
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: Revision: 1208077
>            Reporter: Hugo Hirsch
>             Fix For: 0.9
>
>         Attachments: RAT109checkmkdirsReturnValue.patch
>
>
> The code contains calls to mkdir() without checking its return value.
> Patch attached for classes:
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
> *       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Posted by "Hugo Hirsch (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RAT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hugo Hirsch reopened RAT-109:
-----------------------------


+1
John is right. Sorry
                
> Return value of mkdirs() is not checked and no error handling occurs
> --------------------------------------------------------------------
>
>                 Key: RAT-109
>                 URL: https://issues.apache.org/jira/browse/RAT-109
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: Revision: 1208077
>            Reporter: Hugo Hirsch
>             Fix For: 0.9
>
>         Attachments: RAT109checkmkdirsReturnValue.patch
>
>
> The code contains calls to mkdir() without checking its return value.
> Patch attached for classes:
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
> *       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Posted by "John Vines (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/RAT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13160090#comment-13160090 ] 

John Vines commented on RAT-109:
--------------------------------

This patch does not work, at least for my project. It fails because mkdirs does not create the directories, but it does not create the directories because it already exists. It should only throw that exception if the folder does not exist and it fails to create. Patch is pasted below (I tested it for my case at the very least).

Index: src/main/java/org/apache/rat/mp/RatCheckMojo.java
===================================================================
--- src/main/java/org/apache/rat/mp/RatCheckMojo.java	(revision 1208465)
+++ src/main/java/org/apache/rat/mp/RatCheckMojo.java	(working copy)
@@ -153,7 +153,7 @@
     public void execute() throws MojoExecutionException, MojoFailureException
     {
         File parent = reportFile.getParentFile();
-        if(!parent.mkdirs()) {
+        if (!parent.exists() && !parent.mkdirs()) {
             throw new MojoExecutionException("Could not create report parent directory " + parent);
         }
 

                
> Return value of mkdirs() is not checked and no error handling occurs
> --------------------------------------------------------------------
>
>                 Key: RAT-109
>                 URL: https://issues.apache.org/jira/browse/RAT-109
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: Revision: 1208077
>            Reporter: Hugo Hirsch
>             Fix For: 0.9
>
>         Attachments: RAT109checkmkdirsReturnValue.patch
>
>
> The code contains calls to mkdir() without checking its return value.
> Patch attached for classes:
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
> *       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (RAT-109) Return value of mkdirs() is not checked and no error handling occurs

Posted by "Sebb (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RAT-109?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb reopened RAT-109:
----------------------


There's a small window in the patch code which can potentially cause a failure, see https://issues.apache.org/jira/browse/JCI-67 for further details.

The checks need to be the other way round, i.e.

if(!parent.mkdirs() && !parent.exists()) { // or !isDirectory() as appropriate
    throw...
}

                
> Return value of mkdirs() is not checked and no error handling occurs
> --------------------------------------------------------------------
>
>                 Key: RAT-109
>                 URL: https://issues.apache.org/jira/browse/RAT-109
>             Project: RAT
>          Issue Type: Bug
>    Affects Versions: 0.9
>         Environment: Revision: 1208077
>            Reporter: Hugo Hirsch
>             Fix For: 0.9
>
>         Attachments: RAT106errorPatch.diff, RAT109checkmkdirsReturnValue.patch
>
>
> The code contains calls to mkdir() without checking its return value.
> Patch attached for classes:
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatReportMojo.java
> *       apache-rat-plugin/src/main/java/org/apache/rat/mp/RatCheckMojo.java
> *       apache-rat-tasks/src/test/java/org/apache/rat/anttasks/ReportTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira