You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Chunrong Lai (JIRA)" <ji...@apache.org> on 2007/08/21 12:13:30 UTC

[jira] Created: (HARMONY-4656) [classlib][awt] System ClipBoard is not initialized well in Linux

[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
         Environment: Fedora(Linux32)
            Reporter: Chunrong Lai



 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.


[jira] Assigned: (HARMONY-4656) [classlib][awt] System ClipBoard is not initialized well in Linux

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov reassigned HARMONY-4656:
----------------------------------------

    Assignee: Alexei Zakharov

> [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.


[jira] Updated: (HARMONY-4656) [classlib][awt] System ClipBoard is not initialized well in Linux

Posted by "Chunrong Lai (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chunrong Lai updated HARMONY-4656:
----------------------------------

    Attachment: H4656.fixed.patch


 The patch guarantees a non-NULL content for SystemClipboard.

> [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
>         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.


[jira] Commented: (HARMONY-4656) [classlib][awt] System ClipBoard is not initialized well in Linux

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Resolved: (HARMONY-4656) [classlib][awt] System ClipBoard is not initialized well in Linux

Posted by "Alexei Zakharov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4656?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Zakharov resolved HARMONY-4656.
--------------------------------------

    Resolution: Fixed

> [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.