eirikbakke commented on code in PR #8171:
URL: https://github.com/apache/netbeans/pull/8171#discussion_r1921888829


##########
ide/projectui/src/org/netbeans/modules/project/ui/ProjectUtilities.java:
##########
@@ -135,28 +130,25 @@ private void doClose(Project[] projects, boolean 
notifyUI, Wrapper wr) {
                 if (dobj != null) {
                     FileObject fobj = dobj.getPrimaryFile();
                     Project owner = 
ProjectConvertors.getNonConvertorOwner(fobj);
-                    ERR.log(Level.FINER, "Found {0} owned by {1} in {2} of 
{3}", new Object[] {fobj, owner, tc.getName(), tc.getClass()});
+                    LOG.log(Level.FINER, "Found {0} owned by {1} in {2} of 
{3}", new Object[] {fobj, owner, tc.getName(), tc.getClass()});
 
-                    if (listOfProjects.contains(owner)) {
+                    if (owner != null && listOfProjects.contains(owner)) {
                         if (notifyUI) {
                             openFiles.add(dobj);
                             tc2close.add(tc);
                         } else if (!dobj.isModified()) {
                             // when not called from UI, only include TCs that 
arenot modified
                             tc2close.add(tc);
                         }
-                        //#235897 split a single line to detect NPE better
-                        final Set<String> pwnr = wr.urls4project.get(owner);
-                        assert pwnr != null : "Owner project for file:" + fobj 
+ " prj:" + owner;
-                        final FileObject pf = fobj;
-                        assert pf != null;
-                        URL u = pf.toURL();
-                        assert u != null;
-                        String uex = u.toExternalForm();                       
 
-                        pwnr.add(uex);
+                        Set<String> files = project2FilesMap.get(owner);
+                        if (files != null) {
+                            files.add(fobj.toURL().toExternalForm());
+                        } else {
+                            LOG.log(Level.WARNING, "project accociation lost, 
project ({1}) might lose an opened file ({2}) on reopen", new Object[] {owner, 
fobj});

Review Comment:
   typo: association



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to