Perhaps it is better to compare parts of the URI objects instead of strings. For example:

```java
static boolean compare(URI notifyUri, String repository) {
  URI repositoryUri = new URI(repository);
  return notifyUri.getScheme().equals(repositoryUri.getScheme()) && 
         notifyUri.getHost().equals(repositoryUri.getHost()) &&
         notifyUri.getPort() == repositoryUri.getPort() &&
         notifyUri.getPath().equals(repositoryUri.getPath());
}
```

What do you think?