harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4656) [classlib][awt] System ClipBoard is not initialized well in Linux
Date Fri, 07 Sep 2007 12:01:31 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12525688
] 

Alexei Zakharov commented on HARMONY-4656:
------------------------------------------

Thanks Chunrong. While playing with above test I've discovered that RI never returns null
from Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null) because it initializes
java clipboard with current value of system native clipboard. This way, clipboard always contains
something on RI - some text that was recently copy-pasted from some app. IMHO it will be nice
to have this functionality implemented in Harmony too. 

However, before your patch Harmony's clipboard was initialized with null, after your patch
it is initialized with empty string. The last case is better from my point of view. So I've
applied your patch at the revision 573554. Please verify. 


> [classlib][awt] System ClipBoard is not initialized well in Linux
> -----------------------------------------------------------------
>
>                 Key: HARMONY-4656
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4656
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Fedora(Linux32)
>            Reporter: Chunrong Lai
>            Assignee: Alexei Zakharov
>         Attachments: H4656.fixed.patch
>
>
>  In Fedora NullException is observed in the simple example:
> import java.awt.Toolkit;
> import java.awt.datatransfer.Clipboard;
> import java.awt.datatransfer.DataFlavor;
> import java.awt.datatransfer.Transferable;
> import java.awt.datatransfer.UnsupportedFlavorException;
> import java.io.IOException;
> public class Test {
>   public static void main (String argv[]) {
>     Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
>     Transferable tb = clipboard.getContents(null);
>     try {
>       String text = (String) tb.getTransferData(DataFlavor.stringFlavor);
>       if (text != null && !text.equals(""))
>       {
>          System.out.println("The Clipboard is not null with String");
>       } else {
>          System.out.println("The Clipboard is null with String");
>       }
>     }
>     catch (UnsupportedFlavorException e){
>       e.printStackTrace();
>     }
>     catch (IOException e){
>       e.printStackTrace();      
>     }
>     catch (Exception e){
>       e.printStackTrace();      
>     }
>   }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message