File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
3838import java .io .IOException ;
3939import java .net .ConnectException ;
4040import java .net .MalformedURLException ;
41+ import java .net .Proxy ;
42+ import java .net .ProxySelector ;
43+ import java .net .SocketAddress ;
44+ import java .net .URI ;
4145import java .net .URL ;
4246import java .net .UnknownHostException ;
4347import java .util .ArrayList ;
@@ -57,6 +61,19 @@ public class EarlyOrDelayedParsing {
5761 {
5862 String value = System .getProperty ("jdk.net.url.delayParsing" , "false" );
5963 EARLY_PARSING = !value .isEmpty () && !Boolean .parseBoolean (value );
64+ if (!EARLY_PARSING ) {
65+ // we will open the connection in that case.
66+ // make sure no proxy is selected
67+ ProxySelector .setDefault (new ProxySelector () {
68+ @ Override
69+ public List <Proxy > select (URI uri ) {
70+ return List .of (Proxy .NO_PROXY );
71+ }
72+ @ Override
73+ public void connectFailed (URI uri , SocketAddress sa , IOException ioe ) {
74+ }
75+ });
76+ }
6077 }
6178
6279 // Some characters that when included at the wrong place
You can’t perform that action at this time.
0 commit comments