JDK-4655996 : JCK1.4: api/javax_swing/JPasswordField/descriptions.html#setgetXXX fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.1
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_7,solaris_8
  • CPU: x86,sparc
  • Submitted: 2002-03-21
  • Updated: 2002-04-17
  • Resolved: 2002-04-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.1 hopperFixed
Related Reports
Relates :  
Description

Name: icR10030			Date: 03/21/2002



Filed By        : J2SE-SQA [###@###.###
JDK             : jdk1.4.1-b06
JCK             : JCK1.4
Platform[s]     : Solaris 8 x86
switch/Mode     : -client -Xmixed
JCK test owner  : http://javaweb.eng/jck/usr/owners.jto
Failing Test    : api/javax_swing/JPasswordField/descriptions.html#setgetXXX

Test source location:
=====================
/net/jdk/export/disk8/local.java/jck1.4/JCK-runtime-14/tests/api/javax_swing/JPasswordField/setgetXXXTests.java 

jtr file location:
==================
/net/jtgb4u4c.eng/export/sail15/results/hopper/b06/jck14/x86/sol8_x86_smp_plugin_ns6.2_linux-6/workDir/api/javax_swing/JPasswordField/descriptions_setgetXXX.jtr

How to reproduce:
=================
--------Script START---------------------
#!/bin/sh

JCK=/net/linux-15/export/home/java/jck1.4/JCK-runtime-14
export JCK
CLASSPATH="${JCK}/classes:${JCK}/javatest.jar"
export CLASSPATH
JAVA_HOME=/net/linux-15/export/home/java/jdk1.4.1/x86/
export JAVA_HOME

$JAVA_HOME/bin/java -version
$JAVA_HOME/bin/java -cp ${JCK}/classes:${JCK}/javatest.jar -Xfuture -client -Xmixed javasoft.sqe.tests.api.javax.swing.JPasswordField.setgetXXXTests -TestCaseID JPasswordField3014 JPasswordField3015
--------Script END----------------------

Test output:
============
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b06)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b06, mixed mode)
java.io.IOException: Failed to get selection targets
        at sun.awt.datatransfer.ClipboardTransferable.getClipboardFormats(Native Method)
        at sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:64)
        at sun.awt.datatransfer.SunClipboard.getContents(SunClipboard.java:80)
        at javax.swing.TransferHandler$TransferAction.actionPerformed(TransferHandler.java:811)
        at javax.swing.text.JTextComponent.invokeAction(JTextComponent.java:1183)
        at javax.swing.text.JTextComponent.paste(JTextComponent.java:1161)
        at javasoft.sqe.tests.api.javax.swing.JPasswordField.setgetXXXTests.JPasswordField3014(setgetXXXTests.java:238)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:397)
        at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:193)
        at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:125)
        at javasoft.sqe.tests.api.javax.swing.JPasswordField.setgetXXXTests.main(setgetXXXTests.java:24)
JPasswordField3014: Failed. Test case throws exception: java.io.IOException: Failed to get selection targets
java.io.IOException: Failed to get selection targets
        at sun.awt.datatransfer.ClipboardTransferable.getClipboardFormats(Native Method)
        at sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:64)
        at sun.awt.datatransfer.SunClipboard.getContents(SunClipboard.java:80)
        at javax.swing.TransferHandler$TransferAction.actionPerformed(TransferHandler.java:811)
        at javax.swing.text.JTextComponent.invokeAction(JTextComponent.java:1183)
        at javax.swing.text.JTextComponent.paste(JTextComponent.java:1161)
        at javasoft.sqe.tests.api.javax.swing.JPasswordField.setgetXXXTests.JPasswordField3015(setgetXXXTests.java:260)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:397)
        at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:193)
        at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:125)
        at javasoft.sqe.tests.api.javax.swing.JPasswordField.setgetXXXTests.main(setgetXXXTests.java:24)
JPasswordField3015: Failed. Test case throws exception: java.io.IOException: Failed to get selection targets
====== JPasswordField3014 ====== public void cut()
====== JPasswordField3015 ====== public void copy()
STATUS:Failed.tests: 2; failed: 2; first test case failure: JPasswordField3014

Specific Machine Info:
======================
Hostname: linux-6
Os: Solaris 8 x86


======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: hopper FIXED IN: hopper INTEGRATED IN: hopper VERIFIED IN: hopper
14-06-2004

EVALUATION It looks like Clipboard.getContents is throwing an IOException, but it isn't documented as possible to throw an IOException. We can certainly catch this exception, but should it be thrown? I am reassigning to awt to make sure this was intended. If it is, reassign it back to swing and we'll add the necessary try...catch. ###@###.### 2002-03-21 Name: dsR10078 Date: 03/22/2002 The bug is reproducible with 1.4.1-b06 on Solaris and Linux if there is no owner of the system clipboard. It doesn't manifest before 1.4.1-b06. It can be reproduced with the following minimal test case: -------------------------------------------------------------------------- import java.awt.Toolkit; public class Test { public static void main(String[] args) { Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); } } -------------------------------------------------------------------------- Before 1.4.1-b06 this test successfully runs to completion. With 1.4.1-b06 the following exception is thrown: Exception in thread "main" java.io.IOException: Failed to get selection targets at sun.awt.datatransfer.ClipboardTransferable.getClipboardFormats(Native Method) at sun.awt.datatransfer.ClipboardTransferable.<init>(ClipboardTransferable.java:64) at sun.awt.datatransfer.SunClipboard.getContents(SunClipboard.java:80) at Test.main(Test.java:5) This bug was introduced with the fix for 4513976. That fix contains several assertions that the data transfer completes successfully. IOException is thrown in case of assertion failure. One of these assertions is overconstraining. One fails if there is no owner of the selection or if the selection owner doesn't export any target types. ###@###.### 2002-03-22 ======================================================================
22-03-2002

SUGGESTED FIX Name: dsR10078 Date: 03/22/2002 Modify the assertions, so that they pass for any legal outcome of the data transfer. --- awt_Selection.c Fri Mar 22 16:03:29 2002 *************** *** 244,252 **** --- 244,266 ---- } free(checkedTargets); } + } else { + /* + * Fix for 4655996. + * Report success if the selection owner doesn't export any target + * types. + */ + status = SelectionSuccess; } } else if (*type == XT_CONVERT_FAIL) { status = SelectionOwnerTimedOut; + } else { + /* + * Fix for 4655996. + * Report success if there is no owner for this selection or the owner + * fails to provide target types. + */ + status = SelectionSuccess; } if (value != NULL) { ###@###.### 2002-03-22 ======================================================================
22-03-2002