Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5499

Platform apps cannot connect using HTTP protocol on JDK16

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 12.3
    • 12.4
    • core

    Description

      I've found out that my platfom application does not work at all with HTTP protocol when run on JDK 16. The error thrown is:

      INFO [org.netbeans.modules.autoupdate.updateproviders.AutoupdateCatalogFactory]: Unknown protocol: http
      java.lang.IllegalStateException: Unknown protocol: http
              at org.apache.felix.framework.URLHandlersStreamHandlerProxy.parseURL(URLHandlersStreamHandlerProxy.java:373)
              at java.base/java.net.URL.<init>(URL.java:701)
      Caused: java.net.MalformedURLException: Unknown protocol: http
              at java.base/java.net.URL.<init>(URL.java:706)
              at java.base/java.net.URL.<init>(URL.java:568)
              at java.base/java.net.URL.<init>(URL.java:515)
      [catch] at org.netbeans.modules.autoupdate.updateprovider.AutoupdateCatalogFactory.createUpdateProvider(AutoupdateCatalogFactory.java:98)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:567)
              at org.netbeans.core.startup.layers.BinaryFS$AttrImpl$MethodAndParams.invoke(BinaryFS.java:730)
              at org.netbeans.core.startup.layers.BinaryFS$AttrImpl.getValue(BinaryFS.java:660)
              at org.netbeans.core.startup.layers.BinaryFS$BFSBase.getAttribute(BinaryFS.java:506)
      
      
      

      No URL with http(s): protocol can be even parsed

      I managed to isolate the issue - it is caused by Apache Felix library included in NB platform that provides org.osgi.framework.launch.FrameworkFactory token.

      The bug does not occur in NetBeans IDE, which has a direct dependency (Needs: declaration) on org.netbeans.netbinox module from its ide.kit module. In NetBeans, Netbinox loads and installs its URLStreamHandlerFactory (org.eclipse.osgi.framework.internal.protocol.StreamHandlerFactory)

      In a platform app that does not load (need) Netbinox, the Felix library installs its own URLStreamHandleFactory ( org.apache.felix.framework.URLHandlers), that creates proxies. So USHF for http is actually created, but it afterwards throws MalformedURLException on any http: url spec.

      The bug does not occur on earlier JDKs.

      Attachments

        Issue Links

          Activity

            People

              sdedic Svatopluk Dedic
              sdedic Svatopluk Dedic
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2.5h
                  2.5h