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 96212 - [heapwalker] Display toString() result in Value column for Strings
Summary: [heapwalker] Display toString() result in Value column for Strings
Status: RESOLVED FIXED
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 2 votes (vote)
Assignee: issues@profiler
URL:
Keywords:
: 103380 167924 186659 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-02-21 19:36 UTC by Alexander Kouznetsov
Modified: 2016-11-09 10:59 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Kouznetsov 2007-02-21 19:36:23 UTC
Profiler 070221

Displaying result of toString() method invocation for objects in Fields table of
heap walker could be really useful. While it could be problematic and
non-informative for some objects it is still very useful for basic objects such
as String, Integer, etc.
Comment 1 Tomas Hurka 2007-02-22 06:48:16 UTC
You have only heap dump - no method invocation is possible.
Comment 2 Alexander Kouznetsov 2007-03-14 16:40:59 UTC
For some basic objects such as String, Integer, etc. you don't need to perform
toString() method invocation to get its result. Even implementation of this
feature for String object only could significantly improve usability of
heapwalker. For example, YourKit profiler does have this functionality.
Comment 3 Tomas Hurka 2007-03-14 17:45:24 UTC
Yes, it is possible and we already thought about it, _BUT_ this is something completely different from your 
original description. Last but not least, it an ENHANCEMENT not DEFECT. 
Comment 4 Alexander Kouznetsov 2007-03-14 17:55:39 UTC
It was not set to ENHANCEMENT by mistake. Thanks for catching it. Would you like
if I file one more ENHANCEMENT issue to track this?

BTW, this issue was originally about Strings, and, probably, some more objects.
Comment 5 Alexander Kouznetsov 2007-04-09 13:00:04 UTC
Reopened as an ENHANCEMENT for Strings. 
Comment 6 Alexander Kouznetsov 2007-05-07 08:21:42 UTC
*** Issue 103380 has been marked as a duplicate of this issue. ***
Comment 7 Alexander Kouznetsov 2007-05-07 08:23:21 UTC
From issue 103380:

It will be nice if as many chars from the value of the String as will fit in 
the column sould be shown with a ... which brings up a dialog with a text area 
that shows the full value of the String. This text area should allow copying 
of the text. Without this one has to expand the node which shows children as 
on char per row and is hard to read. Also copy paste of the value is not 
possible.
Comment 8 Tomas Hurka 2009-04-08 10:10:44 UTC
Target milestone cleanup.
Comment 9 Tomas Hurka 2009-04-08 12:53:50 UTC
Milestone cleanup: future->next
Comment 10 Tomas Hurka 2010-05-25 13:03:48 UTC
*** Bug 186659 has been marked as a duplicate of this bug. ***
Comment 11 Jesse Glick 2010-05-25 13:59:50 UTC
Bug #186659 implements this for String.
Comment 12 Jesse Glick 2010-06-08 18:42:59 UTC
Any objections to my applying the patch from bug #186659 in trunk? Would be useful, and seems pretty straightforward.
Comment 13 Tomas Hurka 2010-06-09 07:00:12 UTC
(In reply to comment #12)
> Any objections to my applying the patch from bug #186659 in trunk? Would be
> useful, and seems pretty straightforward.

I would like to solve it in more general way. There are number of other classes, which can have meaningful string representation.
Comment 14 Jesse Glick 2010-06-10 20:38:17 UTC
In a general way, or just for more common types (primitive wrappers, URL, URI, File, StringBuffer/Builder, ...)? The only general solution I can think of would be to look for bytecode of the impl class and try to run its toString method (if any) using a stack-based interpreter. You could limit its features strictly - method calls, field access, object/array construction in a temporary allocation buffer, branches, basic arithmetic ops, and a few other things - but it would still be a fair amount to work unless you used a third-party JVM-in-Java impl such as MJVM.

Alternately, you could try to construct a live mirror of the object and its transitive dependencies in the current JVM, using a ClassLoader offering no permissions, and try to run its toString reflectively. Less safe, and the duplication of data would mean greater heap consumption.
Comment 15 Jiri Sedlacek 2010-09-06 13:54:03 UTC
*** Bug 167924 has been marked as a duplicate of this bug. ***
Comment 16 Jiri Sedlacek 2016-11-09 10:59:51 UTC
Already implemented.