simulator: guard window-bounds prefs against corruption from Larger Text scaling#4935
Merged
Merged
Conversation
…ext scaling Picking Simulate -> Larger Text -> Extra Extra Extra Large (and the larger Accessibility steps) could collapse the simulator frame; refreshSkin()'s pack() produced an unusably small geometry that the existing componentResized listener wrote straight into prefs. The next launch restored the bad bounds, leaving the window stuck. Add a shared validator (JavaSEPort.isUsableWindowBounds) used on both write and read sides to reject degenerate, oversize, or off-screen rectangles, and extract parsePersistedBounds so a malformed pref no longer aborts init() with a NumberFormatException. On read, corrupt entries are removed so a single bad event does not survive across launches. AppPanel applies the same guards to its per-panel preferredWindowBounds keys. Adds JavaSEPortWindowBoundsTest covering null/tiny/huge/off-screen inputs, parse rejection of malformed strings, and a write/parse roundtrip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Compared 16 screenshots: 16 matched. |
Contributor
✅ Continuous Quality ReportTest & Coverage
Static Analysis
Generated automatically by the PR CI workflow. |
Collaborator
Author
|
Compared 106 screenshots: 106 matched. Benchmark Results
Build and Run Timing
Detailed Performance Metrics
|
Collaborator
Author
|
Compared 106 screenshots: 106 matched. Native Android coverage
✅ Native Android screenshot tests passed. Native Android coverage
Benchmark ResultsDetailed Performance Metrics
|
Collaborator
Author
Collaborator
Author
|
Compared 7 screenshots: 7 matched. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
refreshSkin()'spack()produced an unusably small geometry that the existingcomponentResizedlistener wrote straight into prefs. Every subsequent launch restored the bad bounds, leaving the window stuck.JavaSEPort.isUsableWindowBounds(Rectangle), used on both write and read paths, that rejects null/degenerate/oversize rectangles and frames without a meaningful on-screen overlap.parsePersistedBounds(String)so a malformedwindow.boundspref no longer abortsinit()with aNumberFormatException. Corrupt entries are removed on read so a single bad event cannot survive across launches.AppPanel's per-panelpreferredWindowBounds.{x,y,width,height}keys.Test plan
mvn -pl javase clean compile -Plocal-dev-javase-> BUILD SUCCESSmvn -pl javase test -Dtest=JavaSEPortWindowBoundsTest-> 15/15 pass (collapsed frame, just-below-floor, absurd size, sliver-on-screen, far-off-screen, malformed prefs, whitespace, negative origin, write/parse roundtrip)window.boundspref to0,0,5,5(or to a malformed value) and confirm the next launch falls back cleanly and clears the entry🤖 Generated with Claude Code