RFR: 8343124: Tests fails with java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper$MainTask cannot access [v4]

Abhishek Kumar abhiscxk at openjdk.org
Mon Nov 4 09:41:31 UTC 2024


On Mon, 4 Nov 2024 08:41:45 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Couple of printing tests dont have "public" modifier so CI testing fails to run this test citing IllegalAccessException.
>> Fix is made to made the test class public.
>> 
>> Additionally, modified PrintDlgPageable.java to use PFJ and made StreamPrintingOrientation.java automated.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   minor formatting

test/jdk/java/awt/print/Dialog/PrintDlgPageable.java line 62:

> 60:         if (arg == 0) {
> 61:             INSTRUCTIONS += "\n Confirm that page range is disabled.";
> 62: 

Blank line not required.

test/jdk/java/awt/print/Dialog/PrintDlgPageable.java line 86:

> 84:             }
> 85:             catch (PrinterException pe) {
> 86:                 pe.printStackTrace();

Suggestion:

            } catch (PrinterException pe) {
                pe.printStackTrace();

test/jdk/java/awt/print/Dialog/PrintDlgPageable.java line 119:

> 117: 
> 118:     public PageFormat getPageFormat(int pageIndex) {
> 119:         System.out.println("getPageFormat called " + pageIndex);

Can be logged by PFJ's logArea.

test/jdk/java/awt/print/Dialog/PrintDlgPageable.java line 123:

> 121:             pf.setOrientation(PageFormat.PORTRAIT);
> 122:             PassFailJFrame.log("Orientation returned from Pageable " + findOrientation(pf.getOrientation()));
> 123:             return pf;

duplicate code...can be moved outside of `if..else` block.

test/jdk/java/awt/print/Dialog/PrintDlgPageable.java line 137:

> 135:             return "PORTRAIT";
> 136:         } else if (orient == PageFormat.REVERSE_LANDSCAPE) {
> 137:             return "REVERSE LANDSCAPE";

Is it required to check for `REVERSE_LANDSCAPE `as page formatting is set only either `LANDSCAPE `or `PORTRAIT `?

test/jdk/javax/print/StreamPrintingOrientation.java line 60:

> 58: 
> 59:         FileOutputStream fos = null;
> 60:         File fl = null, fp = null;

Please declare it on separate lines as per java style coding.

test/jdk/javax/print/StreamPrintingOrientation.java line 65:

> 63:         fl = new File("stream_landscape.ps");
> 64:         fl.deleteOnExit();
> 65:         fos = new FileOutputStream(fl);

Can be rearranged something like..

    String mType = "application/postscript";
    File fp = null;
    File fl = new File("stream_landscape.ps");
    fl.deleteOnExit();
    FileOutputStream fos = new FileOutputStream(fl);

test/jdk/javax/print/StreamPrintingOrientation.java line 125:

> 123:         }
> 124:         // Simply draw two rectangles
> 125:         Graphics2D g2 = (Graphics2D)g;

Suggestion:

        Graphics2D g2 = (Graphics2D) g;

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827424008
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827425219
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827420488
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827427521
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827430641
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827435606
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827440601
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827442724


More information about the client-libs-dev mailing list