File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 3131import java .io .StringWriter ;
3232import java .net .HttpURLConnection ;
3333import java .net .URL ;
34+ import java .nio .file .Files ;
35+ import java .nio .file .Paths ;
36+ import java .nio .file .StandardCopyOption ;
3437import java .util .ArrayList ;
3538import java .util .List ;
3639import java .util .concurrent .atomic .AtomicBoolean ;
@@ -376,16 +379,11 @@ private static boolean downloadChemCompRecord(String recordName) {
376379 }
377380
378381 pw .flush ();
379- // Now we move this across to where it actually wants to be
380- boolean couldRename = newFile .renameTo (new File (localName ));
381-
382- if (!couldRename ) {
383-
384- throw new IOException ("Could not rename temp file " +newFile .toString ()+" to file " + localName );
385- }
386-
387- return true ;
388382 }
383+ // Now we move this across to where it actually wants to be
384+ Files .move (newFile .toPath (), Paths .get (localName ), StandardCopyOption .REPLACE_EXISTING );
385+
386+ return true ;
389387 } catch (IOException e ){
390388 logger .error ("Could not download " +url .toString ()+" OR store locally to " +localName +" Error =" +e .getMessage ());
391389 newFile .delete ();
You can’t perform that action at this time.
0 commit comments