You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "lbruun (JIRA)" <ji...@apache.org> on 2017/10/31 07:30:01 UTC

[jira] [Commented] (NETBEANS-90) URL generated by MemoryFileSystem invoke DNS resolution in their equals/hashCode

    [ https://issues.apache.org/jira/browse/NETBEANS-90?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16226390#comment-16226390 ] 

lbruun commented on NETBEANS-90:
--------------------------------

I think what you ask for is a convenience. As long as the Platform _itself_ doesn't use such URLs in a map then we are fine. Of course there's the constant fear that some Platform dev forgets this, but your ticket doesn't point to a concrete case where this happens.

As an *API consumer* * you can assume nothing about what URLStreamHandler is used for a particular [URL|https://docs.oracle.com/javase/8/docs/api/java/net/URL.html]. That is an implementation detail. So you have to always assume the worst, meaning never to use the URL in a map without wrapping it in some object that have a better equals/hashCode implementation. (incidentally googling for 'urlwrapper' returns a fair amount of hits).

I'm sure there are Apache Commons or Guava stuff that has convenience classes for this. Although I haven't checked.

What do you think?

*) Someone who uses the Platform classes in their own application.


> URL generated by MemoryFileSystem invoke DNS resolution in their equals/hashCode
> --------------------------------------------------------------------------------
>
>                 Key: NETBEANS-90
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-90
>             Project: NetBeans
>          Issue Type: Bug
>          Components: platform - Filesystems
>    Affects Versions: 8.2
>            Reporter: Svatopluk Dedic
>            Assignee: Svatopluk Dedic
>
> FileObjects created from MemoryFileSystem use URL format like memory://fs<number>/<path-to-file>. If such URL is added to a map or collection, the default URL.equals attempts to resolve the host path ("fs<number>") which is slow (and fails anyway).
> MemoryFileSystem creates an URLStreamHandler, but does not override hashCode/equals for URLs.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)