code: public static boolean sameResource(URI uri, String otherResource) {
          try {
              return createUri(otherResource).equals(uri);
          } catch(DataSourceException e) {
              return false;
          }
      }
docs: Determine if two URIs refer to the same resource.
  
  The function safely attempts to convert the otherResource parameter to a
  URI object before comparing.
  
  @return true if the address and port match the current in-use values.