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

[FIXED JENKINS-48561] Give precedence to proxy exclusion list system property over env var #243

Merged
6 commits merged into from Mar 5, 2018
Merged

[FIXED JENKINS-48561] Give precedence to proxy exclusion list system property over env var #243

6 commits merged into from Mar 5, 2018

Conversation

etiennebec
Copy link
Contributor

Copy link
Member

@oleg-nenashev oleg-nenashev 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 so far. Could you please fix the locale thing?

StringTokenizer stringTokenizer = new StringTokenizer(nonProxyHosts, "|", false);
try {
while(stringTokenizer.hasMoreTokens()) {
exclusionsPool.add(stringTokenizer.nextToken().toLowerCase(), Boolean.TRUE);
Copy link
Member

Choose a reason for hiding this comment

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

toLowerCase() is invoked without locale, it will cause FindBugs failures with #242 I'd guess

exclusionsPool.add(stringTokenizer.nextToken().toLowerCase(), Boolean.TRUE);
}
} catch(sun.misc.REException e) {
System.err.println("Malformed exception list in http.nonProxyHosts system property: " + e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

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

I will need to rework everything to loggers

} catch(sun.misc.REException e) {
System.err.println("Malformed exception list in http.nonProxyHosts system property: " + e.getMessage());
}
if(exclusionsPool.match(host.toLowerCase()) != null) {
Copy link
Member

Choose a reason for hiding this comment

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

locale

@etiennebec
Copy link
Contributor Author

etiennebec commented Dec 15, 2017

Thanks for reviewing it. I pushed another two commits to take in account your comments.

On a side note, I noticed that some portions of code have been partially copy/pasted from hudson.remoting.Util to org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver, mainly inNoProxyEnvVar() and openURLConnection(): 2cea38c

hudson.remoting.Launcher is still using the Util.openURLConnection, but JnlpAgentEndpointResolver.resolve uses the other one.

Maybe it is a way to keep compatibility with older releases while transitioning from hudson namespace to org.jenkinsci? IDK.

@etiennebec
Copy link
Contributor Author

Noticed in mvn logs a warning regarding usage of Sun proprietary API (sun.misc.RegexpPool and sun.net.NetProperties). Should I try to replace them?

@oleg-nenashev
Copy link
Member

oleg-nenashev commented Dec 15, 2017

On a side note, I noticed that some portions of code have been partially copy/pasted.... Maybe it is a way to keep compatibility with older releases while transitioning from hudson namespace to org.jenkinsci? IDK.

In this case it would be possible to have an utility class somewhere and to invoke its methods from other places. No need to invoke special magic, just keeping and probably deprecating the current methods, but moving the duplicated logic to another method

Noticed in mvn logs a warning regarding usage of Sun proprietary API (sun.misc.RegexpPool and sun.net.NetProperties). Should I try to replace them?

Would be great. I was also wondering about these packages, but I didn't check whether they are deprecated

@oleg-nenashev
Copy link
Member

@etiennebec Are you still planning to change the classes?

@etiennebec
Copy link
Contributor Author

@oleg-nenashev yes, probably by the end of next week.

@oleg-nenashev
Copy link
Member

Jenkins project does not support Java 9 so far. Is it possible to have a Java8-compatible implementation without deprecated classes?

@etiennebec
Copy link
Contributor Author

OpenJDK9 removed references to old internal Sun lib, including the ones used in DefaultProxySelector:

So I re-used the same logic which results in a highly similar code. I have two concerns:

I will probably refactor and simplify a bit other proxy related methods, including the duplicate of inNoProxyEnvVar, but this will be the subject of another PR.

@etiennebec
Copy link
Contributor Author

etiennebec commented Jan 2, 2018

Didn't expect you to review my new commits so quickly. 👍

Jenkins project does not support Java 9 so far. Is it possible to have a Java8-compatible implementation without deprecated classes?

The code is actually Java8-compatible (I don't even have the JDK9 installed on my computer).

When I say in the comment that the implementation supports only Java9, I'm referring to the previous DefaultProxySelector implementation which was more permissive than what was described in the official documentation, and allowed the use of regex in nonProxyHosts entries.

As mentioned in my previous message Java9 restored the expected and correct behavior.

@oleg-nenashev
Copy link
Member

Sorry, slipped down in my priority list

@oleg-nenashev
Copy link
Member

I will try to play with that in order to deliver it in Remoting 3.18 (which will be likely an LTS candidate). Sorry for the review delay, JEP-200 consumed much my capacity

@etiennebec
Copy link
Contributor Author

Thanks for all your effort on JEP-200. 👍

Don't worry, we're compiling our own version of jenkins/remoting/plugins in my company, so it's not an issue if it takes some time for this PR to be mainlined. Just trying to give back to the community!

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

LGTM

@oleg-nenashev
Copy link
Member

CC @rysteboe . I think we can land it

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Argh, sorry, this slipped off my radar. Agreed, LGTM.

@ghost ghost merged commit dfb65c8 into jenkinsci:master Mar 5, 2018
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants