Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327904 - NPE when refreshing project with missing source links
Summary: NPE when refreshing project with missing source links
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-15 11:20 EDT by Marvin Fröhlich CLA
Modified: 2010-10-21 09:08 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marvin Fröhlich CLA 2010-10-15 11:20:17 EDT
Build Identifier: 20100617-1415

When I refresh a project (click on it in the project tree and press F5) Eclipse pops up an NPE message, if one of the imported jars (in the Java Build Path) has a source attachment pointing to a project, that doesn't exist.

This was ok in Eclipse 3.5 and prior. The correct behavior should be to either ignore this (as it had been) or pop up a message with a checkbox "don't annoy me again".

I sometimes add source attachments to jars pointing to a project in my workspace, if I checkin the project to SVN. Then other team members won't have the referenced projects in their workspaces, but a jar coming with the project itself. But I want code inside to the linked project.

Reproducible: Always
Comment 1 Dani Megert CLA 2010-10-15 11:41:01 EDT
>pops up an NPE message, 
Stack trace please.
Comment 2 Marvin Fröhlich CLA 2010-10-19 10:46:33 EDT
There is no stack trace. There's just a popup, that tells me about it.
Comment 3 Dani Megert CLA 2010-10-20 03:38:41 EDT
Works fine for me using N20101018-2000. If you can still reproduce with said build or a newer one then please reopen with more detailed steps.
Comment 4 Marvin Fröhlich CLA 2010-10-21 05:13:00 EDT
I have just performed a fresh update of my Eclipse installation. It's not the said version, but "20100917-0705". Without going some beta or even alpha way I cannot have a newer release. The bug still exists there.

I did the following to reproduce the NPE.

1. Create a new Java project "aaa".
2. Create a new Java project "bbb".
3. Open Java Build Path properties of bbb
4. Add a random jar file from the workspace.
5. Expand the build path entry of the imported jar file in bbb.
6. Editor "Source attachment" of this imported jar.
7. Set it to aaa/src.
8. Click ok.
9. Delete project aaa with deleting all the disk contents.
10. Mark project bbb in the Package Explorer and hit F5.

Now a Popup box should be displayed with the following detail information:

########################################
An internal error occurred during: "Refreshing external folders".
java.lang.NullPointerException
########################################
Comment 5 Dani Megert CLA 2010-10-21 05:37:13 EDT
>4. Add a random jar file from the workspace.
This step is impossible to do since after step 1-3 there is not JAR.

I tried with these:
- external JAR
- JAR from another project inside the workspace
- JAR inside bbb

and I also tried with http://download.eclipse.org/eclipse/downloads/drops/R-3.6-201006080911/index.php.

I suspect that you have some additional bundles installed and/or some project(s) in your workspace that cause this. Without more data we can't do anything here.

Either provide exact steps based on an Eclipse SDK + new workspace or remote debug your workspace to find out what's causing the NPE.
Comment 6 Marvin Fröhlich CLA 2010-10-21 05:55:14 EDT
Step 4 is certainly not impossible. I really meant a RANDOM jar file from any project. I guess, you have hundreds of them ;).

I cannot provide more exact steps. The above steps are 100% accurate to reproduce the problem. But I can give you a sample workspace. Grab it here.

http://qudus.de/workspace_refreshing_problem.tar.bz2

1. Switch to this workspace
2. Delete project "aaa" with all contents on the disc.
3. Mark prject "bbb" in the Package Explorer.
4. Press F5.
5. See the error message.
Comment 7 Dani Megert CLA 2010-10-21 09:08:09 EDT
(In reply to comment #6)
> Step 4 is certainly not impossible. I really meant a RANDOM jar file from any
> project. I guess, you have hundreds of them ;).
> 
> I cannot provide more exact steps. The above steps are 100% accurate to
> reproduce the problem. But I can give you a sample workspace. Grab it here.
> 
> http://qudus.de/workspace_refreshing_problem.tar.bz2
> 
> 1. Switch to this workspace
> 2. Delete project "aaa" with all contents on the disc.
> 3. Mark prject "bbb" in the Package Explorer.
> 4. Press F5.
> 5. See the error message.

This works just fine using one of these Eclipse SDK builds:
http://download.eclipse.org/eclipse/downloads/drops/R-3.6-201006080911/index.php
http://download.eclipse.org/eclipse/downloads/drops/R-3.6.1-201009090800/index.php
http://download.eclipse.org/eclipse/downloads/drops/N20101020-2000/index.php

As said before, please only reopen if you can reproduce with an Eclipse SDK build or have more details.