You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ge...@apache.org on 2019/10/18 10:04:01 UTC

[netbeans] 01/01: [NETBEANS-3249] Chrome connector connection with NetBeans

This is an automated email from the ASF dual-hosted git repository.

geertjan pushed a commit to branch geertjanw-patch-5
in repository https://gitbox.apache.org/repos/asf/netbeans.git

commit 214bf250aa8be5b52db7f9a1e85bf30b474062c2
Author: Geertjan Wielenga <ge...@oracle.com>
AuthorDate: Fri Oct 18 12:03:42 2019 +0200

    [NETBEANS-3249] Chrome connector connection with NetBeans
    
    When NetBeans gets the handshake from Chrome, it attempts to find the session it stored, but because the name has had '/private' inserted, the lookup fails and NetBeans refuses to debug. This fixes that.
---
 .../extbrowser/plugins/ExternalBrowserPlugin.java   | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/webcommon/extbrowser.chrome/src/org/netbeans/modules/extbrowser/plugins/ExternalBrowserPlugin.java b/webcommon/extbrowser.chrome/src/org/netbeans/modules/extbrowser/plugins/ExternalBrowserPlugin.java
index e907740..576de35 100644
--- a/webcommon/extbrowser.chrome/src/org/netbeans/modules/extbrowser/plugins/ExternalBrowserPlugin.java
+++ b/webcommon/extbrowser.chrome/src/org/netbeans/modules/extbrowser/plugins/ExternalBrowserPlugin.java
@@ -124,12 +124,19 @@ public final class ExternalBrowserPlugin {
     }
 
     private String urlToString(URL url) {
-        try {
+        String urlStr;
+        String badStart = "file:/private/var/";
+        String goodStart = "file:/var/";
+        try { 
             // try to 'normalize' the URL
-            return url.toURI().toASCIIString().toLowerCase();
-        } catch (URISyntaxException ex) {
-            return url.toExternalForm();
-        }
+            urlStr =  url.toURI().toASCIIString().toLowerCase();
+        } catch (URISyntaxException ex) { 
+            urlStr = url.toExternalForm();
+        }     
+        if (urlStr != null && urlStr.startsWith(badStart)) {
+            return goodStart + urlStr.substring(badStart.length());
+        }     
+        return urlStr;
     }
 
     /**
@@ -408,7 +415,9 @@ public final class ExternalBrowserPlugin {
                     LOG.log(Level.FINE, "awaiting URL: {0}", awaiting);  // NOI18N
                 }
             }
-            Pair pair = (u == null) ? null : awaitingBrowserResponse.remove(urlToString(u));
+            Pair pair = (u == null) ? null : awaitingBrowserResponse.remove(
+                
+                (u));
             ChromeBrowserImpl browserImpl = pair != null ? pair.impl : null;
 
             // XXX: workaround: when Web Project is run it is started as "http:/localhost/aa" but browser URL is


---------------------------------------------------------------------
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