Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-2519

[classlib][awt] Compatibility: java.awt.RenderingHints(RenderingHints.Key key,Object o) throws unexpected IllegalArgumentException while RI doesn'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • None
    • None
    • None

    Description

      Problem details:
      There is no mention of IllegalArgumentException in the specification, but
      java.awt.RenderingHints( RenderingHints.Key key,Object o) throws unexpected IllegalArgumentException while RI does not.

      Test for reproducing:
      import junit.framework.TestCase;
      import java.awt.*;

      public class test extends TestCase {
      public void test1 ()

      { new RenderingHints(RenderingHints.KEY_RENDERING,new String("MyMessageDigest")); }


      }
      Output on Sun 1.5:
      ==================
      .
      Time: 0

      OK (1 test)

      Output on Harmony:
      ==================
      .E
      Time: 0
      There was 1 error:
      1) test1(test)java.lang.IllegalArgumentException
      at java.awt.RenderingHints.put(RenderingHints.java:98)
      at java.awt.RenderingHints.<init>(RenderingHints.java:89)
      at test.test1(test.java:6)
      at java.lang.reflect.VMReflection.invokeMethod(Native Method)

      FAILURES!!!
      Tests run: 1, Failures: 0, Errors: 1

      I suggest to mark this case as non-bug difference. If you take a look at the put() method description in RenderingHints class, spec says:
      "Throws: IllegalArgumentException - value is not appropriate for the specified key.". I think the same check should be implemented in the constructor as it is done in Harmony. IMO invalid values for the rendering hints' keys don't make any sense.

      Attachments

        Issue Links

          Activity

            People

              cap Alexey Petrenko
              ilya.okomin Ilya Okomin
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: