Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4331583

DataFlavor.selectBestTextFlavor(DataFlavor a[]) always returns the first array e

XMLWordPrintable

    • x86
    • linux



      Name: kaC94536 Date: 04/19/2000



      The following test shows that method DataFlavor.selectBestTextFlavor(DataFlavor a[]) always
      returns the first array element instead of returning the best one.

      import java.awt.datatransfer.*;

      public class test {

        public static void main(String args[]) throws Exception {

          DataFlavor bestFlavorArray1[], bestFlavorArray2[];
          DataFlavor bestFlavor1, bestFlavor2;

          bestFlavorArray1 = new DataFlavor[2];
          bestFlavorArray2 = new DataFlavor[2];

          bestFlavorArray1[0] = DataFlavor.stringFlavor;
          bestFlavorArray1[1] = new DataFlavor("text/plain; charset=us-ascii");

          bestFlavorArray2[0] = bestFlavorArray1[1];
          bestFlavorArray2[1] = bestFlavorArray1[0];

          bestFlavor1 = DataFlavor.selectBestTextFlavor(bestFlavorArray1);
          bestFlavor2 = DataFlavor.selectBestTextFlavor(bestFlavorArray2);

          System.out.println("The Best Text Flavor is " + bestFlavor1);
          System.out.println("The Best Text Flavor is " + bestFlavor2);

          if(bestFlavor2.match(bestFlavor1)) {
              System.out.println("The test is Passed");
          } else {
              System.out.println("The test is Failed");
          }
        }
      }

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

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

            Unassigned Unassigned
            kanisimosunw Konstantin Anisimov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: