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

Abhishek Kumar abhiscxk at openjdk.org
Mon Nov 4 07:33:36 UTC 2024


On Wed, 30 Oct 2024 12:10:42 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:
> 
>   remove some redundant code

Minor formatting changes.

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

> 26:  * @bug 4869502 4869539
> 27:  * @key printer
> 28:  * @summary Confirm that ToPage is populated for argument =2. Range is disabled for argument = 0.

Suggestion:

 * @summary Confirm that ToPage is populated for argument = 2. Range is disabled for argument = 0.

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

> 42: import java.awt.print.PrinterException;
> 43: 
> 44: 

Extra blank line can be removed.

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

> 79:             .build();
> 80: 
> 81:         System.out.println("open PrintDialog..");

print statements can be logged in PFJ's logarea.

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

> 97: 
> 98:         // Simply draw two rectangles
> 99:         Graphics2D g2 = (Graphics2D)g;

Suggestion:

        Graphics2D g2 = (Graphics2D) g;

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

> 102:         g2.drawRect(1,1,200,300);
> 103:         g2.drawRect(1,1,25,25);
> 104:         System.out.println("print method called "+pi + " Orientation "+pf.getOrientation());

Suggestion:

        g2.drawRect(1, 1, 200, 300);
        g2.drawRect(1, 1, 25, 25);
        System.out.println("print method called " + pi + " Orientation " + pf.getOrientation());

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

> 120: 
> 121:     public PageFormat getPageFormat(int pageIndex) {
> 122:         System.out.println("getPageFormat called "+pageIndex);

Suggestion:

        System.out.println("getPageFormat called " + pageIndex);

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

> 123:         if (pageIndex == 0) {
> 124:             pf.setOrientation(PageFormat.PORTRAIT);
> 125:             System.out.println("Orientation returned from Pageable "+findOrientation(pf.getOrientation()));

Suggestion:

            System.out.println("Orientation returned from Pageable " + findOrientation(pf.getOrientation()));

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

> 127:         } else {
> 128:             pf.setOrientation(PageFormat.LANDSCAPE);
> 129:             System.out.println("Orientation returned from Pageable "+findOrientation(pf.getOrientation()));

Suggestion:

            System.out.println("Orientation returned from Pageable " + findOrientation(pf.getOrientation()));

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

> 66:         StreamPrintServiceFactory[] factories = PrinterJob.lookupStreamPrintServices(mType);
> 67:         if (factories.length > 0)
> 68:             service = factories[0].getPrintService(fos);

Suggestion:

        if (factories.length > 0) {
            service = factories[0].getPrintService(fos);
        }

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

> 69: 
> 70:         if (service != null) {
> 71:             System.out.println("Stream Print Service "+service);

Suggestion:

            System.out.println("Stream Print Service " + service);

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

> 83:         System.out.println("\nValues in attr set passed to print method");
> 84:         Attribute attr[] = prSet.toArray();
> 85:         for (int x = 0; x < attr.length; x ++) {

Suggestion:

        for (int x = 0; x < attr.length; x++) {

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

> 84:         Attribute attr[] = prSet.toArray();
> 85:         for (int x = 0; x < attr.length; x ++) {
> 86:             System.out.println("Name "+attr[x].getName()+"  "+attr[x]);

Suggestion:

            System.out.println("Name "+ attr[x].getName() + "  " + attr[x]);

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

> 97:         fos = new FileOutputStream(fp);
> 98:         if (factories.length > 0)
> 99:             service = factories[0].getPrintService(fos);

Suggestion:

        if (factories.length > 0) {
            service = factories[0].getPrintService(fos);
        }

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

> 109: 
> 110:         if (Files.mismatch(fl.toPath(), fp.toPath()) == -1) {
> 111:             throw new RuntimeException("Printing stream orientation is same for both PORTRAIT and LANDSCAPE");

Please limit it to 80 cols.

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

> 125:         System.out.println("StreamPrinting Test Width "+pf.getWidth()+" Height "+pf.getHeight());
> 126:         g2.drawRect(1,1,200,300);
> 127:         g2.drawRect(1,1,25,25);

Suggestion:

        System.out.println("StreamPrinting Test Width " + pf.getWidth() + " Height " + pf.getHeight());
        g2.drawRect(1, 1, 200, 300);
        g2.drawRect(1, 1, 25, 25);

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

PR Review: https://git.openjdk.org/jdk/pull/21780#pullrequestreview-2412294941
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827270515
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827271029
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827272214
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827272520
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827273219
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827273555
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827273690
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827273826
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827279034
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827279759
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827279317
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827279531
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827280735
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827281283
PR Review Comment: https://git.openjdk.org/jdk/pull/21780#discussion_r1827281812


More information about the client-libs-dev mailing list