Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 187410 - Cancelling 'Scan for updates' causes NPE on subsequent scans
Summary: Cancelling 'Scan for updates' causes NPE on subsequent scans
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Update (deprecated - use Eclipse>Equinox>p2) (show other bugs)
Version: 3.3   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: 3.4   Edit
Assignee: Platform-Update-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-16 18:29 EDT by Nick Boldt CLA
Modified: 2009-06-18 16:40 EDT (History)
3 users (show)

See Also:


Attachments
Added more checks for in!=null - should do it. (2.22 KB, patch)
2007-05-22 18:48 EDT, Dejan Glozic CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Boldt CLA 2007-05-16 18:29:27 EDT
First, configure your eclipse as in bug 187406. I've tested this with and without GMF installed -- the latest failure was reproduced using a simpler set of installed features:

* EMF SDK, OCL runtime, QTV runtime, UML2 runtime
  -- or --
* EMF runtime, Mylar task list, Mylar Bugzilla Connector

Then:

1. Help > Software Updates > Manage Configuration
2. Expand install location where features are installed (I put everything in the base eclipse install folder)
3. select Eclipse Project
4. click 'Scan for Updates'. choose a mirror (such as IBM RTP (because it's slow)): "No updates for the currently installed feature(s) found, try again later." [OK] 

(So far, so good.)

5. Click OK on the 'No updates...' dialog. Choose another feature, like EMF. This time, click 'Scan for Updates', choose a mirror, and hit the cancel button in the bottom-right corner of the wizard before it has a chance to report 'no updates available'. You'll get the above dialog again. 

6. Choose yet another feature, and hit 'Scan for Updates' -- now, you get a NPE: "An internal error occurred during: "Update Manager". java.lang.NullPointerException"

Restarting the Help > Software Updates > Manage Configuration dialog makes this problem go away, so I'm marking this minor. I'd mark it "Usability police fine you $50 for bad behavior when cancelling an update scan" but that's not an option. ;-)

Here's the console log, FWIW:

!SESSION 2007-05-16 18:18:57.927 -----------------------------------------------
eclipse.buildId=I20070503-1400
java.fullversion=J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20060504 (JIT enabled)
J9VM - 20060501_06428_lHdSMR
JIT  - 20060428_1800_r8
GC   - 20060501_AA
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -startup /home/nickb/eclipse/m7clean/eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070502.jar
Command-line arguments:  -os linux -ws gtk -arch x86 -startup /home/nickb/eclipse/m7clean/eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070502.jar -data /tmp/workspace-clean -consolelog

!ENTRY org.eclipse.core.jobs 4 2 2007-05-16 18:24:39.090
!MESSAGE An internal error occurred during: "Update Manager".
!STACK 0
java.lang.NullPointerException
        at java.io.FilterInputStream.close(FilterInputStream.java:182)
        at org.eclipse.update.internal.core.connection.HttpResponse$MonitoringInputStream.close(HttpResponse.java:53)
        at org.eclipse.update.internal.core.SiteURLFactory.createSite(SiteURLFactory.java:97)
        at org.eclipse.update.internal.core.InternalSiteManager.createSite(InternalSiteManager.java:334)
        at org.eclipse.update.internal.core.InternalSiteManager.createSite(InternalSiteManager.java:326)
        at org.eclipse.update.internal.core.InternalSiteManager.createSite(InternalSiteManager.java:291)
        at org.eclipse.update.internal.core.InternalSiteManager.attemptCreateSite(InternalSiteManager.java:222)
        at org.eclipse.update.internal.core.InternalSiteManager.getSite(InternalSiteManager.java:162)
        at org.eclipse.update.core.SiteManager.getSite(SiteManager.java:80)
        at org.eclipse.update.search.UpdateSearchRequest.searchOneSite(UpdateSearchRequest.java:452)
        at org.eclipse.update.search.UpdateSearchRequest.performSearch(UpdateSearchRequest.java:299)
        at org.eclipse.update.ui.UpdateJob.runUpdates(UpdateJob.java:207)
        at org.eclipse.update.ui.UpdateJob.run(UpdateJob.java:168)
        at org.eclipse.update.internal.ui.views.FindUpdatesAction$TrackedUpdateJob.run(FindUpdatesAction.java:93)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Comment 1 Dejan Glozic CLA 2007-05-16 18:45:00 EDT
I have seen this before. I can easily check for the input stream being null before calling 'super.close()'.
Comment 2 Dejan Glozic CLA 2007-05-17 10:36:24 EDT
I added an NULL check while fixing bug 132450. Please retry with the next valid 3.3RC1 build.
Comment 3 Nick Boldt CLA 2007-05-22 12:36:51 EDT
Verification/testing prevented by bug 188375.
Comment 4 Nick Boldt CLA 2007-05-22 13:22:35 EDT
(In reply to comment #2)
> I added an NULL check while fixing bug 132450. Please retry with the next valid
> 3.3RC1 build.

Scenario reported has been fixed. However, I found another way to throw an NPE. (Sorry.)

As in the steps above, do 1 - 4. Then:

5. Click OK on the 'No updates...' dialog. Choose another feature.
This time, click 'Scan for Updates', and hit the cancel button in the bottom-right corner of the wizard BEFORE it has a chance to present the dialog for choosing a mirror. You'll get this:

!SESSION 2007-05-22 13:14:29.560 -----------------------------------------------
eclipse.buildId=I20070517-1700
java.fullversion=J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223-20060504 (JIT enabled)
J9VM - 20060501_06428_lHdSMR
JIT  - 20060428_1800_r8
GC   - 20060501_AA
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -startup /home/nickb/eclipse/rc1clean/eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070516.jar
Command-line arguments:  -os linux -ws gtk -arch x86 -startup /home/nickb/eclipse/rc1clean/eclipse/plugins/org.eclipse.equinox.launcher_1.0.0.v20070516.jar -data /tmp/workspace-clean-rc1 -consolelog

!ENTRY org.eclipse.core.jobs 4 2 2007-05-22 13:16:30.792
!MESSAGE An internal error occurred during: "Update Manager".
!STACK 0
java.lang.NullPointerException
        at java.io.FilterInputStream.read(FilterInputStream.java:89)
        at org.eclipse.update.internal.core.connection.HttpResponse$MonitoringInputStream.read(HttpResponse.java:64)
        at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.read(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
        at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
        at org.eclipse.update.core.model.DefaultSiteParser.parse(DefaultSiteParser.java:152)
        at org.eclipse.update.core.model.SiteModelFactory.parseSite(SiteModelFactory.java:81)
        at org.eclipse.update.internal.core.SiteURLFactory.createSite(SiteURLFactory.java:80)
        at org.eclipse.update.internal.core.InternalSiteManager.createSite(InternalSiteManager.java:334)
        at org.eclipse.update.internal.core.InternalSiteManager.createSite(InternalSiteManager.java:326)
        at org.eclipse.update.internal.core.InternalSiteManager.createSite(InternalSiteManager.java:291)
        at org.eclipse.update.internal.core.InternalSiteManager.attemptCreateSite(InternalSiteManager.java:222)
        at org.eclipse.update.internal.core.InternalSiteManager.getSite(InternalSiteManager.java:162)
        at org.eclipse.update.core.SiteManager.getSite(SiteManager.java:80)
        at org.eclipse.update.search.UpdateSearchRequest.searchOneSite(UpdateSearchRequest.java:452)
        at org.eclipse.update.search.UpdateSearchRequest.searchOneSite(UpdateSearchRequest.java:481)
        at org.eclipse.update.search.UpdateSearchRequest.performSearch(UpdateSearchRequest.java:299)
        at org.eclipse.update.ui.UpdateJob.runUpdates(UpdateJob.java:207)
        at org.eclipse.update.ui.UpdateJob.run(UpdateJob.java:168)
        at org.eclipse.update.internal.ui.views.FindUpdatesAction$TrackedUpdateJob.run(FindUpdatesAction.java:93)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Comment 5 Dejan Glozic CLA 2007-05-22 18:46:39 EDT
Sigh... We need more checks for in!=null.
Comment 6 Dejan Glozic CLA 2007-05-22 18:48:20 EDT
Created attachment 68232 [details]
Added more checks for in!=null - should do it.
Comment 7 DJ Houghton CLA 2007-05-23 08:29:26 EDT
Dejan, I get conflicts when I try to apply this patch to HEAD.
Comment 8 DJ Houghton CLA 2007-05-24 09:36:43 EDT
Also note that you need 2 people to review the patch for RC2.
Comment 9 Eric Rizzo CLA 2009-03-30 09:51:52 EDT
Is this old issue still relevant in the p2 "new world?"
Comment 10 Pascal Rapicault CLA 2009-03-30 11:50:33 EDT
No
Comment 11 John Arthorne CLA 2009-06-18 16:40:23 EDT
From code inspection I see this latest patch was indeed applied prior to 3.4.