Skip to content

8343124: Tests fails with java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper$MainTask cannot access #21780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from

Conversation

prsadhuk
Copy link
Contributor

@prsadhuk prsadhuk commented Oct 30, 2024

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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8343124: Tests fails with java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper$MainTask cannot access (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21780/head:pull/21780
$ git checkout pull/21780

Update a local copy of the PR:
$ git checkout pull/21780
$ git pull https://git.openjdk.org/jdk.git pull/21780/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21780

View PR using the GUI difftool:
$ git pr show -t 21780

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21780.diff

Using Webrev

Link to Webrev Comment

….sun.javatest.regtest.agent.MainWrapper cannot access
….sun.javatest.regtest.agent.MainWrapper cannot access
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 30, 2024

👋 Welcome back psadhukhan! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 30, 2024

@prsadhuk This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

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

Reviewed-by: abhiscxk

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 283 new commits pushed to the master branch:

  • df08a9e: 8312425: [vectorapi] AArch64: Optimize vector math operations with SLEEF
  • e7f0bf1: 8343153: compiler/codecache/CheckLargePages.java fails on linux with huge pages configured but its number set to 0
  • f9e1c62: 8343436: Regression in StackMapGenerator after JDK-8339205
  • 2432c4f: 8343206: Final graph reshaping should not compress abstract or interface class pointers
  • c125178: 8341068: [s390x] intrinsics for divideUnsigned and remainderUnsigned methods in java.lang.Integer and java.lang.Long
  • 37a3398: 8343242: RISC-V: Refactor materialization of literal address
  • d26412e: 8343433: Update net.properties and java.net.http module-info.java after 8326949
  • 29882bf: 8340311: JPackage app-image exe launches multiple exe's in JDK 22+
  • 069bb79: 8342082: Remove unused BasicProgressBarUI.Animator.interval
  • 00ec105: 8343412: Missing escapes for single quote marks in javac.properties
  • ... and 273 more: https://git.openjdk.org/jdk/compare/f56a154132f7e66b1b65adfa2aa937119999b14a...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Oct 30, 2024

@prsadhuk The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Oct 30, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 30, 2024
@mlbridge
Copy link

mlbridge bot commented Oct 30, 2024

Webrevs

import javax.print.attribute.HashPrintRequestAttributeSet;

public class StreamPrintingOrientation implements Printable {
public StreamPrintingOrientation() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

return;
}
arg = Integer.parseInt(args[0]);
PrintDlgPageable pd = new PrintDlgPageable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pd unused.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

}

//printable interface
public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throws PrinterException not required.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is required...See java.awt.print.Printable spec

@prsadhuk prsadhuk changed the title 8343124: Tests fails with java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper cannot access 8343124: Tests fails with java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper$MainTask cannot access Oct 30, 2024
@openjdk openjdk bot changed the title 8343124: Tests fails with java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper$MainTask cannot access 8343124: Tests fails with java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper$MainTask cannot access Oct 30, 2024
Copy link
Contributor

@kumarabhi006 kumarabhi006 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor formatting changes.

@@ -26,104 +26,120 @@
* @bug 4869502 4869539
* @key printer
* @summary Confirm that ToPage is populated for argument =2. Range is disabled for argument = 0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 43 to 44


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra blank line can be removed.

.columns(35)
.build();

System.out.println("open PrintDialog..");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

print statements can be logged in PFJ's logarea.

public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {

// Simply draw two rectangles
Graphics2D g2 = (Graphics2D)g;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Graphics2D g2 = (Graphics2D)g;
Graphics2D g2 = (Graphics2D) g;

Comment on lines 102 to 104
g2.drawRect(1,1,200,300);
g2.drawRect(1,1,25,25);
System.out.println("print method called "+pi + " Orientation "+pf.getOrientation());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

System.out.println("\nValues in attr set passed to print method");
Attribute attr[] = prSet.toArray();
for (int x = 0; x < attr.length; x ++) {
System.out.println("Name "+attr[x].getName()+" "+attr[x]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

service = factories[0].getPrintService(fos);

if (service != null) {
System.out.println("Stream Print Service "+service);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 98 to 99
if (factories.length > 0)
service = factories[0].getPrintService(fos);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


if (Files.mismatch(fl.toPath(), fp.toPath()) == -1) {
throw new RuntimeException("Printing stream orientation is same for both PORTRAIT and LANDSCAPE");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please limit it to 80 cols.

Comment on lines 125 to 127
System.out.println("StreamPrinting Test Width "+pf.getWidth()+" Height "+pf.getHeight());
g2.drawRect(1,1,200,300);
g2.drawRect(1,1,25,25);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@prsadhuk
Copy link
Contributor Author

prsadhuk commented Nov 4, 2024

Minor formatting changes.

fixed..

@@ -119,14 +116,14 @@ public Printable getPrintable(int pageIndex) {
}

public PageFormat getPageFormat(int pageIndex) {
System.out.println("getPageFormat called "+pageIndex);
System.out.println("getPageFormat called " + pageIndex);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be logged by PFJ's logArea.


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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blank line not required.

Comment on lines 84 to 86
}
catch (PrinterException pe) {
pe.printStackTrace();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 122 to 123
PassFailJFrame.log("Orientation returned from Pageable " + findOrientation(pf.getOrientation()));
return pf;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the whole method as logging for printing is not needed for this PageRange check test

Comment on lines 136 to 137
} else if (orient == PageFormat.REVERSE_LANDSCAPE) {
return "REVERSE LANDSCAPE";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

PrintService service = null;

FileOutputStream fos = null;
File fl = null, fp = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 59 to 65
FileOutputStream fos = null;
File fl = null, fp = null;
String mType = "application/postscript";

class StreamPrintingOrientation implements Printable {
/**
* Constructor
*/
public StreamPrintingOrientation() {
super();
fl = new File("stream_landscape.ps");
fl.deleteOnExit();
fos = new FileOutputStream(fl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

}
// Simply draw two rectangles
Graphics2D g2 = (Graphics2D)g;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Graphics2D g2 = (Graphics2D)g;
Graphics2D g2 = (Graphics2D) g;

Copy link
Contributor

@kumarabhi006 kumarabhi006 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except minor change suggested.

@@ -57,10 +57,9 @@ public static void main(String[] args) throws Exception {
PrintService service = null;

FileOutputStream fos = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be moved to L64.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 4, 2024
@prsadhuk
Copy link
Contributor Author

prsadhuk commented Nov 5, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Nov 5, 2024

Going to push as commit dafa2e5.
Since your change was applied there have been 308 commits pushed to the master branch:

  • 0f7dd98: 8251926: PPC: Remove an unused variable in assembler_ppc.cpp
  • cd91a44: 8343549: SeededSecureRandomTest needn't be in a package
  • 20f3aaf: 8343471: RISC-V: compiler/cpuflags/TestAESIntrinsicsOnUnsupportedConfig.java fails after JDK-8334999
  • 67907d5: 8343500: Optimize ArrayClassDescImpl computeDescriptor
  • 714472d: 8341798: Fix ExceptionOccurred in jdk.jdwp.agent
  • 825ceb1: 8341796: Fix ExceptionOccurred in jdk.hotspot.agent
  • 8b47497: 8331682: Slow networks/Impatient clients can potentially send unencrypted TLSv1.3 alerts that won't parse on the server
  • 0668e18: 8343234: (bf) Move java/nio/Buffer/LimitDirectMemory.java from ProblemList.txt to ProblemList-Virtual.txt
  • 774de27: 8343497: Missing DEF_STATIC_JNI_OnLoad in libjimage and libsaproc native libraries
  • 1cc3586: 8343551: Missing copyright header update in Charset-X-Coder.java.template
  • ... and 298 more: https://git.openjdk.org/jdk/compare/f56a154132f7e66b1b65adfa2aa937119999b14a...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 5, 2024
@openjdk openjdk bot closed this Nov 5, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 5, 2024
@openjdk
Copy link

openjdk bot commented Nov 5, 2024

@prsadhuk Pushed as commit dafa2e5.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@prsadhuk prsadhuk deleted the JDK-8343124 branch November 5, 2024 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants