You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by lk...@apache.org on 2020/07/04 19:10:26 UTC
[netbeans] branch release120 updated (2c80046 -> f96a822)
This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a change to branch release120
in repository https://gitbox.apache.org/repos/asf/netbeans.git.
from 2c80046 Increasing patch specification version of openide.util and openide.lookup modules
new 27220bb Make configureproxy idenpotent when invoked multiple times
new f96a822 Using StringBuffer as msgs are accessed from multiple threads
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../netbeans/nbbuild/extlibs/ConfigureProxy.java | 75 +++++++++++-----------
1 file changed, 38 insertions(+), 37 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[netbeans] 01/02: Make configureproxy idenpotent when invoked
multiple times
Posted by lk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch release120
in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit 27220bbd767eba456bb20045072b2f9a45608785
Author: Jaroslav Tulach <ja...@oracle.com>
AuthorDate: Mon Jun 22 10:04:12 2020 +0200
Make configureproxy idenpotent when invoked multiple times
---
.../netbeans/nbbuild/extlibs/ConfigureProxy.java | 73 +++++++++++-----------
1 file changed, 38 insertions(+), 35 deletions(-)
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java
index 3b4960b..4d96452 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java
@@ -84,51 +84,21 @@ public final class ConfigureProxy extends Task {
static URLConnection openConnection(Task task, final URL url, URI[] connectedVia) throws IOException {
final URLConnection[] conn = { null };
final List<Exception> errs = new CopyOnWriteArrayList<>();
+ final StringBuilder msgs = new StringBuilder();
final CountDownLatch connected = new CountDownLatch(1);
ExecutorService connectors = Executors.newFixedThreadPool(3);
connectors.submit(() -> {
- String httpProxy = System.getenv("http_proxy");
- if (httpProxy != null) {
- try {
- URI uri = new URI(httpProxy);
- InetSocketAddress address = InetSocketAddress.createUnresolved(uri.getHost(), uri.getPort());
- Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
- URLConnection test = url.openConnection(proxy);
- test.connect();
- conn[0] = test;
- connected.countDown();
- if (connectedVia != null) {
- connectedVia[0] = uri;
- }
- } catch (IOException | URISyntaxException ex) {
- errs.add(ex);
- }
- }
+ checkProxyProperty("http_proxy", url, conn, connectedVia, connected, errs, msgs);
});
connectors.submit(() -> {
- String httpProxy = System.getenv("https_proxy");
- if (httpProxy != null) {
- try {
- URI uri = new URI(httpProxy);
- InetSocketAddress address = InetSocketAddress.createUnresolved(uri.getHost(), uri.getPort());
- Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
- URLConnection test = url.openConnection(proxy);
- test.connect();
- conn[0] = test;
- connected.countDown();
- if (connectedVia != null) {
- connectedVia[0] = uri;
- }
- } catch (IOException | URISyntaxException ex) {
- errs.add(ex);
- }
- }
+ checkProxyProperty("https_proxy", url, conn, connectedVia, connected, errs, msgs);
});
connectors.submit(() -> {
try {
- URLConnection test = url.openConnection();
+ URLConnection test = url.openConnection(Proxy.NO_PROXY);
test.connect();
conn[0] = test;
+ msgs.append("\nNo proxy connected");
connected.countDown();
} catch (IOException ex) {
errs.add(ex);
@@ -142,9 +112,42 @@ public final class ConfigureProxy extends Task {
for (Exception ex : errs) {
task.log(ex, Project.MSG_ERR);
}
+ task.log(msgs.toString(), Project.MSG_ERR);
throw new IOException("Cannot connect to " + url);
+ } else {
+ task.log(msgs.toString(), Project.MSG_DEBUG);
}
return conn[0];
}
+ private static void checkProxyProperty(
+ String propertyName, final URL url,
+ final URLConnection[] conn, URI[] connectedVia,
+ final CountDownLatch connected,
+ final List<Exception> errs,
+ StringBuilder msgs
+ ) {
+ String httpProxy = System.getenv(propertyName);
+ msgs.append("\n[" + propertyName + "] set to " + httpProxy);
+ if (httpProxy != null) {
+ try {
+ URI uri = new URI(httpProxy);
+ InetSocketAddress address = InetSocketAddress.createUnresolved(uri.getHost(), uri.getPort());
+ Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
+ URLConnection test = url.openConnection(proxy);
+ test.connect();
+ msgs.append("\n[" + propertyName + "] connected");
+ conn[0] = test;
+ if (connectedVia != null) {
+ connectedVia[0] = uri;
+ }
+ connected.countDown();
+ msgs.append("\n[" + propertyName + "] countDown");
+ } catch (IOException | URISyntaxException ex) {
+ errs.add(ex);
+ msgs.append("\n[" + propertyName + "] exception " + ex.getMessage());
+ }
+ }
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[netbeans] 02/02: Using StringBuffer as msgs are accessed from
multiple threads
Posted by lk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
lkishalmi pushed a commit to branch release120
in repository https://gitbox.apache.org/repos/asf/netbeans.git
commit f96a822f957d13ef2735126a7f6b9a80283e3cac
Author: Jaroslav Tulach <ja...@oracle.com>
AuthorDate: Wed Jul 1 09:57:03 2020 +0200
Using StringBuffer as msgs are accessed from multiple threads
---
nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java
index 4d96452..eb71bb9 100644
--- a/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java
+++ b/nbbuild/antsrc/org/netbeans/nbbuild/extlibs/ConfigureProxy.java
@@ -26,8 +26,6 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
@@ -84,7 +82,7 @@ public final class ConfigureProxy extends Task {
static URLConnection openConnection(Task task, final URL url, URI[] connectedVia) throws IOException {
final URLConnection[] conn = { null };
final List<Exception> errs = new CopyOnWriteArrayList<>();
- final StringBuilder msgs = new StringBuilder();
+ final StringBuffer msgs = new StringBuffer();
final CountDownLatch connected = new CountDownLatch(1);
ExecutorService connectors = Executors.newFixedThreadPool(3);
connectors.submit(() -> {
@@ -125,7 +123,7 @@ public final class ConfigureProxy extends Task {
final URLConnection[] conn, URI[] connectedVia,
final CountDownLatch connected,
final List<Exception> errs,
- StringBuilder msgs
+ StringBuffer msgs
) {
String httpProxy = System.getenv(propertyName);
msgs.append("\n[" + propertyName + "] set to " + httpProxy);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists