You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/02/02 07:24:22 UTC

[GitHub] [maven-indexer] hboutemy opened a new pull request #164: [MINDEXER-132] use Java 7 Files.createTempDirectory() API

hboutemy opened a new pull request #164:
URL: https://github.com/apache/maven-indexer/pull/164


   https://issues.apache.org/jira/browse/MINDEXER-132


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-indexer] cstamas merged pull request #164: [MINDEXER-132] use Java 7 Files.createTempDirectory() API

Posted by GitBox <gi...@apache.org>.
cstamas merged pull request #164:
URL: https://github.com/apache/maven-indexer/pull/164


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-indexer] cstamas commented on a change in pull request #164: [MINDEXER-132] use Java 7 Files.createTempDirectory() API

Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #164:
URL: https://github.com/apache/maven-indexer/pull/164#discussion_r797448422



##########
File path: indexer-reader/src/test/java/org/apache/maven/index/reader/TestSupport.java
##########
@@ -54,9 +56,7 @@
     public void setup()
         throws IOException
     {
-        this.tempDir = new File( "target/tmp-" + getClass().getSimpleName() );
-        this.tempDir.delete();
-        this.tempDir.mkdirs();
+        this.tempDir = Files.createTempDirectory( getClass().getSimpleName() + ".temp" ).toFile();
         this.directoryResourceHandlers = new ArrayList<>();

Review comment:
       We usually when needed to create temp dirs, use property for surefilre/failsafe to set tmp dir on CI to some place that is nuked along with workspace.... 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-indexer] cstamas commented on a change in pull request #164: [MINDEXER-132] use Java 7 Files.createTempDirectory() API

Posted by GitBox <gi...@apache.org>.
cstamas commented on a change in pull request #164:
URL: https://github.com/apache/maven-indexer/pull/164#discussion_r797333856



##########
File path: indexer-core/src/main/java/org/apache/maven/index/updater/DefaultIndexUpdater.java
##########
@@ -190,9 +191,7 @@ private Date loadIndexDirectory( final IndexUpdateRequest updateRequest, final R
         {
             updateRequest.getIndexTempDir().mkdirs();
         }
-        File indexDir = File.createTempFile( remoteIndexFile, ".dir" , updateRequest.getIndexTempDir() );
-        indexDir.delete();
-        indexDir.mkdirs();
+        File indexDir = Files.createTempDirectory( updateRequest.getIndexTempDir().toPath(), remoteIndexFile ).toFile();

Review comment:
       updateRequest.getIndexTempDir() is nullable, above is nullcheck performed. Better make `File indexDir` above IF and then update it in IF (add ELSE as well).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-indexer] gnodet commented on a change in pull request #164: [MINDEXER-132] use Java 7 Files.createTempDirectory() API

Posted by GitBox <gi...@apache.org>.
gnodet commented on a change in pull request #164:
URL: https://github.com/apache/maven-indexer/pull/164#discussion_r797445126



##########
File path: indexer-reader/src/test/java/org/apache/maven/index/reader/TestSupport.java
##########
@@ -54,9 +56,7 @@
     public void setup()
         throws IOException
     {
-        this.tempDir = new File( "target/tmp-" + getClass().getSimpleName() );
-        this.tempDir.delete();
-        this.tempDir.mkdirs();
+        this.tempDir = Files.createTempDirectory( getClass().getSimpleName() + ".temp" ).toFile();
         this.directoryResourceHandlers = new ArrayList<>();

Review comment:
       I don't like creating temp directories in tests:
     * it's not deleted
     * it's hard to find
     * if the directory is deleted at the end of the test, its not available anymore to debug the test if needed




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-indexer] gnodet commented on a change in pull request #164: [MINDEXER-132] use Java 7 Files.createTempDirectory() API

Posted by GitBox <gi...@apache.org>.
gnodet commented on a change in pull request #164:
URL: https://github.com/apache/maven-indexer/pull/164#discussion_r797451268



##########
File path: indexer-reader/src/test/java/org/apache/maven/index/reader/TestSupport.java
##########
@@ -54,9 +56,7 @@
     public void setup()
         throws IOException
     {
-        this.tempDir = new File( "target/tmp-" + getClass().getSimpleName() );
-        this.tempDir.delete();
-        this.tempDir.mkdirs();
+        this.tempDir = Files.createTempDirectory( getClass().getSimpleName() + ".temp" ).toFile();
         this.directoryResourceHandlers = new ArrayList<>();

Review comment:
       I see https://github.com/apache/maven-indexer/blob/master/indexer-core/pom.xml#L179 which looks fine.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org