Changeset d7616467


Ignore:
Timestamp:
Aug 23, 2014 1:16:57 PM (6 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
1bc355b
Parents:
efebecf
Message:

move null check to constructor

Location:
router/java/src/net/i2p/router/peermanager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/peermanager/PeerProfile.java

    refebecf rd7616467  
    4242    //private RateStat _sendSuccessSize = null;
    4343    //private RateStat _receiveSize = null;
    44     private RateStat _dbResponseTime = null;
    45     private RateStat _tunnelCreateResponseTime = null;
    46     private RateStat _tunnelTestResponseTime = null;
    47     private RateStat _dbIntroduction = null;
     44    private RateStat _dbResponseTime;
     45    private RateStat _tunnelCreateResponseTime;
     46    private RateStat _tunnelTestResponseTime;
     47    private RateStat _dbIntroduction;
    4848    // calculation bonuses
    4949    private long _speedBonus;
     
    8181    }
    8282
     83    /**
     84     *  @param peer non-null
     85     */
    8386    public PeerProfile(RouterContext context, Hash peer) {
    8487        this(context, peer, true);
     
    8689
    8790    /**
     91     *  @param peer non-null
    8892     *  @param expand must be true (see below)
    8993     */
    90     public PeerProfile(RouterContext context, Hash peer, boolean expand) {
     94    private PeerProfile(RouterContext context, Hash peer, boolean expand) {
    9195        _context = context;
    9296        _log = context.logManager().getLog(PeerProfile.class);
     97        if (peer == null)
     98            throw new NullPointerException();
    9399        _peer = peer;
    94100        // this is always true, and there are several places in the router that will NPE
     
    103109    }
    104110   
    105     /** what peer is being profiled */
     111    /** what peer is being profiled, non-null */
    106112    public Hash getPeer() { return _peer; }
    107113   
  • router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java

    refebecf rd7616467  
    185185
    186186        Hash peer = profile.getPeer();
    187         if (peer == null) return null;
    188187
    189188        if (_log.shouldLog(Log.DEBUG))
Note: See TracChangeset for help on using the changeset viewer.