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
2d2b93af
Commit
2d2b93af
authored
16 years ago
by
ribeaudc
Browse files
Options
Downloads
Patches
Plain Diff
change: - Compare binary instead of String.
SVN: 6684
parent
4c021805
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bds/source/java/ch/systemsx/cisd/bds/check/AbstractChecker.java
+32
-11
32 additions, 11 deletions
...urce/java/ch/systemsx/cisd/bds/check/AbstractChecker.java
with
32 additions
and
11 deletions
bds/source/java/ch/systemsx/cisd/bds/check/AbstractChecker.java
+
32
−
11
View file @
2d2b93af
...
...
@@ -17,10 +17,14 @@
package
ch.systemsx.cisd.bds.check
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.apache.commons.io.IOUtils
;
import
ch.systemsx.cisd.bds.StringUtils
;
import
ch.systemsx.cisd.bds.Utilities
;
import
ch.systemsx.cisd.bds.exception.DataStructureException
;
...
...
@@ -191,6 +195,9 @@ public abstract class AbstractChecker
private
static
final
String
MSG_ERROR_IN_STANDARD_ORIGINAL_MAPPING_LINE
=
"Error in standard-original mapping line "
;
private
static
final
String
IO_EXCEPTION_WHILE_COMPARING_FILES
=
"I/O Exception while comparing file '%s' with file '%s': %s"
;
protected
static
final
String
path
(
final
String
...
args
)
{
final
String
separator
=
"/"
;
...
...
@@ -364,7 +371,7 @@ public abstract class AbstractChecker
final
String
fileName2
=
values
[
2
];
if
(
"I"
.
equals
(
relationshipOperator
))
{
checkFilesIdentica
t
(
bdsRoot
,
currentLineNumber
,
fileName1
,
fileName2
);
checkFilesIdentica
l
(
bdsRoot
,
currentLineNumber
,
fileName1
,
fileName2
);
}
else
if
(
"T"
.
equals
(
relationshipOperator
)
==
false
)
{
...
...
@@ -382,14 +389,11 @@ public abstract class AbstractChecker
}
}
private
void
checkFilesIdentica
t
(
final
IDirectory
bdsRoot
,
final
int
currentLineNumber
,
private
void
checkFilesIdentica
l
(
final
IDirectory
bdsRoot
,
final
int
currentLineNumber
,
final
String
fileName1
,
final
String
fileName2
)
{
IFile
file1
=
null
;
IFile
file2
=
null
;
file1
=
tryGetFile
(
bdsRoot
,
path
(
DATA
,
STANDARD
,
fileName1
));
file2
=
tryGetFile
(
bdsRoot
,
path
(
DATA
,
ORIGINAL
,
fileName2
));
final
IFile
file1
=
tryGetFile
(
bdsRoot
,
path
(
DATA
,
STANDARD
,
fileName1
));
final
IFile
file2
=
tryGetFile
(
bdsRoot
,
path
(
DATA
,
ORIGINAL
,
fileName2
));
if
(
file1
==
null
||
file2
==
null
)
{
final
List
<
String
>
missing
=
new
ArrayList
<
String
>();
...
...
@@ -403,11 +407,28 @@ public abstract class AbstractChecker
}
problemReport
.
error
(
MSG_ERROR_IN_STANDARD_ORIGINAL_MAPPING_LINE
+
currentLineNumber
+
": missing files "
+
missing
);
}
else
if
(
file1
.
getStringContent
().
equals
(
file2
.
getStringContent
())
==
false
)
return
;
}
InputStream
input1
=
null
;
InputStream
input2
=
null
;
try
{
problemReport
.
error
(
MSG_ERROR_IN_STANDARD_ORIGINAL_MAPPING_LINE
+
currentLineNumber
+
": content of the files is supposed to be identical but is different ("
+
fileName1
+
","
+
fileName2
+
")"
);
input1
=
file1
.
getInputStream
();
input2
=
file2
.
getInputStream
();
if
(
IOUtils
.
contentEquals
(
input1
,
input2
)
==
false
)
{
problemReport
.
error
(
MSG_ERROR_IN_STANDARD_ORIGINAL_MAPPING_LINE
+
currentLineNumber
+
": content of the files is supposed to be identical but is different ("
+
fileName1
+
","
+
fileName2
+
")"
);
}
}
catch
(
final
IOException
ex
)
{
problemReport
.
error
(
String
.
format
(
IO_EXCEPTION_WHILE_COMPARING_FILES
,
fileName1
,
fileName2
,
ex
.
getMessage
()));
}
finally
{
IOUtils
.
closeQuietly
(
input1
);
IOUtils
.
closeQuietly
(
input2
);
}
}
...
...
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