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 182321 - Error while opening C/C++ source file
Summary: Error while opening C/C++ source file
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: PC All
: P3 normal (vote)
Assignee: Alexander Simon
URL:
Keywords: USABILITY
Depends on:
Blocks:
 
Reported: 2010-03-18 16:28 UTC by Alexander Pepin
Modified: 2010-04-03 19:53 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pepin 2010-03-18 16:28:58 UTC
If user tries to open C or C++ source file from the project created with a newer version of NB then error window appears with the message:
Error while reading XML from
...
Can not open project version 65 with this IDE. Only versions ....
Comment 1 Thomas Preisler 2010-03-18 18:50:43 UTC
You don't get the error message when opening the (newer) project?
Comment 2 Thomas Preisler 2010-03-24 00:02:18 UTC
Not exactly sure what you mean. I tried a couple of different things and couldn't get it to fail. Here is what I did:

1: open NB 6.9
2: create Welcome project
3: close NB 6.9
4: open NB 6.7
5: create Welcome project
6: open welcome.cc from project created in 2) using File->Open File command.

Everything works as expected. IT doesn't try and open the newer project.

I also tried similar scenario and using Add Existing Item and still no problems.

Will close as WorksForMe. Please reopen with exact steps to reproduce.
Comment 3 Thomas Preisler 2010-03-24 00:04:00 UTC
Not exactly sure what you mean. I tried a couple of different things and couldn't get it to fail. Here is what I did:

1: open NB 6.9
2: create Welcome project
3: close NB 6.9
4: open NB 6.7
5: create Welcome project
6: open welcome.cc from project created in 2) using File->Open File command.

Everything works as expected. IT doesn't try and open the newer project.

I also tried similar scenario and using Add Existing Item and still no problems.

Will close as WorksForMe. Please reopen with exact steps to reproduce.
Comment 4 Alexander Pepin 2010-03-24 15:08:10 UTC
I'm reopening the issue as it's clearly reproducible in nb6.8 patch2.
The steps are the following:
1: open NB 6.9 (trunk)
2: create Welcome project then close the project
3: close NB 6.9
4: open NB 6.8 !!!!
5: open welcome.cc from project created in 2) using File->Open File command.

Result: IDE is not replying for ~10 sec then Error window appears.
I think that it happens because some NB 'infrastructure' is trying to parse the project  containing the file to provide some additional 'facilities' (like source code navigation or something).
Comment 5 Thomas Preisler 2010-03-24 18:30:29 UTC
OK. now I can reproduce. Here is what is going on:

Opening a file from another project using File->Open File triggers a activeProjectChanged event (from NetBeans's project system) and CND is (corretly) trying to add the a property listener to the new project and therefor reading the configuration file. Question is why NetBeans is changing active project just because you open a file in another project. Need to find out. The problem is also in NB 6.9.
Comment 6 Thomas Preisler 2010-03-25 00:36:01 UTC
I investigated this further:

Opening a file with File->Open File triggers the holding project to be created by NetBean's project system. It also changes active configuration. There is really not much we can do here because it is happening deep inside NB's project system. This is usually not a problem but if the project cannot be read (version is too new), then you will see the error message. This is also not really a bug. All you have to do is to dismiss the error message. The editor, code model, and everything else should now behave correctly and thats where I have made a change so it doesn't attach a configuration listener to a broken project. I still see some errors from code model but unsure if it is related to the 'broken' project or something else. 

Here is what I will do:

I will downgrade to P3 since the whole scenario is rather unusual and not very common, and it does seem to work OK.

Have Alexander S. evaluate the problem and see if he can suggest a fix.

Please note that getting the error message about cannot read the project is not a bug. But it is a bug if the IDE doesn't behave correctly after the file has been opened.
Comment 7 Thomas Preisler 2010-03-25 00:45:32 UTC
Here is how you can see the problem in 6.9:

1) create welcome project
2) close project (important)
2) close IDE
3) manually edit and change version number in configuration.xml and private/configuration.xml to something high, for instance 80
4) start IDE again
5) Use File->Open File to open welcome.cc in the project you created in 1). You should now see the error dialog, but file should open just fine. Try different things and you should not see any exception or misbehavior due to the broken project.
Comment 8 Quality Engineering 2010-03-26 05:35:28 UTC
Integrated into 'main-golden', will be available in build *201003260201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/8c659b4ac283
User: Thomas Preisler <thp@netbeans.org>
Log: #182321 Error while opening C/C++ source file
Comment 9 Alexander Pepin 2010-04-03 19:53:25 UTC
needs verification