Skip to content
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

[#394] Provide non-reflective access to JVM Attach API on JDK9+ #464

Merged
merged 3 commits into from Jul 18, 2021

Conversation

grgrzybek
Copy link
Contributor

No description provided.

@grgrzybek
Copy link
Contributor Author

Please do not merge yet. Work in progress.

@grgrzybek grgrzybek force-pushed the jdk11-vm-attach-api branch 2 times, most recently from f4c1eaa to febc4cd Compare June 25, 2021 15:52
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
Copy link
Member

Choose a reason for hiding this comment

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

I guess this jump is required, and I'm not against it. But we need to bump the version number accordingly, to indicate that the release is not compatible with Java 1.6. anymore. Also, I'd prefer to have this as a global switch for all components (not only for the JVM agent)

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, when I tried to run the tests using JDK17 (as it no longer can handle target=1.6), but it's not a requirement for any other change. I can skip this change.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can skip it for now, and consider to bump to 1.7 as minimum in a followup PR (and then already on the overall level) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I reverted this change, so it's still 1.6. 1.7 was needed if I wanted to build using JDK17. But I needed it to test using JDK17. After verifying it works, we can leave at 1.6 value ;)


package org.jolokia.jvmagent.security.asn1;

public class DERInteger implements DERObject {
Copy link
Member

Choose a reason for hiding this comment

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

Are those ASN1 objects copied over from some other open-source library (like bouncycastle) or do you have written those ?

It's probably over the top here, but are there any tests for those classes ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tests are in org/jolokia/jvmagent/security/asn1/DEREncodingTest.java and I confirm - I looked a bit at BC classes (only to check what DER Tag is), but every line of code is written by me. I was consulting only the X.680/X.690 specifications.

Copy link
Member

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

Thanks a lot for all of your efforts, looks good to me in general ! Maybe it would have been better to split it up in two PRs (one for the reflection in the VirtualMachineHandler, one for the CERT handling).

I have two questions though, see the comments inline. Also if the ASN.1 objects are borrowed from somewhere else we should check the license and add the corresponding license headers/files. For the switch to 1.7 I wonder whether this is required, and if so, we should do it at the top-level.

@grgrzybek
Copy link
Contributor Author

First - this PR can be treated as "for review only" and I agree that separate PRs are better.

DER classes are written by me, as I didn't want to borrow anything from BC (or internal JDK classes). I also didn't want to introduce any dependency to external, lightweight ASN.1/DER libraries.
There are few missing DER/ASN.1 constructs, because I needed only the ones for X.509 certificate structure.

@grgrzybek
Copy link
Contributor Author

I'm just checking the final part - @JsonMBean annotation handling. When I'm ready, I'll update this PR (force pushing probably), but eventually I'll split this PR into 2 (or 3) separate ones.

@rhuss
Copy link
Member

rhuss commented Jul 5, 2021

DER classes are written by me, as I didn't want to borrow anything from BC (or internal JDK classes). I also didn't want to introduce any dependency to external, lightweight ASN.1/DER libraries.

ah, very cool. Do you think we should some unit tests for those ? They don't look trivial

@rhuss
Copy link
Member

rhuss commented Jul 5, 2021

I think we can keep it 1 PR, don't bother with fiddling around with multiple PRs. Maybe you can have several commits per feature, but happy also if not. Don't waste efforts here.

@grgrzybek
Copy link
Contributor Author

grgrzybek commented Jul 5, 2021

ah, very cool. Do you think we should some unit tests for those ? They don't look trivial

the tests are in org/jolokia/jvmagent/security/asn1/DEREncodingTest ;) See https://github.com/rhuss/jolokia/pull/466/files#diff-d12c7240143cff35b0856f1b033d4f0b80272dd48f4c945fa069e716c12260c7

@grgrzybek
Copy link
Contributor Author

And #466 is a separate PR for cert generation.

@rhuss
Copy link
Member

rhuss commented Jul 5, 2021

Sorry that I overlooked the tests ;( going to continue tomorrow on the PRs ...

Copy link
Member

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

Looks good to me !

@rhuss rhuss merged commit b0f17ce into jolokia:master Jul 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants