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 245854 - NullPointerExcetion or StackOverflowError from ImageUtilities.ToolTipImage.getProperty
Summary: NullPointerExcetion or StackOverflowError from ImageUtilities.ToolTipImage.ge...
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 8.0
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Jaroslav Tulach
URL:
Keywords:
: 246153 248349 252903 (view as bug list)
Depends on:
Blocks: 245824 246193
  Show dependency tree
 
Reported: 2014-07-21 16:47 UTC by Tomas Zezula
Modified: 2015-07-23 13:59 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Possible patch (1.66 KB, patch)
2014-07-21 16:55 UTC, Tomas Zezula
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Zezula 2014-07-21 16:47:45 UTC
The NullPointerExcetion or StackOverflowError is thrown from ImageUtilities.ToolTipImage.getProperty for key "url" when no URL is known.
The NPE is thrown when icon is not yet initialised. The SOE is thrown when it's already initialised.
Comment 1 Tomas Zezula 2014-07-21 16:53:16 UTC
The proposed workaround with:
EXPECTED_ICON == icon
does not work as the DataNode (JavaNode superclass) annotates the icon by fs annotations, so the super call does not return the EXPECTED_ICON.

As the setIconBase() is final the "url" property is only way how to find out that the icon was changed. Another (last resort) solution is to extend the JavaNode API with a boolean specifying if the icons should be computed or not. But this will require to find JN subclasses which set own icon base.
Comment 2 Tomas Zezula 2014-07-21 16:55:07 UTC
Created attachment 148185 [details]
Possible patch

Possible patch
Comment 3 Jaroslav Tulach 2014-07-22 08:49:14 UTC
I can simulate NPE. I don't know how to simulate StackOverflow. What is the order of calls?
Comment 4 Tomas Zezula 2014-07-22 09:01:37 UTC
First you need to call getIcon() to initialise the icon and after then call getProperty("url").
Comment 5 Jaroslav Tulach 2014-07-22 09:11:01 UTC
changeset:   1fd35694ee30
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Jul 22 11:08:18 2014 +0200
summary:     #245854: More sticky 'url' property when composing and altering images


Pull the changeset to have it immediately in your repository.
Comment 6 Tomas Zezula 2014-07-22 09:22:42 UTC
Thanks a lot!
Comment 7 Tomas Zezula 2014-07-22 11:21:22 UTC
Nearly perfect.
But does not work for merged images which is a common case for the DataNode.
The images are merged by the FS.annotateIcon().
Comment 8 Jaroslav Tulach 2014-07-22 11:48:34 UTC
Improved fix per Tomáš's request:

changeset:   ca6f15ae45ee
tag:         tip
parent:      1fd35694ee30
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Jul 22 13:47:14 2014 +0200
summary:     In case of merging of images, keep the URL from the master image
Comment 9 Tomas Zezula 2014-07-22 12:14:31 UTC
Works fine.
Thanks!
Comment 10 Quality Engineering 2014-07-25 02:35:21 UTC
Integrated into 'main-silver', will be available in build *201407250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/1fd35694ee30
User: Jaroslav Tulach <jtulach@netbeans.org>
Log: #245854: More sticky 'url' property when composing and altering images
Comment 11 Svata Dedic 2014-08-01 11:45:06 UTC
*** Bug 246153 has been marked as a duplicate of this bug. ***
Comment 12 Svata Dedic 2014-11-14 17:31:35 UTC
*** Bug 248349 has been marked as a duplicate of this bug. ***
Comment 13 Svata Dedic 2015-07-23 13:59:25 UTC
*** Bug 252903 has been marked as a duplicate of this bug. ***