replaced catching of Exception with Throwable, which catches also Errors

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7926 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent 877eaf6bcb
commit 52230a6864

@ -46,9 +46,8 @@ import net.yacy.kelondro.order.Bitfield;
import net.yacy.kelondro.order.Digest;
import net.yacy.kelondro.order.NaturalOrder;
import net.yacy.kelondro.util.ByteBuffer;
import net.yacy.kelondro.util.kelondroException;
import net.yacy.kelondro.util.MapTools;
import net.yacy.kelondro.util.kelondroException;
import de.anomic.crawler.retrieval.Request;
import de.anomic.search.QueryParams;
import de.anomic.tools.crypt;
@ -173,7 +172,7 @@ public class URIMetadataRow implements URIMetadata {
}
private Date decodeDate(final int col) {
long t = this.entry.getColLong(col);
final long t = this.entry.getColLong(col);
/*if (t < 14600) */return new Date(86400000L * t); // time was stored as number of days since epoch
/*
if (t < 350400) return new Date(3600000L * t); // hours since epoch
@ -229,7 +228,7 @@ public class URIMetadataRow implements URIMetadata {
this.entry.setCol(col_comp, encodeComp(url, descr, dc_creator, tags, dc_publisher, Float.parseFloat(lats), Float.parseFloat(lons)));
// create new formatters to make concurrency possible
GenericFormatter formatter = new GenericFormatter(GenericFormatter.FORMAT_SHORT_DAY, GenericFormatter.time_minute);
final GenericFormatter formatter = new GenericFormatter(GenericFormatter.FORMAT_SHORT_DAY, GenericFormatter.time_minute);
try {
encodeDate(col_mod, formatter.parse(prop.getProperty("mod", "20000101")));
@ -250,7 +249,7 @@ public class URIMetadataRow implements URIMetadata {
this.entry.setCol(col_md5, Digest.decodeHex(prop.getProperty("md5", "")));
this.entry.setCol(col_size, Integer.parseInt(prop.getProperty("size", "0")));
this.entry.setCol(col_wc, Integer.parseInt(prop.getProperty("wc", "0")));
String dt = prop.getProperty("dt", "t");
final String dt = prop.getProperty("dt", "t");
this.entry.setCol(col_dt, dt.length() > 0 ? new byte[]{(byte) dt.charAt(0)} : new byte[]{(byte) 't'});
final String flags = prop.getProperty("flags", "AAAAAA");
this.entry.setCol(col_flags, (flags.length() > 6) ? QueryParams.empty_constraint.bytes() : (new Bitfield(4, flags)).bytes());
@ -285,13 +284,13 @@ public class URIMetadataRow implements URIMetadata {
private StringBuilder corePropList() {
// generate a parseable string; this is a simple property-list
final Components metadata = this.metadata();
final Components metadata = metadata();
final StringBuilder s = new StringBuilder(300);
if (metadata == null) return null;
//System.out.println("author=" + comp.author());
// create new formatters to make concurrency possible
GenericFormatter formatter = new GenericFormatter(GenericFormatter.FORMAT_SHORT_DAY, GenericFormatter.time_minute);
final GenericFormatter formatter = new GenericFormatter(GenericFormatter.FORMAT_SHORT_DAY, GenericFormatter.time_minute);
try {
s.append("hash=").append(ASCII.String(hash()));
@ -345,12 +344,12 @@ public class URIMetadataRow implements URIMetadata {
if (this.word != null) {
// append also word properties
s.append(",wi=").append(Base64Order.enhancedCoder.encodeString(word.toPropertyForm()));
s.append(",wi=").append(Base64Order.enhancedCoder.encodeString(this.word.toPropertyForm()));
}
assert (s.toString().indexOf(0) < 0);
return s;
} catch (final Exception e) {
} catch (final Throwable e) {
// serverLog.logFailure("plasmaLURL.corePropList", e.getMessage());
// if (moddate == null) serverLog.logFailure("plasmaLURL.corePropList", "moddate=null");
// if (loaddate == null) serverLog.logFailure("plasmaLURL.corePropList", "loaddate=null");
@ -379,8 +378,8 @@ public class URIMetadataRow implements URIMetadata {
// avoid double computation of metadata elements
if (this.comp != null) return this.comp;
// parse elements from comp field;
byte[] c = this.entry.getColBytes(col_comp, true);
List<byte[]> cl = ByteBuffer.split(c, (byte) 10);
final byte[] c = this.entry.getColBytes(col_comp, true);
final List<byte[]> cl = ByteBuffer.split(c, (byte) 10);
this.comp = new Components(
(cl.size() > 0) ? UTF8.String(cl.get(0)) : "",
hash(),
@ -407,7 +406,7 @@ public class URIMetadataRow implements URIMetadata {
public byte[] referrerHash() {
// return the creator's hash or null if there is none
// FIXME: There seem to be some malformed entries in the databasees like "null\0\0\0\0\0\0\0\0"
final byte[] r = entry.getColBytes(col_referrer, true);
final byte[] r = this.entry.getColBytes(col_referrer, true);
if (r != null) {
int i = r.length;
while (i > 0) {
@ -419,11 +418,11 @@ public class URIMetadataRow implements URIMetadata {
public String md5() {
// returns the md5 in hex representation
return Digest.encodeHex(entry.getColBytes(col_md5, true));
return Digest.encodeHex(this.entry.getColBytes(col_md5, true));
}
public char doctype() {
return (char) entry.getColByte(col_dt);
return (char) this.entry.getColByte(col_dt);
}
public byte[] language() {
@ -469,11 +468,11 @@ public class URIMetadataRow implements URIMetadata {
public String snippet() {
// the snippet may appear here if the url was transported in a remote search
// it will not be saved anywhere, but can only be requested here
return snippet;
return this.snippet;
}
public WordReferenceVars word() {
return word;
return this.word;
}
public boolean isOlder(final URIMetadata other) {
@ -560,7 +559,7 @@ public class URIMetadataRow implements URIMetadata {
this.dc_publisher = publisher;
this.latlon = latlon;
}
public boolean matches(Pattern matcher) {
public boolean matches(final Pattern matcher) {
if (this.urlRaw != null) return matcher.matcher(this.urlRaw.toLowerCase()).matches();
if (this.url != null) return matcher.matcher(this.url.toNormalform(true, true).toLowerCase()).matches();
return false;
@ -569,7 +568,7 @@ public class URIMetadataRow implements URIMetadata {
if (this.url == null) {
try {
this.url = new DigestURI(this.urlRaw, this.urlHash);
} catch (MalformedURLException e) {
} catch (final MalformedURLException e) {
this.url = null;
}
this.urlRaw = null;
@ -582,14 +581,14 @@ public class URIMetadataRow implements URIMetadata {
public String dc_publisher() { return this.dc_publisher; }
public String dc_subject() { return this.dc_subject; }
public float lat() {
if (latlon == null || latlon.length() == 0) return 0.0f;
int p = latlon.indexOf(',');
return p < 0 ? 0.0f : Float.parseFloat(latlon.substring(0, p));
if (this.latlon == null || this.latlon.length() == 0) return 0.0f;
final int p = this.latlon.indexOf(',');
return p < 0 ? 0.0f : Float.parseFloat(this.latlon.substring(0, p));
}
public float lon() {
if (latlon == null || latlon.length() == 0) return 0.0f;
int p = latlon.indexOf(',');
return p < 0 ? 0.0f : Float.parseFloat(latlon.substring(p + 1));
if (this.latlon == null || this.latlon.length() == 0) return 0.0f;
final int p = this.latlon.indexOf(',');
return p < 0 ? 0.0f : Float.parseFloat(this.latlon.substring(p + 1));
}
}
}

@ -459,13 +459,13 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>
final RowSet r = new RowSet(c0.rowdef, c0.size() + c1.size());
try {
c0.sort();
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logSevere("RowSet", "collection corrupted. cleaned. " + e.getMessage(), e);
c0.clear();
}
try {
c1.sort();
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logSevere("RowSet", "collection corrupted. cleaned. " + e.getMessage(), e);
c1.clear();
}

@ -409,7 +409,7 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
((this.zero == null) ? compares(a, b) : compare0(a, 0, b, 0, a.length))
:
((this.zero == null) ? compares(b, a) : compare0(b, 0, a, 0, a.length));
} catch (final Exception e) {
} catch (final Throwable e) {
// if a or b is not well-formed, an ArrayIndexOutOfBoundsException may occur
// in that case we don't want that the exception makes databse functions
// unusable and effective creates a showstopper. In such cases we apply
@ -435,7 +435,7 @@ public class Base64Order extends AbstractOrder<byte[]> implements ByteOrder, Com
compare0(a, aoffset, b, boffset, length)
:
compare0(b, boffset, a, aoffset, length);
} catch (final Exception e) {
} catch (final Throwable e) {
// same handling as in simple compare method above
final boolean wfa = wellformed(a, aoffset, length);
final boolean wfb = wellformed(b, boffset, length);

@ -162,7 +162,7 @@ public class IODispatcher extends Thread {
} catch (final InterruptedException e) {
Log.logSevere("IODispatcher", "main run job was interrupted (1)", e);
Log.logException(e);
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logSevere("IODispatcher", "main run job had errors (1), dump to " + f + " failed.", e);
Log.logException(e);
}
@ -181,7 +181,7 @@ public class IODispatcher extends Thread {
} catch (final InterruptedException e) {
Log.logSevere("IODispatcher", "main run job was interrupted (2)", e);
Log.logException(e);
} catch (final Exception e) {
} catch (final Throwable e) {
if (f2 == null) {
Log.logSevere("IODispatcher", "main run job had errors (2), dump to " + f + " failed. Input file is " + f1, e);
} else {
@ -200,12 +200,12 @@ public class IODispatcher extends Thread {
Log.logSevere("IODispatcher", "main loop in bad state, dumpQueue.size() = " + this.dumpQueue.size() + ", mergeQueue.size() = " + this.mergeQueue.size() + ", controlQueue.availablePermits() = " + this.controlQueue.availablePermits());
assert false : "this process statt should not be reached"; // this should never happen
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logSevere("IODispatcher", "main run job failed (X)", e);
Log.logException(e);
}
Log.logInfo("IODispatcher", "loop terminated");
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logSevere("IODispatcher", "main run job failed (4)", e);
Log.logException(e);
} finally {

@ -111,7 +111,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
while (IndexCell.this.cleanupShallRun) {
try {
cleanCache();
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logException(e);
}
try { Thread.sleep(3000); } catch (final InterruptedException e) {}
@ -147,7 +147,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
// dump the buffer
IndexCell.this.merger.dump(ramdump, dumpFile, IndexCell.this.array);
IndexCell.this.lastDump = System.currentTimeMillis();
} catch (final Exception e) {
} catch (final Throwable e) {
// catch all exceptions
Log.logException(e);
}
@ -162,7 +162,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
IndexCell.this.lastCleanup = System.currentTimeMillis(); // set time to prevent that this is called to soon again
IndexCell.this.shrink(IndexCell.this.targetFileSize, IndexCell.this.maxFileSize);
IndexCell.this.lastCleanup = System.currentTimeMillis(); // set again to mark end of procedure
} catch (final Exception e) {
} catch (final Throwable e) {
// catch all exceptions
Log.logException(e);
}
@ -263,7 +263,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
// read fresh values from file
try {
countFile = this.array.count(termHash);
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logException(e);
}
assert countFile >= 0;

@ -153,7 +153,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
public ReferenceContainer<ReferenceType> next() {
if (this.iterator.hasNext()) try {
return get(this.iterator.next());
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logException(e);
return null;
}
@ -164,7 +164,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
try {
this.iterator = ReferenceContainerArray.this.array.keys(true, null);
return get(this.iterator.next());
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logException(e);
return null;
}
@ -225,7 +225,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
if (this.iterator.hasNext()) try {
reference = this.iterator.next();
return new Rating<byte[]>(reference, count(reference));
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logException(e);
return null;
}
@ -237,7 +237,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
this.iterator = ReferenceContainerArray.this.array.keys(true, null);
reference = this.iterator.next();
return new Rating<byte[]>(reference, count(reference));
} catch (final Exception e) {
} catch (final Throwable e) {
Log.logException(e);
return null;
}

Loading…
Cancel
Save