diff --git a/autoproject.web/src/org/netbeans/modules/autoproject/web/WebModuleProviderImpl.java b/autoproject.web/src/org/netbeans/modules/autoproject/web/WebModuleProviderImpl.java --- a/autoproject.web/src/org/netbeans/modules/autoproject/web/WebModuleProviderImpl.java +++ b/autoproject.web/src/org/netbeans/modules/autoproject/web/WebModuleProviderImpl.java @@ -64,6 +64,7 @@ private static final Logger LOG = Logger.getLogger(WebModuleProviderImpl.class.getName()); private static final Map> webModules = new WeakHashMap>(); + private static final Map webModulesWithoutDocRoot = new WeakHashMap(); private Project p; private String root; @@ -81,30 +82,32 @@ assert p.equals(FileOwnerQuery.getOwner(file)); String docBaseFolders = Cache.get(root + WebCacheConstants.DOCROOT); - if (docBaseFolders == null) { - return null; - } FileObject docRoot = null; - for (String piece : docBaseFolders.split("[:;]")) { - FileObject aRoot = FileUtil.toFileObject(new File(piece)); - if (aRoot != null && (FileUtil.isParentOf(aRoot, file) || aRoot == file)) { - docRoot = aRoot; - break; + if (docBaseFolders != null) { + for (String piece : docBaseFolders.split("[:;]")) { + FileObject aRoot = FileUtil.toFileObject(new File(piece)); + if (aRoot != null && (FileUtil.isParentOf(aRoot, file) || aRoot == file)) { + docRoot = aRoot; + break; + } } } if (docRoot == null) { LOG.log(Level.FINE, "Found no docroot for {0} in {1}", new Object[] {file, p.getProjectDirectory()}); - return null; } Map projectWebModules = webModules.get(p); if (projectWebModules == null) { projectWebModules = new HashMap(); webModules.put(p, projectWebModules); } - WebModule wm = projectWebModules.get(docRoot); + WebModule wm = docRoot != null ? projectWebModules.get(docRoot) : webModulesWithoutDocRoot.get(p); if (wm == null) { wm = WebModuleFactory.createWebModule(new WebModuleImpl(docRoot, root, cpp, this)); - projectWebModules.put(docRoot, wm); + if (docRoot != null) { + projectWebModules.put(docRoot, wm); + } else { + webModulesWithoutDocRoot.put(p, wm); + } } return wm; } @@ -113,20 +116,17 @@ public J2eeModule getJ2eeModule() { if (j2eeModule == null) { String docBaseFolders = Cache.get(root + WebCacheConstants.DOCROOT); - if (docBaseFolders == null) { - return null; - } FileObject docRoot = null; - for (String piece : docBaseFolders.split("[:;]")) { - FileObject aRoot = FileUtil.toFileObject(new File(piece)); - if (aRoot != null) { - docRoot = aRoot; - break; + if (docBaseFolders != null) { + for (String piece : docBaseFolders.split("[:;]")) { + FileObject aRoot = FileUtil.toFileObject(new File(piece)); + if (aRoot != null) { + docRoot = aRoot; + break; + } } } - if (docRoot != null) { - j2eeModule = J2eeModuleFactory.createJ2eeModule(new WebModuleImpl(docRoot, root, cpp, this)); - } + j2eeModule = J2eeModuleFactory.createJ2eeModule(new WebModuleImpl(docRoot, root, cpp, this)); } return j2eeModule; }