-
Notifications
You must be signed in to change notification settings - Fork 19
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
Modernize to Jenkins 2.479 and Jakarta EE 9 #134
base: master
Are you sure you want to change the base?
Conversation
b3662b9
to
9549307
Compare
Trying to figure out why SpotBugs is errantly flagging a |
9549307
to
e35fb41
Compare
e35fb41
to
ba97a8c
Compare
ba97a8c
to
91bdae0
Compare
src/main/java/org/jenkinsci/plugins/gitserver/CSRFExclusionImpl.java
Outdated
Show resolved
Hide resolved
90bd3d1
to
0d96613
Compare
bfb36e4
to
f4a410b
Compare
@jenkinsci/git-server-plugin-developers, please review when able. |
d70a302
to
aec904d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
src/main/java/org/jenkinsci/plugins/gitserver/CSRFExclusionImpl.java
Outdated
Show resolved
Hide resolved
@@ -56,6 +55,7 @@ public FetchConnection openFetch() throws NotSupportedException, TransportExcept | |||
} catch (IOException e) { | |||
throw new TransportException("Failed to open a fetch connection",e); | |||
} catch (InterruptedException e) { | |||
Thread.currentThread().interrupt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not appear to be related to the stated PR goal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was flagged by the SonarQube for IDE in my IntelliJ IDEA (rule java:S1242
). I've been fixing a bunch of other issues like this and so wanted to fix it here too. However, if you'd prefer it to be dropped, I can do so. I'm not stuck on getting that in.
aec904d
to
6096dc6
Compare
@@ -60,11 +63,27 @@ public HttpGitRepository() { | |||
* | |||
* @see ReceivePackFactory#create(Object, Repository) | |||
*/ | |||
public abstract ReceivePack createReceivePack(HttpServletRequest context, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException; | |||
@SuppressWarnings({"deprecated", "java:S1874"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming back to this PR, this is the only part I feel uneasy about. It implements the compatibility layer in the opposite way that Jenkins core did in jenkinsci/jenkins#9672, by having the new functionality delegate to the old rather than having the old functionality delegate to the new. This also makes it harder to eventually remove the old functionality. For consistency, I would want to see this compatibility layer implemented the same way as jenkinsci/jenkins#9672 or jenkinsci/cloudbees-folder-plugin#444.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, weird. I don't remember why I did this now. I'll flip it around.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, the closest analog I can find for this method (as I needed to change the signature of an abstract method, not a concrete method) is ReconfigurableDescribable
in jenkinsci/jenkins#9672, as it's an interface and one of the interface methods needed to change. In that scenario, the interface method was changed into 2 default methods that both check if the other is present. I will take this approach, changing the abstract method into the 2 concrete methods I've already done, but by having both check for the presence of the other.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ParameterDefinition
is an example of an abstract method that doesn't throw an exception. For one that does, View#submit
is an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I missed those ones. I think what I've gotten is quite close to View#submit
.
6096dc6
to
dfca147
Compare
* Adapter methods are added for old overrides. * Switch to JUnit 5 for tests
dfca147
to
238480b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the larger diff between the commits. I discovered that Spotless hadn't been run on the plugin code, so I made one more commit before mine that runs Spotless first.
@@ -60,11 +63,27 @@ public HttpGitRepository() { | |||
* | |||
* @see ReceivePackFactory#create(Object, Repository) | |||
*/ | |||
public abstract ReceivePack createReceivePack(HttpServletRequest context, Repository db) throws ServiceNotEnabledException, ServiceNotAuthorizedException; | |||
@SuppressWarnings({"deprecated", "java:S1874"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, the closest analog I can find for this method (as I needed to change the signature of an abstract method, not a concrete method) is ReconfigurableDescribable
in jenkinsci/jenkins#9672, as it's an interface and one of the interface methods needed to change. In that scenario, the interface method was changed into 2 default methods that both check if the other is present. I will take this approach, changing the abstract method into the 2 concrete methods I've already done, but by having both check for the presence of the other.
Required for the Scriptler plugin to modernize as well without breaking SSH compatibility.
Testing done
Unit tests updated and run.
Submitter checklist