United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 5085647 Possible to create an applet window with no applet warning
5085647 : Possible to create an applet window with no applet warning

Details
Type:
Bug
Submit Date:
2004-08-11
Status:
Resolved
Updated Date:
2005-07-23
Project Name:
JDK
Resolved Date:
2005-07-23
Component:
client-libs
OS:
solaris_2.5.1,linux
Sub-Component:
java.awt
CPU:
x86,generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
5.0,6
Fixed Versions:
6

Related Reports
Backport:
Duplicate:

Sub Tasks

Description
Name: rmT116609			Date: 08/11/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b60)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b60, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Linux jupiter 2.6.3-7mdk #1 Wed Mar 17 15:56:42 CET 2004 i686 unknown unknown GNU/Linux


EXTRA RELEVANT SYSTEM CONFIGURATION :
Mandrake Linux 10.0, KDE

A DESCRIPTION OF THE PROBLEM :
A simple JWindow is displayed with no applet warning when run as an unsigned applet.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A window with an applet warning should be displayed.
ACTUAL -
A window with no applet warning is displayed. Additionally, not the entire contents of the window is painted red, as it should be. 

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Java source code:

import java.applet.*;
import javax.swing.*;
import java.awt.*;

public class WindowApplet extends Applet{
  
  
  public void start(){
    JFrame f = new JFrame("Test Frame");
    f.setBounds(50, 50, 100, 100);
    f.setVisible(true);
    
    JWindow window = new JWindow(f);

    JPanel panel = new JPanel();
    panel.setOpaque(true);
    panel.setBackground(Color.red);
    window.setContentPane(panel);
    window.setBounds(50, 50, 500, 500);
    window.setVisible(true);
    window.toFront();
  }
  
}
---------- END SOURCE ----------
(Incident Review ID: 296558) 
======================================================================
###@###.### 2004-08-11

                                    

Comments
EVALUATION

The duplicate of 5085648
###@###.### 2004-08-12

We should properly update children sizes in XWindowPeer. There's two places to update: first, immediately after mapping window; second, upon a configure request. For some reason XWindowPeer does handle configure notify even if this peer is override-redirect.
###@###.### 2005-07-11 13:27:19 GMT
                                     
2005-07-11
SUGGESTED FIX

Essentially, six lines added.

------- XWindowPeer.java -------
*** /tmp/sccs.AvnHNt	2005-07-11 17:19:36.660816075 +0400
--- XWindowPeer.java	2005-07-11 17:17:56.222542497 +0400
***************
*** 212,217 ****
--- 212,218 ----
      }
  
      public Insets getInsets() {
+         insets.top += getWarningWindowHeight();
          return insets;
      }
  
***************
*** 415,420 ****
--- 416,423 ----
          // there could be a race condition in which a ComponentListener could
          // see the old screen.
          super.handleConfigureNotifyEvent(ptr);
+         // for 5085647: no applet warning window visible
+         updateChildrenSizes();
      }
  
      final void requestXFocus(long time) {
***************
*** 666,671 ****
--- 669,681 ----
          updateFocusability();
          promoteDefaultPosition();
          super.setVisible(vis);
+         // method called somewhere in parent does not generate configure-notify
+         // event for override-redirect. 
+         // Ergo, no reshape and bugs like 5085647 in case setBounds was 
+         // called before setVisible.
+         if( isOverrideRedirect() ) {
+             updateChildrenSizes();
+         }
      }
  
      boolean isSimpleWindow() {
###@###.### 2005-07-11 13:27:19 GMT
                                     
2005-07-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mustang


                                     
2004-08-14



Hardware and Software, Engineered to Work Together