>Hi Hiran, > >Your code call setURLStreamHandlerFactory, the documentation for which says >"This method can be called at most once in a given Java Virtual Machine". >Isn't this going to be a problem? >https://docs.oracle.com/javase/8/docs/api/java/net/URL.html#setURLStreamHandlerFactory-java.net.URLStreamHandlerFactory-
I thought of falling back to the already-installed URLStreamHandlerFactory so they can chain up. However there is no method to read the current value, so that attempt died. When debugging the procedure I found out that the URLStreamHandlerFactory was null during normal application runs, and it was the same on invoking Nutch. So for the time being I do not see a problem here. It could arise if a single plugin would set the factory - but then it is wiser to do this on application level (nutch) than in any plugin. To come back to your question: I believe by making use of that feature we would reduce the risk for plugin developers to get creative. Therefore I rate it a general improvent. >Additionally, does this URLStreamHandlerFactory successfully load the standard >handlers (HTTP, HTTPS...)? I would expect it to fail on these. Yes, it fails on these and returns null. Which triggers the JVM to just continue as if there were no URLStreamHandlerFactory installed. So no harm done for the well-known protocols if not overridden by plugins. >To be able to create a pull request, your repository needs to be a fork of the >original repository, which does not seem to be the case here. I thought to have forked from gitbox.apache.org but then something may be broken. Do you have an idea how I could fix this? Hiran