@Override public void databaseIntegrityTest() throws Exception { checkedActivate(3); IfNull.thenThrow(mID, "mID"); IfNull.thenThrow(mRequestURI, "mRequestURI"); IfNull.thenThrow(mNickname, "mNickname"); IfNotEquals.thenThrow( IdentityID.construct(mID), IdentityID.constructFromURI(mRequestURI), "mID"); try { validateNickname(mNickname); } catch (InvalidParameterException e) { throw new IllegalStateException(e); } if (mLastReceivedFromWoT < 0) throw new IllegalStateException("mLastReceivedFromWoT == " + mLastReceivedFromWoT); }
// TODO: Remove ID parameter and compute the ID from the URI public WoTIdentity(String myID, FreenetURI myRequestURI, String myNickname) { if (myID == null) throw new IllegalArgumentException("ID == null"); if (myID.length() == 0) throw new IllegalArgumentException("ID.length() == 0"); if (myRequestURI == null) throw new IllegalArgumentException("RequestURI == null"); if (myNickname == null) throw new IllegalArgumentException("Nickname == null"); try { validateNickname(myNickname); } catch (InvalidParameterException e) { throw new IllegalArgumentException(e); } mID = myID; mRequestURI = myRequestURI; mNickname = myNickname; mLastReceivedFromWoT = CurrentTimeUTC.getInMillis(); IfNotEquals.thenThrow( IdentityID.construct(mID), IdentityID.constructFromURI(mRequestURI), "myID"); }