Thanks for your reply. I’ve tried your suggested fix and it works. As you said this seems to be an oversight, as for impact, the test suite continues to pass. I’ll submit an issue and pull-request once my JIRA account comes through.
Thanks much 🙏 > On Apr 29, 2025, at 14:13, Richard S. Hall <he...@ungoverned.org> wrote: > > I haven't looked at this stuff in years, so I'm probably not going to be much > help, but... > > I believe you are correct and this looks like an oversight in > LazyLocalResourceImpl. > > Looking at the code, LocalResource extends ResourceImpl, which does implement > equals() (checking symbolic name and version). > > The private method LazyLocalResourceImpl.getResource() returns an instance of > LocalResourceImpl(), which it uses as the basis for all of its method > implementations. This would lead one to believe that equality for > LazyLocalResourceImpl should be something like: > > public boolean equals(Object o) { > return getResource().equals(o); > } > > I'm not sure if there are any ramifications, but you could file a bug > report/patch. > > Richard > > On 4/28/25 15:18, James Roome wrote: >> Hi there, >> >> I'm trying to figure out how to stop OBR downloading a Bundle I already have >> locally, and am hoping someone can give me some clarity on what is wrong >> with my approach. >> >> I have Bundle A Version 1.1 installed locally. >> I also have OBR configured with a remote repository, which also has Bundle A >> Version 1.1 indexed. >> >> When I query >> repositoryAdmin.discoverResources("(&(symbolicName=${bundleA.symbolicName})(version=${bundleA.version}))" >> It only returns 1 resource, the remote resource (and from looking at >> RepositoryAdminImpl it intentionally doesn't look at the system or local >> repos). >> So I then add this resource to the Resolver. >> >> Fast forward to when I am calling resolver.deploy(), looking at the >> ResolverImpl I can see the path where the local resource can be found and >> then nothing will be done (because nothing needs to be done) >> But the check that is causing the remote resource to download is: >> if (!localResource.equals(deployResource)) >> >> The localResource and the (remote) deployResource are two different objects, >> and the localResource is a LazyLocalResourceImpl which has no implementation >> of equals, so is just a standard object equals and it fails since >> deployResource is a ResourceImpl. >> So we go into the if statement and the local bundle is updated with the >> remote bundle, which is unnecessary since both are Bundle A Version 1.1 >> >> >> I'm not too sure where I'm making the incorrect assumptions, any pointers in >> the right direction would be most welcome. >> >> Thanks in advance, >> James >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org >> For additional commands, e-mail: users-h...@felix.apache.org >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org > For additional commands, e-mail: users-h...@felix.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org