-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta2
-
x86, sparc
-
generic, linux, windows_98, windows_2000
-
Verified
Name: iaR10016 Date: 07/17/2001
JDK : JDK1.4.0-beta-b71
JCK : JCK1.4-b06
Platform[s] : RedHat Linux 6.2, Windows 2000, Windows NT, Windows 98
switch/Mode : -client -Xmixed
JCK test owner : http://javaweb.eng/jck/usr/owners.jto
Failing Test : api/javax_swing/JWindow/index.html#Ctor2 [TestCaseID JWindow0015]
JavaTM 2 Platform Std. Ed. v1.4.0 Specification (b71) reads about
JWindow.JWindow(Window,GraphicsConfiguration) constructor:
...
public JWindow(Window owner,GraphicsConfiguration gc)
Creates a window with the specified owner window and GraphicsConfiguration of a screen
device. If owner is null, the shared owner will be used and this window will not be
focusable.
Parameters:
owner - the window from which the window is displayed
gc - the GraphicsConfiguration that is used to construct the new window with; if gc
is null, the system default GraphicsConfiguration is assumed, unless owner is also
null, in which case the GraphicsConfiguration from the shared owner frame will be
used.
Throws:
IllegalArgumentException - if gc is not from a screen device. This exception is always
thrown when GraphicsEnvironment.isHeadless() returns true
...
Here is a code fragment from JDK1.4.0-beta-b71 source code:
-------------------- src/javax/swing/JWindow.java --------------------
...
079> public class JWindow extends Window implements Accessible, RootPaneContainer
080> {
...
167> public JWindow(Window owner, GraphicsConfiguration gc) {
168> super(owner == null ? (Window)SwingUtilities.getSharedOwnerFrame() :
169> null, gc);
170> windowInit();
171 }
...
554> }
---------------------- src/java/awt/Window.java ----------------------
...
342> public Window(Window owner, GraphicsConfiguration gc) {
343> this(gc);
344> ownedInit(owner);
345> }
346>
347> private void ownedInit(Window owner) {
348> if (owner == null) {
349> throw new IllegalArgumentException("null owner window");
350> }
...
354> }
...
----------------------------------------------------------------------
This fragment shows that JWindow(Window owner,GraphicsConfiguration gc) constructor
always throws IllegalArgumentException if "owner" argument is not null.
The following test example demonstrates the bug:
-------------------- test.java --------------------
import javax.swing.*;
import java.awt.*;
public class test {
public static void main(String argv[]) {
Window anOwner = null;
try {
anOwner = new JWindow();
} catch (Exception e) {
System.out.println(e);
return;
}
try {
JWindow win = new JWindow(anOwner, anOwner.getGraphicsConfiguration());
System.out.println("Owner is not null: PASS. ");
} catch (IllegalArgumentException e) {
System.out.println("Owner is not null: FAIL. "+e);
}
try {
JWindow win = new JWindow(null, anOwner.getGraphicsConfiguration());
System.out.println("Owner is null: PASS. ");
} catch (IllegalArgumentException e) {
System.out.println("Owner is null: FAIL. "+e);
}
}
}
---------------------------------------------------
Sample output is:
...
$ /net/linux-15/export/home/java/jdk1.4.0/linux/bin/java -Xfuture test
Owner is not null: FAIL. java.lang.IllegalArgumentException: null owner window
Owner is null: PASS.
...
Test source location:
=====================
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/javax_swing/JWindow/Ctor2Tests.java
jtr file location:
==================
/net/jtgb4u4c.eng/export/sail16/results/merlin/b71/jck14/linux/redhat6.2_single_kde_client_incgc_future_linux-12/workDir/api/javax_swing/JWindow/index_Ctor2.jtr
How to reproduce:
====================
Run the following script under RedHat Linux 6.2
(probably, you need to change JCK and JAVA_HOME paths):
--------Script START---------------------
#!/bin/sh
JAVA_HOME=/net/jdk/export/disk8/local.java/jdk1.4/linux-i386
JCK=/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14
export CLASSPATH="$JCK/classes:$JCK/javatest.jar"
executeClass="javasoft.sqe.tests.api.javax.swing.JWindow.Ctor2Tests -TestCaseID JWindow0015"
$JAVA_HOME/bin/java ${executeClass}
---------Script END----------------------
Test output:
=============
JWindow0015: Failed. IllegalArgumentException thrown incorrectly in NOT headless implementationjava.lang.IllegalArgumentException: null owner window
STATUS:Failed.tests: 1; failed: 1; first test case failure: JWindow0015
Specific Machine Info:
=====================
Hostname: linux-14
OS: RedHat Linux 6.2
Hostname: Linux-2
OS: Windows 2000
======================================================================
- duplicates
-
JDK-4482324 JWindow(owner,gc) throws IAE
- Closed