Skip to content

Commit

Permalink
add build name and changes for zero byte files
Browse files Browse the repository at this point in the history
  • Loading branch information
joseorsini committed Oct 2, 2017
1 parent e181f40 commit 80ee268
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/com/liferay/portal/util/build.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#Tue, 07 Feb 2017 06:06:34 -0600
#Fri, 29 Sep 2017 14:50:22 -0600
dotcms.release.name=dotCMS Platform
dotcms.release.version=3.7.1
dotcms.release.codename=TRex
dotcms.release.build=57dc8a6
dotcms.release.date=Feb 07, 2017
dotcms.release.version=3.7.2
dotcms.release.codename=Aoshima
dotcms.release.build=e181f40
dotcms.release.date=Sep 29, 2017

tomcat.install.branch=8.0.18-master-3.5
tomcat.install.version=8.0.18
Expand Down
28 changes: 20 additions & 8 deletions src/com/liferay/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.nio.channels.FileChannel;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.file.FileAlreadyExistsException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -159,6 +160,10 @@ public static void copyFile(File source, File destination, boolean hardLinks) th
if (!source.exists()) {
throw new IOException("Source file does not exist" + source);
}

if(source.getAbsolutePath().equalsIgnoreCase(destination.getAbsolutePath())) {
return;
}

validateEmptyFile(source);

Expand Down Expand Up @@ -190,16 +195,23 @@ public static void copyFile(File source, File destination, boolean hardLinks) th
// setting this means we will try again if we cannot hard link
if (!destination.exists() || destination.length() == 0) {
hardLinks = false;
Logger.warn(FileUtil.class, "Can't create hardLink. source: " + source.getAbsolutePath()
+ ", destination: " + destination.getAbsolutePath());
StringBuilder sb = new StringBuilder();
sb.append("Can't create hardLink. source: " + source.getAbsolutePath());
sb.append(", destination: " + destination.getAbsolutePath());
Logger.warn(FileUtil.class, sb.toString());
}
} catch (IOException e) {

} catch (FileAlreadyExistsException e1) {
StringBuilder sb = new StringBuilder();
sb.append("Source File: " + source.getAbsolutePath());
sb.append("already exists on the destination: " + destination.getAbsolutePath());
Logger.debug(FileUtil.class, sb.toString());
} catch (IOException e2 ){
hardLinks = false; // setting to false will execute the fallback
Logger.debug(FileUtil.class,
"Could not created the hard link, will try copy for source: " + source +
", destination: " + destination + ". Error message: " + e.getMessage());
}
StringBuilder sb = new StringBuilder();
sb.append("Could not created the hard link, will try copy for source: " + source);
sb.append(", destination: " + destination + ". Error message: " + e2.getMessage());
Logger.debug(FileUtil.class, sb.toString());
}
}

if (!hardLinks) {
Expand Down

0 comments on commit 80ee268

Please sign in to comment.