Buggy code:
public abstract class AbstractWebappDeployer extends AbstractDeployer { private static final Log log = LogFactory . getLog ( AbstractWebappDeployer . class ) ; protected String webappsDir ; protected String extension ; protected TomcatGenericWebappsDeployer tomcatWebappDeployer ; protected final List < WebContextParameter > servletContextParameters = new ArrayList < WebContextParameter > ( ) ; protected ConfigurationContext configContext ; protected AxisConfiguration axisConfig ; protected Map < String , WebApplicationsHolder > webApplicationsHolderMap ; private boolean isGhostOn ; private String [ ] defaultWatchedResources ; public void init ( ConfigurationContext configCtx ) { this . configContext = configCtx ; this . axisConfig = configCtx . getAxisConfiguration ( ) ; String repoPath = configCtx . getAxisConfiguration ( ) . getRepository ( ) . getPath ( ) ; File webappsDirFile = new File ( ( ( repoPath + ( File . separator ) ) + ( webappsDir ) ) ) ; if ( ( ! ( webappsDirFile . exists ( ) ) ) && ( ! ( webappsDirFile . mkdirs ( ) ) ) ) { AbstractWebappDeployer . log . warn ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>create<seq2seq4repair_space>directory<seq2seq4repair_space>" + ( webappsDirFile . getAbsolutePath ( ) ) ) ) ; } PrivilegedCarbonContext privilegedCarbonContext = PrivilegedCarbonContext . getThreadLocalCarbonContext ( ) ; int tenantId = privilegedCarbonContext . getTenantId ( ) ; String tenantDomain = privilegedCarbonContext . getTenantDomain ( ) ; String webContextPrefix = ( ( tenantDomain != null ) && ( ! ( SUPER_TENANT_DOMAIN_NAME . equals ( tenantDomain ) ) ) ) ? ( ( ( ( ( "//" + ( MultitenantConstants . TENANT_AWARE_URL_PREFIX ) ) + "//" ) + tenantDomain ) + "//" ) + ( this . webappsDir ) ) + "//" : "" ; webApplicationsHolderMap = ( ( Map < String , WebApplicationsHolder > ) ( configCtx . getProperty ( WEB_APPLICATIONS_HOLDER_LIST ) ) ) ; if ( ( webApplicationsHolderMap ) == null ) { webApplicationsHolderMap = new HashMap < String , WebApplicationsHolder > ( ) ; configCtx . setProperty ( WEB_APPLICATIONS_HOLDER_LIST , webApplicationsHolderMap ) ; } <START_BUG> if ( ! ( webApplicationsHolderMap . containsKey ( webappsDir ) ) ) { <END_BUG> WebApplicationsHolder webApplicationsHolder = new WebApplicationsHolder ( new File ( webappsDir ) ) ; webApplicationsHolderMap . put ( webappsDir , webApplicationsHolder ) ; } tomcatWebappDeployer = createTomcatGenericWebappDeployer ( webContextPrefix , tenantId , tenantDomain ) ; configCtx . setProperty ( SERVLET_CONTEXT_PARAMETER_LIST , servletContextParameters ) ; isGhostOn = GhostDeployerUtils . isGhostOn ( ) ; defaultWatchedResources = new String [ ] { ( "WEB-INF" + ( File . separator ) ) + "web.xml" , ( "WEB-INF" + ( File . separator ) ) + "lib" , ( "WEB-INF" + ( File . separator ) ) + "classes" } ; } protected abstract TomcatGenericWebappsDeployer createTomcatGenericWebappDeployer ( String webContextPrefix , int tenantId , String tenantDomain ) { } protected abstract String getType ( ) { } public void deploy ( DeploymentFileData deploymentFileData ) throws DeploymentException { } private void deployThisWebApp ( DeploymentFileData deploymentFileData ) throws DeploymentException { } public void undeploy ( String fileName ) throws DeploymentException { } private boolean isWatchedResourceChanged ( String fileName , File file ) { } private Context getWebappContext ( File file ) { } @ Override public void cleanup ( ) throws DeploymentException { } private void persistWebappMetadata ( WebApplication webApplication , AxisConfiguration axisConfig ) throws AxisFault , ArtifactMetadataException { } private boolean isSkippedWebapp ( File webappFile ) { } private boolean isHotUpdating ( File file ) { } private void handleUndeployment ( String fileName , File webappToUndeploy ) throws DeploymentException { } public boolean isExistingFaultyApp ( String filePath ) { } private boolean isInsideAnotherApp ( String path ) { } private String generateMetaFileDirName ( String webappFilePath ) { } protected void handleRedeployment ( File file ) throws DeploymentException { } }

Fix:
if ( ( ! ( webApplicationsHolderMap . containsKey ( webappsDir ) ) ) && ( appBases . contains ( webappsDir ) ) ) {