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

jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans-html4j.git


The following commit(s) were added to refs/heads/master by this push:
     new a1e64b7  Report the error only when the URL is really read
     new dd664c0  Let the boot-script tests that don't need URL pass
a1e64b7 is described below

commit a1e64b78c1bdf8d0468858ae71b85623e3473478
Author: Jaroslav Tulach <jaroslav.tul...@oracle.com>
AuthorDate: Fri Feb 2 09:35:08 2018 +0100

    Report the error only when the URL is really read
---
 .../org/netbeans/html/boot/fx/AbstractFXPresenter.java     |  1 +
 boot/src/main/java/net/java/html/boot/BrowserBuilder.java  | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/boot-fx/src/main/java/org/netbeans/html/boot/fx/AbstractFXPresenter.java 
b/boot-fx/src/main/java/org/netbeans/html/boot/fx/AbstractFXPresenter.java
index fc99d40..d9752df 100644
--- a/boot-fx/src/main/java/org/netbeans/html/boot/fx/AbstractFXPresenter.java
+++ b/boot-fx/src/main/java/org/netbeans/html/boot/fx/AbstractFXPresenter.java
@@ -26,6 +26,7 @@ import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Array;
 import java.net.URL;
+import java.net.URLConnection;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
diff --git a/boot/src/main/java/net/java/html/boot/BrowserBuilder.java 
b/boot/src/main/java/net/java/html/boot/BrowserBuilder.java
index e534184..1bf9c28 100644
--- a/boot/src/main/java/net/java/html/boot/BrowserBuilder.java
+++ b/boot/src/main/java/net/java/html/boot/BrowserBuilder.java
@@ -27,6 +27,7 @@ import java.net.JarURLConnection;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
+import java.net.URLStreamHandler;
 import java.security.ProtectionDomain;
 import java.util.Arrays;
 import java.util.Collection;
@@ -233,7 +234,18 @@ public final class BrowserBuilder {
         IOException mal[] = { null };
         URL url = findLocalizedResourceURL(resource, locale, mal, myCls);
         if (url == null) {
-            throw new NullPointerException("Cannot find page " + resource + " 
to display");
+            final IOException ex = new IOException("Cannot find page " + 
resource + " to display");
+            class InvalidHandler extends URLStreamHandler {
+                @Override
+                protected URLConnection openConnection(URL u) throws 
IOException {
+                    throw ex;
+                }
+            }
+            try {
+                url = new URL("resource", null, -1, resource, new 
InvalidHandler());
+            } catch (MalformedURLException malformed) {
+                throw new IllegalStateException(malformed);
+            }
         }
         
         Fn.Presenter dfnr = null;

-- 
To stop receiving notification emails like this one, please contact
jtul...@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to