« IllegalStateException Displayed in the Log Window | Main | JSTL 1.0 in JSP 2.0 Pages »

The debugger only displays the first 100 characters in String variables

Steve writes in a comment:

"(...) if you look at a string in the debugger trace window, it is truncated..
so if you happen to have a very long sql statment in hte string , or cannot view it, or even edit it"

Indeed,
that's correct: as for any array, the debugger will only show 100
elements at a time, for performance reasons, as it may be very
expensive to send an unlimited value from the debuggee process to the
debugger.

So we only display the first 100 characters of a String.
For example, suppose the following code:

(...)
StringBuilder sb = new StringBuilder();

sb.append("This String has exactly 100 characters and you can check that all characters are displayed  in debug");
sb.append("* * *  However this text won't be visible in the Debug Data window * * *");
sb.append("* * *as it's after the limit of the 100 characters * * *");
(...)

In the debugger, you will only see the first 100 characters:

DebugString01:

However, it's possible to see the whole value:
To modify the value, select right-mouse button menu "Modify Value..."

And for what concerns the arrays, you can select menu "Adjust Range..." if you want to display more elements:

DebugString04:


Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on May 25, 2006 12:00 AM.

The previous post in this blog was IllegalStateException Displayed in the Log Window.

The next post in this blog is JSTL 1.0 in JSP 2.0 Pages.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle