mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-21 00:00:13 +02:00
catch problems of file hash computation, see also:
http://forum.yacy-websuche.de/viewtopic.php?p=15245#p15245 git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5989 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
fec6f9054f
commit
876746602d
|
@ -116,11 +116,17 @@ public class BLOBHeapModifier extends HeapReader implements BLOB {
|
||||||
try {
|
try {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
String fingerprint = HeapWriter.fingerprintFileHash(this.heapFile);
|
String fingerprint = HeapWriter.fingerprintFileHash(this.heapFile);
|
||||||
|
if (fingerprint == null) {
|
||||||
|
Log.logSevere("kelondroBLOBHeap", "cannot write a dump for " + heapFile.getName()+ ": fingerprint is null");
|
||||||
|
} else {
|
||||||
free.dump(HeapWriter.fingerprintGapFile(this.heapFile, fingerprint));
|
free.dump(HeapWriter.fingerprintGapFile(this.heapFile, fingerprint));
|
||||||
|
}
|
||||||
free.clear();
|
free.clear();
|
||||||
free = null;
|
free = null;
|
||||||
|
if (fingerprint != null) {
|
||||||
index.dump(HeapWriter.fingerprintIndexFile(this.heapFile, fingerprint));
|
index.dump(HeapWriter.fingerprintIndexFile(this.heapFile, fingerprint));
|
||||||
Log.logInfo("kelondroBLOBHeap", "wrote a dump for the " + this.index.size() + " index entries of " + heapFile.getName()+ " in " + (System.currentTimeMillis() - start) + " milliseconds.");
|
Log.logInfo("kelondroBLOBHeap", "wrote a dump for the " + this.index.size() + " index entries of " + heapFile.getName()+ " in " + (System.currentTimeMillis() - start) + " milliseconds.");
|
||||||
|
}
|
||||||
index.close();
|
index.close();
|
||||||
index = null;
|
index = null;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -101,6 +101,10 @@ public class HeapReader {
|
||||||
// look for an index dump and read it if it exist
|
// look for an index dump and read it if it exist
|
||||||
// if this is successfull, return true; otherwise false
|
// if this is successfull, return true; otherwise false
|
||||||
String fingerprint = HeapWriter.fingerprintFileHash(this.heapFile);
|
String fingerprint = HeapWriter.fingerprintFileHash(this.heapFile);
|
||||||
|
if (fingerprint == null) {
|
||||||
|
Log.logSevere("HeapReader", "cannot generate a fingerprint for " + this.heapFile + ": null");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
File fif = HeapWriter.fingerprintIndexFile(this.heapFile, fingerprint);
|
File fif = HeapWriter.fingerprintIndexFile(this.heapFile, fingerprint);
|
||||||
if (!fif.exists()) fif = new File(fif.getAbsolutePath() + ".gz");
|
if (!fif.exists()) fif = new File(fif.getAbsolutePath() + ".gz");
|
||||||
File fgf = HeapWriter.fingerprintGapFile(this.heapFile, fingerprint);
|
File fgf = HeapWriter.fingerprintGapFile(this.heapFile, fingerprint);
|
||||||
|
|
|
@ -120,6 +120,7 @@ public final class HeapWriter {
|
||||||
assert f.exists() : "file = " + f.toString();
|
assert f.exists() : "file = " + f.toString();
|
||||||
String fp = Digest.fastFingerprintB64(f, false);
|
String fp = Digest.fastFingerprintB64(f, false);
|
||||||
assert fp != null : "file = " + f.toString();
|
assert fp != null : "file = " + f.toString();
|
||||||
|
if (fp == null) return null;
|
||||||
return fp.substring(0, 12);
|
return fp.substring(0, 12);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,9 +157,13 @@ public final class HeapWriter {
|
||||||
try {
|
try {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
String fingerprint = HeapWriter.fingerprintFileHash(this.heapFileREADY);
|
String fingerprint = HeapWriter.fingerprintFileHash(this.heapFileREADY);
|
||||||
|
if (fingerprint == null) {
|
||||||
|
Log.logSevere("kelondroBLOBHeapWriter", "cannot write a dump for " + heapFileREADY.getName()+ ": fingerprint is null");
|
||||||
|
} else {
|
||||||
new Gap().dump(fingerprintGapFile(this.heapFileREADY, fingerprint));
|
new Gap().dump(fingerprintGapFile(this.heapFileREADY, fingerprint));
|
||||||
index.dump(fingerprintIndexFile(this.heapFileREADY, fingerprint));
|
index.dump(fingerprintIndexFile(this.heapFileREADY, fingerprint));
|
||||||
Log.logInfo("kelondroBLOBHeapWriter", "wrote a dump for the " + this.index.size() + " index entries of " + heapFileREADY.getName()+ " in " + (System.currentTimeMillis() - start) + " milliseconds.");
|
Log.logInfo("kelondroBLOBHeapWriter", "wrote a dump for the " + this.index.size() + " index entries of " + heapFileREADY.getName()+ " in " + (System.currentTimeMillis() - start) + " milliseconds.");
|
||||||
|
}
|
||||||
index.close();
|
index.close();
|
||||||
index = null;
|
index = null;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
|
@ -249,6 +249,7 @@ public class Digest {
|
||||||
try {
|
try {
|
||||||
byte[] b = fastFingerprintRaw(file, includeDate);
|
byte[] b = fastFingerprintRaw(file, includeDate);
|
||||||
assert b != null : "file = " + file.toString();
|
assert b != null : "file = " + file.toString();
|
||||||
|
if (b == null || b.length == 0) return null;
|
||||||
assert b.length != 0 : "file = " + file.toString();
|
assert b.length != 0 : "file = " + file.toString();
|
||||||
return Base64Order.enhancedCoder.encode(b);
|
return Base64Order.enhancedCoder.encode(b);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user