Changeset 476caf3


Ignore:
Timestamp:
Jul 5, 2011 12:46:23 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
98b1415
Parents:
4f3c15e
Message:

catch exception on dup entry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java

    r4f3c15e r476caf3  
    5151 */
    5252public class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacade {
    53     protected Log _log;
     53    protected final Log _log;
    5454    private KBucketSet _kb; // peer hashes sorted into kbuckets, but within kbuckets, unsorted
    5555    private DataStore _ds; // hash to DataStructure mapping, persisted when necessary
     
    6464    /** when was the last time an exploration found something new? */
    6565    private long _lastExploreNew;
    66     protected PeerSelector _peerSelector;
    67     protected RouterContext _context;
     66    protected final PeerSelector _peerSelector;
     67    protected final RouterContext _context;
    6868    /**
    6969     * Map of Hash to RepublishLeaseSetJob for leases we'realready managing.
     
    133133        _context = context;
    134134        _log = _context.logManager().getLog(getClass());
    135         _initialized = false;
    136135        _peerSelector = createPeerSelector();
    137136        _publishingLeaseSets = new HashMap(8);
    138         _lastExploreNew = 0;
    139137        _activeRequests = new HashMap(8);
    140138        _enforceNetId = DEFAULT_ENFORCE_NETID;
     
    668666        if (!_initialized) return null;
    669667       
    670         LeaseSet rv = (LeaseSet)_ds.get(key);
    671        
    672         if ( (rv != null) && (rv.equals(leaseSet)) ) {
    673             // if it hasn't changed, no need to do anything
    674             return rv;
    675         }
     668        LeaseSet rv = null;
     669        try {
     670            rv = (LeaseSet)_ds.get(key);
     671            if ( (rv != null) && (rv.equals(leaseSet)) ) {
     672                // if it hasn't changed, no need to do anything
     673                return rv;
     674            }
     675        } catch (ClassCastException cce) {}
    676676       
    677677        String err = validate(key, leaseSet);
     
    800800        if (!_initialized) return null;
    801801       
    802         RouterInfo rv = (RouterInfo)_ds.get(key, persist);
    803        
    804         if ( (rv != null) && (rv.equals(routerInfo)) ) {
    805             // no need to validate
    806             return rv;
    807         }
     802        RouterInfo rv = null;
     803        try {
     804            rv = (RouterInfo)_ds.get(key, persist);
     805            if ( (rv != null) && (rv.equals(routerInfo)) ) {
     806                // no need to validate
     807                return rv;
     808            }
     809        } catch (ClassCastException cce) {}
    808810       
    809811        String err = validate(key, routerInfo);
Note: See TracChangeset for help on using the changeset viewer.