Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
7a070d42
Commit
7a070d42
authored
16 years ago
by
tpylak
Browse files
Options
Downloads
Patches
Plain Diff
SE-48 report success even if ln reports failure if the exact copy exists
SVN: 6351
parent
63bb2ae0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/source/java/ch/systemsx/cisd/common/utilities/RecursiveHardLinkMaker.java
+32
-2
32 additions, 2 deletions
...ystemsx/cisd/common/utilities/RecursiveHardLinkMaker.java
with
32 additions
and
2 deletions
common/source/java/ch/systemsx/cisd/common/utilities/RecursiveHardLinkMaker.java
+
32
−
2
View file @
7a070d42
...
@@ -17,9 +17,11 @@
...
@@ -17,9 +17,11 @@
package
ch.systemsx.cisd.common.utilities
;
package
ch.systemsx.cisd.common.utilities
;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
org.apache.commons.io.FileUtils
;
import
org.apache.log4j.Logger
;
import
org.apache.log4j.Logger
;
import
ch.systemsx.cisd.common.logging.LogCategory
;
import
ch.systemsx.cisd.common.logging.LogCategory
;
...
@@ -241,8 +243,22 @@ public final class RecursiveHardLinkMaker implements IPathImmutableCopier
...
@@ -241,8 +243,22 @@ public final class RecursiveHardLinkMaker implements IPathImmutableCopier
{
{
public
boolean
run
()
public
boolean
run
()
{
{
return
ProcessExecutionHelper
.
runAndLog
(
cmd
,
singleFileLinkTimeout
boolean
result
=
.
getMillisToWaitForCompletion
(),
operationLog
,
machineLog
);
ProcessExecutionHelper
.
runAndLog
(
cmd
,
singleFileLinkTimeout
.
getMillisToWaitForCompletion
(),
operationLog
,
machineLog
);
// NOTE: we have noticed that sometimes the result is false although the file
// have been copied
if
(
result
==
false
&&
destFile
.
exists
()
&&
checkIfIdenticalContent
(
file
,
destFile
))
{
machineLog
.
warn
(
"Link creator reported failure, but the exact copy of the file '"
+
file
.
getPath
()
+
"' seems to exist in '"
+
destFile
.
getPath
()
+
"'. Error will be ignored."
);
result
=
true
;
}
return
result
;
}
}
};
};
boolean
ok
=
boolean
ok
=
...
@@ -251,6 +267,20 @@ public final class RecursiveHardLinkMaker implements IPathImmutableCopier
...
@@ -251,6 +267,20 @@ public final class RecursiveHardLinkMaker implements IPathImmutableCopier
return
ok
?
destFile
:
null
;
return
ok
?
destFile
:
null
;
}
}
private
static
boolean
checkIfIdenticalContent
(
final
File
file1
,
final
File
file2
)
{
try
{
return
FileUtils
.
contentEquals
(
file1
,
file2
);
}
catch
(
IOException
e
)
{
machineLog
.
warn
(
"It was not possible to compare the content of the file to check if creating links worked: "
+
e
.
getMessage
());
}
return
false
;
}
private
final
List
<
String
>
createLnCmdLine
(
final
File
srcFile
,
final
File
destFile
)
private
final
List
<
String
>
createLnCmdLine
(
final
File
srcFile
,
final
File
destFile
)
{
{
final
List
<
String
>
tokens
=
new
ArrayList
<
String
>();
final
List
<
String
>
tokens
=
new
ArrayList
<
String
>();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment