Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8170794: [macosx] Error when using setDesktopManager on a JDesktopPane on MacOS X with Look and Feel Aqua #9408

Closed
wants to merge 3 commits into from

Conversation

prsadhuk
Copy link
Contributor

@prsadhuk prsadhuk commented Jul 7, 2022

When we call JDesktopPane.setDesktopManager(new DefaultDesktopManager()) and try to iconify an internalframe, it results in NPE

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.RepaintManager.getVolatileOffscreenBuffer(RepaintManager.java:1030)
at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1489)
at javax.swing.RepaintManager.paint(RepaintManager.java:1272)
at javax.swing.JComponent.paint(JComponent.java:1042)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at com.apple.laf.AquaInternalFrameDockIconUI$ScaledImageLabel.updateIcon(AquaInternalFrameDockIconUI.java:193)
at com.apple.laf.AquaInternalFrameDockIconUI$ScaledImageLabel.paint(AquaInternalFrameDockIconUI.java:204)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JComponent.paintChildren(JComponent.java:889)
at javax.swing.JComponent.paint(JComponent.java:1065)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:586) 

it seems the RepaintManager.getVolatileOffscreenBuffer() is called with JRootPane component for AquaLookAndFeel because of which SwingUtilities.getWindowAncestor(JRootPane) returns null causing NPE.

Fixed by adding a null check. The JInternalFrame can be successfully iconized now after setting DesktopManager.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8170794: [macosx] Error when using setDesktopManager on a JDesktopPane on MacOS X with Look and Feel Aqua

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9408/head:pull/9408
$ git checkout pull/9408

Update a local copy of the PR:
$ git checkout pull/9408
$ git pull https://git.openjdk.org/jdk pull/9408/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9408

View PR using the GUI difftool:
$ git pr show -t 9408

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9408.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 7, 2022

👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jul 7, 2022

@prsadhuk The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Jul 7, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 7, 2022
@mlbridge
Copy link

mlbridge bot commented Jul 7, 2022

Webrevs

@openjdk
Copy link

openjdk bot commented Jul 17, 2022

@prsadhuk This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8170794: [macosx] Error when using setDesktopManager on a JDesktopPane on MacOS X with Look and Feel Aqua

Reviewed-by: prr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 412 new commits pushed to the master branch:

  • 522b657: Merge
  • 15d3329: 8281969: Bad result for the snippet @link tag if substring/regex consists of whitespace
  • c8e0315: 8290250: Shenandoah: disable Loom for iu mode
  • fb27ddc: 8290252: Add TEST.properties to java/nio/channels/FileChannel and move tests out of largeMemory sub-dir
  • 441c33f: 8289003: JavaThread::check_is_terminated() implementation should rely on Thread-SMR
  • 2342684: 8290066: Remove KNL specific handling for new CPU target check in IR annotation
  • 0143cf1: 8290333: Remove os_share_*.hpp
  • 0184f46: 8289919: [test] LoadLibraryUnloadTest.java failed with "Failed to unload native library"
  • cca91f7: 8290327: Remove java/lang/reflect/callerCache/ReflectionCallerCacheTest.java from ProblemList-Xcomp.txt
  • b4e2ce0: 8290366: Remove unused during_conc_mark parameter in HeapRegion::note_self_forwarding_removal_start
  • ... and 402 more: https://git.openjdk.org/jdk/compare/fe807217a79753f84c00432e7451c17baa6645c5...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 17, 2022
@prsadhuk
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 25, 2022

Going to push as commit d0c365a.
Since your change was applied there have been 518 commits pushed to the master branch:

  • 80dc6ce: 8290730: compiler/vectorization/TestAutoVecIntMinMax.java failed with "IRViolationException: There were one or multiple IR rule failures."
  • 228e8e9: 8290700: Optimize AArch64 nmethod entry barriers
  • 852e71d: 8290870: NMT: Increase MallocSiteTable size and allocate it only when needed
  • 0599a05: 8290900: Build failure with Clang 14+ due to function warning attribute
  • 987656d: 8289471: Issue in Initialization of keys in ErrorMsg.java and XPATHErrorResources.java
  • 2660a92: 8290893: ProblemList java/lang/ClassLoader/loadLibraryUnload/LoadLibraryUnload
  • ef8486a: 8286270: [java.desktop] Replace color search in XColors with a switch statement
  • 62f2263: 8290861: Remove unused field URLJarFile.BUF_SIZE
  • b28f9da: 8290688: Optimize x86_64 nmethod entry barriers
  • 54854d9: 8256811: Delayed/missed jdwp class unloading events
  • ... and 508 more: https://git.openjdk.org/jdk/compare/fe807217a79753f84c00432e7451c17baa6645c5...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 25, 2022
@openjdk openjdk bot closed this Jul 25, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 25, 2022
@openjdk
Copy link

openjdk bot commented Jul 25, 2022

@prsadhuk Pushed as commit d0c365a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@prsadhuk prsadhuk deleted the JDK-8170794 branch July 25, 2022 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
2 participants