[ https://issues.apache.org/jira/browse/MRESOLVER-290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17632734#comment-17632734 ]
ASF GitHub Bot commented on MRESOLVER-290: ------------------------------------------ cstamas commented on code in PR #218: URL: https://github.com/apache/maven-resolver/pull/218#discussion_r1020801363 ########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultFileProcessor.java: ########## @@ -75,144 +78,49 @@ public boolean mkdirs( File directory ) } catch ( IOException e ) { - return false; + throw new UncheckedIOException( e ); } File parentDir = canonDir.getParentFile(); return ( parentDir != null && ( mkdirs( parentDir ) || parentDir.exists() ) && canonDir.mkdir() ); } public void write( File target, String data ) - throws IOException + throws IOException { - mkdirs( target.getAbsoluteFile().getParentFile() ); - - OutputStream out = null; - try - { - out = new FileOutputStream( target ); - - if ( data != null ) - { - out.write( data.getBytes( StandardCharsets.UTF_8 ) ); - } - - out.close(); - out = null; - } - finally - { - try - { - if ( out != null ) - { - out.close(); - } - } - catch ( final IOException e ) - { - // Suppressed due to an exception already thrown in the try block. - } - } + FileUtils.writeFile( target.toPath(), p -> Files.write( p, data.getBytes( StandardCharsets.UTF_8 ) ) ); Review Comment: Not now but in near future https://issues.apache.org/jira/browse/MRESOLVER-295 > Improve file handling resolver wide > ----------------------------------- > > Key: MRESOLVER-290 > URL: https://issues.apache.org/jira/browse/MRESOLVER-290 > Project: Maven Resolver > Issue Type: Task > Components: Resolver > Reporter: Tamas Cservenak > Assignee: Tamas Cservenak > Priority: Major > Fix For: 1.9.1 > > > Use new atomic primitives (utils) to make sure files are fully written. Also, > tighten up IO, as some parts are "forgiving" re IOexceptions (like writing > checksum files to disk?), but this relaxedness is wrong, as if you have IOex > while writing to your disk (local repo) is usually a symptom of some real > problem, from permissions mixup to possibly faulty hardware. -- This message was sent by Atlassian Jira (v8.20.10#820010)