Buggy code:
public class ProxyServer { private static final HarNameVersion CREATOR = new HarNameVersion ( "BrowserMob<seq2seq4repair_space>Proxy" , "2.0" ) ; private static final Logger LOG = LoggerFactory . getLogger ( ProxyServer . class ) ; private Server server ; private int port = - 1 ; private InetAddress localHost ; private BrowserMobHttpClient client ; private StreamManager streamManager ; private HarPage currentPage ; private BrowserMobProxyHandler handler ; private AtomicInteger pageCount = new AtomicInteger ( 1 ) ; private AtomicInteger requestCounter = new AtomicInteger ( 0 ) ; public ProxyServer ( ) { } public ProxyServer ( int port ) { } public void start ( ) { } public Proxy seleniumProxy ( ) throws NameResolutionException { } public void cleanup ( ) { } public void stop ( ) { } public int getPort ( ) { } public void setPort ( int port ) { } public InetAddress getLocalHost ( ) { } public InetAddress getConnectableLocalHost ( ) throws UnknownHostException { } public void setLocalHost ( InetAddress localHost ) { } public Har getHar ( ) { } public Har newHar ( String initialPageRef ) { <START_BUG> pageCount . set ( 1 ) ; <END_BUG> Har oldHar = getHar ( ) ; Har har = new Har ( new net . lightbody . bmp . core . har . HarLog ( ProxyServer . CREATOR ) ) ; client . setHar ( har ) ; newPage ( initialPageRef ) ; return oldHar ; } public void newPage ( String pageRef ) { } public void endPage ( ) { } public void setRetryCount ( int count ) { } public void remapHost ( String source , String target ) { } @ Deprecated public void addRequestInterceptor ( HttpRequestInterceptor i ) { } public void addRequestInterceptor ( RequestInterceptor interceptor ) { } @ Deprecated public void addResponseInterceptor ( HttpResponseInterceptor i ) { } public void addResponseInterceptor ( ResponseInterceptor interceptor ) { } public StreamManager getStreamManager ( ) { } @ Deprecated public void setDownstreamKbps ( long downstreamKbps ) { } @ Deprecated public void setUpstreamKbps ( long upstreamKbps ) { } @ Deprecated public void setLatency ( long latency ) { } public void setRequestTimeout ( int requestTimeout ) { } public void setSocketOperationTimeout ( int readTimeout ) { } public void setConnectionTimeout ( int connectionTimeout ) { } public void autoBasicAuthorization ( String domain , String username , String password ) { } public void rewriteUrl ( String match , String replace ) { } public void clearRewriteRules ( ) { } public void blacklistRequests ( String pattern , int responseCode ) { } public void blacklistRequests ( String pattern , int responseCode , String method ) { } @ Deprecated public List < BlacklistEntry > getBlacklistedRequests ( ) { } public Collection < BlacklistEntry > getBlacklistedUrls ( ) { } public boolean isWhitelistEnabled ( ) { } @ Deprecated public List < Pattern > getWhitelistRequests ( ) { } public Collection < Pattern > getWhitelistUrls ( ) { } public int getWhitelistResponseCode ( ) { } public void clearBlacklist ( ) { } public void whitelistRequests ( String [ ] patterns , int responseCode ) { } public void enableEmptyWhitelist ( int responseCode ) { } public void clearWhitelist ( ) { } public void addHeader ( String name , String value ) { } public void setCaptureHeaders ( boolean captureHeaders ) { } public void setCaptureContent ( boolean captureContent ) { } public void setCaptureBinaryContent ( boolean captureBinaryContent ) { } public void clearDNSCache ( ) { } public void setDNSCacheTimeout ( int timeout ) { } public void waitForNetworkTrafficToStop ( final long quietPeriodInMs , long timeoutInMs ) { } public void setOptions ( Map < String , String > options ) { } }

Fix:
pageCount . set ( 0 ) ;