Repository navigation
JPDA: Fix Save Value to File for large debugger strings - #9635
Conversation
| return this.shortendString; | ||
| } | ||
|
|
||
| public int getShortendLength() { |
There was a problem hiding this comment.
I think this is a typo. It is "shortened" according to my dictionary.
| meth public int getShortendLength() | ||
| meth public java.io.Reader getContent() | ||
| meth public java.lang.String getFullString() | ||
| meth public java.lang.String getShortendString() |
There was a problem hiding this comment.
- must these methods appear in API changes list?
- I guess they have to as they are accessed from a different package
- and this package is listed as API
- can only one of the methods be added?
- seems to me
getShortenedString().length()would be sufficient
- seems to me
| String str = ShortenedStrings.getStringWithLengthControl(sr); | ||
| Object stringData = ShortenedStrings.getStringWithLengthControl(sr); | ||
| String str; | ||
| if(stringData instanceof ShortenedStrings.StringInfo si) { |
| string = shortedString; | ||
| StringInfo si = new StringInfo(sr, shortedString, stringLength, sa, backingEncoding, isLittleEndian); | ||
| synchronized (stringCache) { | ||
| stringCache.put(sr, si); |
There was a problem hiding this comment.
- multiple threads can be running this
stringCache.put(sr, si)code - for the same
sr, but differentsi- that was also the old behavior, it is not changed by this PR
- I guess that doesn't matter
- at most the
StringInfois constructed multiple times in parallel
- at most the
|
@jtulach thanks for the review.
|
|
|
|
For the question compatible change or not: This change is not compatible. I removed For the retrieval logic/sychronization pattern: I agree that a different approach might be better, but a quick rewrite did not yield more readable code so I opted to go minimal. The InterruptedException id now not swallowed anymore but passed to the caller. The callers already have to deal with retrieval problems and thus are the correct place to handle this. (Pushed as update) |
|
@entlicher would you mind having a look at this? According to the class javadoc you were the original author of |
|
I intent to merge this on monday unless objections are raised. |
While debugging with JPDA NetBeans makes strings directly available as long as they are shorter than 100000 characters. Longer strings are truncated to that length. The full string can be made available on demand and saved to a file. Before this change the truncated string was used as a key in a WeakHashmap that held the data required to fetch the full string. This causes problems: - it was observed that the contents of the WeakHashMap was collected to early, rendering the full string inaccessible - the truncated string might not be unique, which might result in crosstalk between strings displays This change switch from providing truncated strings to consumers to providing as StringInfo object that not only holds the shorted string, but also all the info that is required to fetch the full string. The caching that was done based on the shorted string was switched to StringReferences as keys, which are documented to be equal when the backing VM and string are identical.
f049a4e to
548944f
Compare
|
Squashed were done as announced and Tests for the |
While debugging with JPDA NetBeans makes strings directly available as long as they are shorter than 100000 characters. Longer strings are truncated to that length.
The full string can be made available on demand and saved to a file.
Before this change the truncated string was used as a key in a WeakHashmap that held the data required to fetch the full string. This causes problems:
it was observed that the contents of the WeakHashMap was collected to early, rendering the full string inaccessible
the truncated string might not be unique, which might result in crosstalk between strings displays
This change switch from providing truncated strings to consumers to providing as StringInfo object that not only holds the shorted string, but also all the info that is required to fetch the full string.
The caching that was done based on the shorted string was switched to StringReferences as keys, which are documented to be equal when the backing VM and string are identical.