This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 178420 - Symlinked project opened as 2 projects
Summary: Symlinked project opened as 2 projects
Status: RESOLVED WONTFIX
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 6.x
Hardware: PC Linux
: P4 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords:
: 182775 (view as bug list)
Depends on:
Blocks: 198997
  Show dependency tree
 
Reported: 2009-12-10 05:53 UTC by Kees Kuip
Modified: 2016-07-07 08:38 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Refactoring disabled after activating subversion plugin (47.56 KB, text/x-log)
2009-12-17 03:16 UTC, Kees Kuip
Details
Refactoring disabled after activating subversion plugin (47.18 KB, text/x-log)
2009-12-17 03:23 UTC, Kees Kuip
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kees Kuip 2009-12-10 05:53:36 UTC
If I enable the subversion plugin the 'call hierarchy' and 'refactor' 
functionality is disabled. (menuchoices are grayed out)

If I then disable subversion plugin both the functionalities work.

I'm using netbeans 6.8 rc2.

Let me know if I can should activate some logging to solve this problem.
Comment 1 Kees Kuip 2009-12-10 06:09:38 UTC
Correction: 'refactor' is not grayed out but it doesn't work!

If I try to rename a method I get the error:
"The Rename refactoring cannot be applied in this context"
Comment 2 Ondrej Vrabec 2009-12-10 06:17:54 UTC
I just tried 6.8rc2 and it works perfectly in the editor. Are you sure you're using the refactoring in the full editor and not e.g. in the subversion diff view (please make a screenshot of the IDE)?
Comment 3 Kees Kuip 2009-12-10 06:44:17 UTC
Sorry, but I seem to be unable to create a screenshot.
But I'm sure that i'm in the editor.
I don't even use the subversion diff. (I only use the annotations functionality)
Comment 4 Kees Kuip 2009-12-10 07:09:04 UTC
I saw in the logging that it fallsback on the commandline svn.
I use "svn, version 1.6.5 (r38866)" on ubuntu.

Subversion works OK because annotations work.

Is there a logger I could activate?
Comment 5 Ondrej Vrabec 2009-12-10 08:05:03 UTC
I can't reproduce and subversion does not call or directly interact with refactoring. The message about fallback to commandline is irrelevant.
Reassigning to java/refactoring for evaluation... Do you have some logger that can be enabled?
Comment 6 Kees Kuip 2009-12-11 08:12:21 UTC
hmmm, bug is also present (for me) in netbeans 6.8
Comment 7 Jan Pokorsky 2009-12-14 07:52:47 UTC
What project type do you use (java application, free-form)?

What exactly are you renaming (class, field, method, ...)?

Is the file declaring the renamed element on the source path?

Please attach your ${nb.user.dir}/var/log/messages.log.* here.

To enable logging use -J-Dorg.netbeans.modules.refactoring.api.impl.ActionsImplementationFactory.level=FINE in ${nb.install.dir}/etc/netbeans.conf or cmd line.
Comment 8 Kees Kuip 2009-12-17 03:16:24 UTC
Created attachment 92699 [details]
Refactoring disabled after activating subversion plugin
Comment 9 Kees Kuip 2009-12-17 03:22:15 UTC
The attachment message.log shows the starting netbeans.

- I start netbeans.
- The editor opens up with the last file I was editing.
- Immediately I try to refactor and rename a method.
- I get the refactor popup.
  (In the logging I see "... canRename: ... true")
- I close the refactor popup.
- In the logging I see "Finished indexing svn cache with 439 entries"
- I try to refactor and rename the SAME method.
- I get an error message that I cannot refactor.
  (In the logging I see "... canRename: ... false") !!
Comment 10 Kees Kuip 2009-12-17 03:23:14 UTC
Created attachment 92700 [details]
Refactoring disabled after activating subversion plugin
Comment 11 Kees Kuip 2009-12-17 03:24:49 UTC
Please ignore the first attachment "Refactoring disabled after activating subversion plugin".

This log also shows the problem but then I had the jvi plugin activated.

The second log shows the problem WITHOUT the jvi plugin.
Comment 12 Kees Kuip 2009-12-17 03:30:28 UTC
Here is a different situation:

- I start netbeans.
- Netbeans start scanning the project.
- During scanning I try to refactor "rename".
- After scanning is ready I get a warning/error popup which says:
  "Cannot refactor /usr/local..../JPAUtil.java this is defined outside of an open project"

So it seems that netbeans thinks the file is 'outside' of an project.
While it is 'inside' the project before enabling the subversion plugin.
Comment 13 Jan Pokorsky 2009-12-17 05:43:51 UTC
Nothing points it somehow relates to svn or jvi plugins for now. What project type do you use (java application, free-form)?

Unfortunately the messages.log does not contain anything what would unveil what is going wrong. Please enable also following loggers and attach the log again here.

org.netbeans.api.project.FileOwnerQuery.level=FINE
org.netbeans.api.java.classpath.ClassPath.level=FINE

Ad "Cannot refactor /usr/local..../JPAUtil.java ..." warning. The message means that the file is not part of any __open__ project. Can you confirm it? When you invoke Ctrl+Shift+1 (Select in project) action inside JPAUtil.java editor does it select the open project?
Comment 14 Kees Kuip 2009-12-17 06:38:23 UTC
Thanks! Ctrl+Shift+1 is the key to the problem!
I got refactoring working again.

What I did is:

- Edit "JPAUtil.java"
- Invoke Ctrl+Shift+1
  A SECOND project "Standard" is opened.
  I now see in the project-tab 2 projects with the same name. (Is this a bug?)
- I close the first project.
- I can refactor in the second project.
Comment 15 Jan Pokorsky 2009-12-17 07:22:03 UTC
I guess it is valid to have 2 projects with same name. They should be located in different folders. Move mouse over project nodes to see the project path.

Closing as fixed. If you have a reproducible test case how to get the IDE to above described state using subversion or whatever else feel free to reopen it.
Comment 16 Kees Kuip 2009-12-17 08:24:01 UTC
I don't have 2 projects!
I have 1 project named "Standard"

But I now know what the 'bug' is!

I have hovered over the 2 projects and I see 2 different paths:
- /usr/local/kees/projecten/Standard/current/netbeans
- /projecten/Standard/current/netbeans.

But "/usr/local/kees/projecten/Standard" is a softlink (ln -s) 
to "/projecten/Standard".
So on disk it is the same location!

It's just a guess but I think netbeans compares the 'path' of a Files.
It should (?) compare the 'canonicalpath' of the Files.
Comment 17 Jan Pokorsky 2009-12-17 08:46:22 UTC
It is a question to projects and filesystem maintainers. Reassigning to evaluate.
Comment 18 Jesse Glick 2009-12-17 10:48:32 UTC
User error; should pick one way to refer to the file tree and stick with it.

Tread carefully here. *Comparing* canonical paths is OK in certain circumstances - for example, issuing a warning if a path is encountered which seems to be a canonical variant of a path stored from some other context. *Storing* canonical paths is never OK, since there may be a good reason to refer to paths with symlink segments (e.g. ~/src expanding to /media/01234567-89ab-cdef-0123-456789abcdef/src).

(FileUtil.normalizeFile can and should be applied to any incoming paths, as this does not attempt to traverse symlinks.)
Comment 19 Kees Kuip 2009-12-18 00:56:04 UTC
> User error; should pick one way to refer to the file tree and stick with it.

I'm not sure what you mean by this.
Are you saying I made an error configuring my project?
How can I prevent this error?
Did you read the complete thread? because this error only occurs when 
the subversion plugin is activated!
Comment 20 Kees Kuip 2009-12-18 01:52:37 UTC
I think I now now what I'm doing wrong.
(By the way: my previous workaround doesn't work!)

I have created the project with the path "/usr/local/kees/projecten/Standard/current/netbeans".
I have opened the project with the symlink "/projecten/Standard/current/netbeans".
Comment 21 Kees Kuip 2009-12-18 02:38:23 UTC
(In reply to comment #20)
> I think I now now what I'm doing wrong.
> (By the way: my previous workaround doesn't work!)
> 
> I have created the project with the path
> "/usr/local/kees/projecten/Standard/current/netbeans".
> I have opened the project with the symlink
> "/projecten/Standard/current/netbeans".

So the workaround is:
- Open the project with the same path as when you created the project.
(Would be nice though that this wasn't necessary)

Thanks all!
Comment 22 Jesse Glick 2009-12-18 09:52:24 UTC
(In reply to comment #21)
> So the workaround is:
> Open the project with the same path as when you created the project.

Right.

> Would be nice though that this wasn't necessary

Or that the IDE would at least give a clear indication of what you need to do differently.
Comment 23 Antonin Nebuzelsky 2010-03-29 14:11:31 UTC
Change of default owner.
Comment 24 Jesse Glick 2010-04-08 21:17:04 UTC
*** Bug 182775 has been marked as a duplicate of this bug. ***
Comment 25 Martin Balin 2016-07-07 08:38:08 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss