Buggy code:
public class RequestGenerator { protected static final Random RANDOM = new Random ( ) ; protected static final Gson GSON = new Gson ( ) ; protected TreeMap < Integer , List < Long > > _propabilities ; protected MutableState _state ; protected long _uId ; protected int _numSkipsSubscriptionRemoval ; protected Configuration _config ; protected RequestComposition _requestComposition ; protected Map < Long , RequestGenerator . User > _users ; public RequestGenerator ( String pathWikiDump , MutableState state , Configuration config ) throws IOException { } protected void loadWikiDump ( String pathWikiDump ) throws IOException { } public Request nextRequest ( RequestType type ) { long idUser ; RequestGenerator . User user ; Subscription subscription ; try { switch ( type ) { case FEED : return BootstrapManager . getFeedRequest ( ) ; case POST : idUser = getRandomUser ( ) ; if ( idUser == 0 ) { return nextRequest ( ) ; } int feedLength = _config . getFeedLength ( ) ; String message = RandomStringUtils . randomAlphanumeric ( feedLength ) ; return new RequestPost ( idUser , message ) ; case FOLLOW : if ( ( ( _uId ) - 1 ) < 2 ) { return nextRequest ( USER ) ; } idUser = getRandomUser ( ) ; long idFollowed = getFollowedUserExisting ( ) ; int numSkips = 0 ; do { idUser = getRandomUser ( ) ; user = getUser ( idUser ) ; if ( numSkips > 1000 ) { return nextRequest ( USER ) ; } numSkips += 1 ; <START_BUG> } while ( ( idUser == idFollowed ) || ( user . hasSubscription ( idFollowed ) ) ) ; <END_BUG> user . addSubscription ( idFollowed ) ; _state . addSubscription ( new Subscription ( idUser , idFollowed ) ) ; return new RequestFollow ( idUser , idFollowed ) ; case UNFOLLOW : int numSubscriptions = _state . getSubscriptions ( ) . size ( ) ; if ( numSubscriptions == 0 ) { ( _numSkipsSubscriptionRemoval ) ++ ; return nextRequest ( ) ; } int iSubscription = 0 ; Iterator < Subscription > iter = _state . getSubscriptions ( ) . iterator ( ) ; for ( int i = 0 ; i < iSubscription ; i ++ ) { iter . next ( ) ; } subscription = iter . next ( ) ; user = getUser ( subscription . getIdSubscriber ( ) ) ; user . removeSubscription ( subscription . getIdFollowed ( ) ) ; _state . removeSubscription ( subscription ) ; return new de . uniko . sebschlicht . socialnet . requests . RequestUnfollow ( subscription . getIdSubscriber ( ) , subscription . getIdFollowed ( ) ) ; case USER : _state . addUser ( _uId ) ; _uId += 1 ; return new RequestUser ( ( ( _uId ) - 1 ) ) ; } throw new IllegalStateException ( "unknown<seq2seq4repair_space>request<seq2seq4repair_space>type" ) ; } catch ( Exception e ) { System . err . println ( ( ( ( e . getMessage ( ) ) + ":<seq2seq4repair_space>" ) + type ) ) ; e . printStackTrace ( ) ; throw e ; } } public Request nextRequest ( ) { } public void mergeRequest ( Request request ) { } protected long getRandomUser ( ) { } protected long getFollowedUser ( ) { } protected long getFollowedUserExisting ( ) { } protected RequestType nextRequestType ( ) { } protected RequestGenerator . User getUser ( long id ) { } protected class User { private TreeSet < Long > _subscriptions ; public User ( ) { } public boolean addSubscription ( long idFollowed ) { } public boolean removeSubscription ( long idFollowed ) { } public TreeSet < Long > getSubscriptions ( ) { } public boolean hasSubscription ( long idFollowed ) { } } }

Fix:
} while ( ( ( idUser == idFollowed ) || ( user == null ) ) || ( user . hasSubscription ( idFollowed ) ) ) ;