[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] FYI: Null check after dereference in javax.swing.Defaul
From: |
Mark Wielaard |
Subject: |
Re: [cp-patches] FYI: Null check after dereference in javax.swing.DefaultDesktopManager |
Date: |
Tue, 21 Jun 2005 09:52:06 +0200 |
Hi Lilian,
On Mon, 2005-06-20 at 16:57 -0400, Lillian Angel wrote:
> 2005-06-20 Lillian Angel <address@hidden>
>
> * javax/swing/DefaultDesktopManager
> (getBoundsForIconOf): No reason to check if desktopPane
> is null after dereferencing desktopPane in code.
> Fixes bug #13461.
> [...]
> @@ -516,14 +516,15 @@
> // the bottom left corner)
> // The icon also must not be placed where another icon is placed
> // (regardless whether that frame is an icon currently or not)
> - JDesktopPane desktopPane = frame.getDesktopPane();
> +
> + if (desktopPane == null)
> + return frame.getDesktopIcon().getBounds();
> +
> + JDesktopPane desktopPane = frame.getDesktopPane();
> Rectangle paneBounds = desktopPane.getBounds();
> Insets insets = desktopPane.getInsets();
> Dimension pref = frame.getDesktopIcon().getPreferredSize();
>
> - if (desktopPane == null)
> - return frame.getDesktopIcon().getBounds();
> -
> Component[] frames = desktopPane.getComponents();
>
> int count = 0;
Seems your change and Roman's reformatting clashed. This patch fixes it
again:
2005-06-20 Mark Wielaard <address@hidden>
* javax/swing/DefaultDesktopManager.java (getBoundsForIconOf):
Initialize desktopPane before use.
Committed,
Mark
diff -u -r1.11 DefaultDesktopManager.java
--- javax/swing/DefaultDesktopManager.java 20 Jun 2005 20:52:46 -0000
1.11
+++ javax/swing/DefaultDesktopManager.java 21 Jun 2005 07:46:56 -0000
@@ -516,11 +516,11 @@
// the bottom left corner)
// The icon also must not be placed where another icon is placed
// (regardless whether that frame is an icon currently or not)
-
- if (desktopPane == null)
- return frame.getDesktopIcon().getBounds();
-
- JDesktopPane desktopPane = frame.getDesktopPane();
+ JDesktopPane desktopPane = frame.getDesktopPane();
+
+ if (desktopPane == null)
+ return frame.getDesktopIcon().getBounds();
+
Rectangle paneBounds = desktopPane.getBounds();
Insets insets = desktopPane.getInsets();
Dimension pref = frame.getDesktopIcon().getPreferredSize();
signature.asc
Description: This is a digitally signed message part