Buggy code:
public final class Settings implements IAjaxSettings , IApplicationSettings , IDebugSettings , IExceptionSettings , IFrameworkSettings , IMarkupSettings , IPageSettings , IRequestCycleSettings , IResourceSettings , ISecuritySettings , ISessionSettings { private boolean ajaxDebugModeEnabled = false ; private boolean stripWicketTags = false ; private boolean stripXmlDeclarationFromOutput ; private Class < ? extends Page > accessDeniedPage ; private Application application ; private IAuthorizationStrategy authorizationStrategy = IAuthorizationStrategy . ALLOW_ALL ; private boolean automaticLinking = false ; private boolean bufferResponse = true ; private IClassResolver classResolver = new DefaultClassResolver ( ) ; private List < IComponentResolver > componentResolvers = new ArrayList < IComponentResolver > ( ) ; private boolean componentUseCheck = true ; private boolean compressWhitespace = false ; private CookieValuePersisterSettings cookieValuePersisterSettings = new CookieValuePersisterSettings ( ) ; private ICryptFactory cryptFactory ; private String defaultAfterDisabledLink = "<//em>" ; private String defaultBeforeDisabledLink = "<em>" ; private Locale defaultLocale = Locale . getDefault ( ) ; private String defaultMarkupEncoding ; private Class < ? extends Page > internalErrorPage ; private Localizer localizer ; private IMarkupParserFactory markupParserFactory ; private int maxPageMaps = 5 ; private int maxPageVersions = Integer . MAX_VALUE ; private Map < String , IResourceFactory > nameToResourceFactory = new HashMap < String , IResourceFactory > ( ) ; private boolean overriddenStringResourceLoaders = false ; private Class < ? extends Page > pageExpiredErrorPage ; private IPageFactory pageFactory = new DefaultPageFactory ( ) ; private IPageMapEvictionStrategy pageMapEvictionStrategy = new LeastRecentlyAccessedEvictionStrategy ( 5 ) ; private IPropertiesFactory propertiesFactory ; private RenderStrategy renderStrategy = RenderStrategy . REDIRECT_TO_BUFFER ; private IResourceFinder resourceFinder = new Path ( ) ; private Duration resourcePollFrequency = null ; private IResourceStreamLocator resourceStreamLocator ; private ModificationWatcher resourceWatcher ; private List < IResponseFilter > responseFilters ; private ICoverterLocatorFactory converterFactory ; private String responseRequestEncoding = "UTF-8" ; private List < IStringResourceLoader > stringResourceLoaders = new ArrayList < IStringResourceLoader > ( 4 ) ; private boolean stripComments = false ; private boolean throwExceptionOnMissingResource = true ; private UnexpectedExceptionDisplay unexpectedExceptionDisplay = UnexpectedExceptionDisplay . SHOW_EXCEPTION_PAGE ; private boolean useDefaultOnMissingResource = true ; private boolean versionPagesByDefault = true ; private String contextPath ; private boolean automaticMultiWindowSupport = true ; private boolean gatherExtendedBrowserInfo = false ; private IUnauthorizedComponentInstantiationListener unauthorizedComponentInstantiationListener = new IUnauthorizedComponentInstantiationListener ( ) { public void onUnauthorizedInstantiation ( final Component component ) { } } ; public Settings ( final Application application ) { } public void addComponentResolver ( IComponentResolver resolver ) { } public void addResourceFactory ( final String name , IResourceFactory resourceFactory ) { } public void addResourceFolder ( final String resourceFolder ) { } public void addResponseFilter ( IResponseFilter responseFilter ) { } public void addStringResourceLoader ( final IStringResourceLoader loader ) { } public Class < ? extends Page > getAccessDeniedPage ( ) { } public IAuthorizationStrategy getAuthorizationStrategy ( ) { } public boolean getAutomaticLinking ( ) { } public boolean getBufferResponse ( ) { } public IClassResolver getClassResolver ( ) { } public List < IComponentResolver > getComponentResolvers ( ) { } public boolean getComponentUseCheck ( ) { } public boolean getCompressWhitespace ( ) { } public String getContextPath ( ) { <START_BUG> if ( ( ( contextPath ) == null ) && ( ( RequestCycle . get ( ) . getRequest ( ) ) instanceof WebRequest ) ) { <END_BUG> contextPath = ( ( WebRequest ) ( RequestCycle . get ( ) . getRequest ( ) ) ) . getContextPath ( ) ; } return contextPath ; } public ICoverterLocatorFactory getConverterSupplierFactory ( ) { } public CookieValuePersisterSettings getCookieValuePersisterSettings ( ) { } public synchronized ICryptFactory getCryptFactory ( ) { } public String getDefaultAfterDisabledLink ( ) { } public String getDefaultBeforeDisabledLink ( ) { } public Locale getDefaultLocale ( ) { } public String getDefaultMarkupEncoding ( ) { } public boolean getGatherExtendedBrowserInfo ( ) { } public Class < ? extends Page > getInternalErrorPage ( ) { } public Localizer getLocalizer ( ) { } public IMarkupParserFactory getMarkupParserFactory ( ) { } public final int getMaxPageMaps ( ) { } public int getMaxPageVersions ( ) { } public Class < ? extends Page > getPageExpiredErrorPage ( ) { } public IPageFactory getPageFactory ( ) { } public IPageMapEvictionStrategy getPageMapEvictionStrategy ( ) { } public IPropertiesFactory getPropertiesFactory ( ) { } public IRequestCycleSettings . RenderStrategy getRenderStrategy ( ) { } public IResourceFactory getResourceFactory ( final String name ) { } public IResourceFinder getResourceFinder ( ) { } public Duration getResourcePollFrequency ( ) { } public IResourceStreamLocator getResourceStreamLocator ( ) { } public ModificationWatcher getResourceWatcher ( boolean start ) { } public List < IResponseFilter > getResponseFilters ( ) { } public String getResponseRequestEncoding ( ) { } public List < IStringResourceLoader > getStringResourceLoaders ( ) { } public boolean getStripComments ( ) { } public boolean getStripWicketTags ( ) { } public boolean getStripXmlDeclarationFromOutput ( ) { } public boolean getThrowExceptionOnMissingResource ( ) { } public IUnauthorizedComponentInstantiationListener getUnauthorizedComponentInstantiationListener ( ) { } public UnexpectedExceptionDisplay getUnexpectedExceptionDisplay ( ) { } public boolean getUseDefaultOnMissingResource ( ) { } public boolean getVersionPagesByDefault ( ) { } public void setAccessDeniedPage ( Class < ? extends Page > accessDeniedPage ) { } public void setAuthorizationStrategy ( IAuthorizationStrategy strategy ) { } public void setAutomaticLinking ( boolean automaticLinking ) { } public void setBufferResponse ( boolean bufferResponse ) { } public void setClassResolver ( final IClassResolver defaultClassResolver ) { } public void setComponentUseCheck ( final boolean componentUseCheck ) { } public void setCompressWhitespace ( final boolean compressWhitespace ) { } public void setContextPath ( String contextPath ) { } public void setConverterSupplierFactory ( ICoverterLocatorFactory factory ) { } public void setCookieValuePersisterSettings ( CookieValuePersisterSettings cookieValuePersisterSettings ) { } public void setCryptFactory ( ICryptFactory cryptFactory ) { } public void setDefaultAfterDisabledLink ( final String defaultAfterDisabledLink ) { } public void setDefaultBeforeDisabledLink ( String defaultBeforeDisabledLink ) { } public void setDefaultLocale ( Locale defaultLocale ) { } public void setDefaultMarkupEncoding ( final String encoding ) { } public void setGatherExtendedBrowserInfo ( boolean gatherExtendedBrowserInfo ) { } public void setInternalErrorPage ( final Class < ? extends Page > internalErrorPage ) { } public void setMarkupParserFactory ( IMarkupParserFactory factory ) { }

Fix:
if ( ( ( ( contextPath ) == null ) && ( ( RequestCycle . get ( ) ) != null ) ) && ( ( RequestCycle . get ( ) . getRequest ( ) ) instanceof WebRequest ) ) {