You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tamaya.apache.org by "William Lieurance (JIRA)" <ji...@apache.org> on 2018/01/30 06:38:00 UTC
[jira] [Created] (TAMAYA-326) ServiceLoader picks second available
service provider even if the ordinal is lower
William Lieurance created TAMAYA-326:
----------------------------------------
Summary: ServiceLoader picks second available service provider even if the ordinal is lower
Key: TAMAYA-326
URL: https://issues.apache.org/jira/browse/TAMAYA-326
Project: Tamaya
Issue Type: Bug
Reporter: William Lieurance
While adding some test coverage on the api, I found that org.apache.tamaya.spi.ServiceContextManager has a bug as it searches for the default service provider in loadDefaultServiceProvider. Namely, the "highestOrdinal" is not set after the first service provider is found, so any following service provider with an ordinal higher than 0 will be used, even if that ordinal is lower than the first one's.
I modified the test ServiceContext to demonstrate the bug, as well as fixed the logic on my branch in github. Note that if you run the tests against the ServiceContextManager as-is, they will fail.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
Re: [jira] [Created] (TAMAYA-326) ServiceLoader picks second
available service provider even if the ordinal is lower
Posted by Anatole Tresch <at...@gmail.com>.
+1 Thank you very much!
Am 30.01.2018 23:43 schrieb "P. Ottlinger" <po...@apache.org>:
> Hi William,
>
> thanks for spotting the bug ....
> sounds reasonable to me.
>
> Please feel free to raise a pull request to the offical repo via Github.
>
> +1 from my side
>
> Phil
>
> Am 30.01.2018 um 07:38 schrieb William Lieurance (JIRA):
> > William Lieurance created TAMAYA-326:
> > ----------------------------------------
> >
> > Summary: ServiceLoader picks second available service
> provider even if the ordinal is lower
> > Key: TAMAYA-326
> > URL: https://issues.apache.org/jira/browse/TAMAYA-326
> > Project: Tamaya
> > Issue Type: Bug
> > Reporter: William Lieurance
> >
> >
> > While adding some test coverage on the api, I found that
> org.apache.tamaya.spi.ServiceContextManager has a bug as it searches for
> the default service provider in loadDefaultServiceProvider. Namely, the
> "highestOrdinal" is not set after the first service provider is found, so
> any following service provider with an ordinal higher than 0 will be used,
> even if that ordinal is lower than the first one's.
> >
> > I modified the test ServiceContext to demonstrate the bug, as well as
> fixed the logic on my branch in github. Note that if you run the tests
> against the ServiceContextManager as-is, they will fail.
> >
> >
> >
> > --
> > This message was sent by Atlassian JIRA
> > (v7.6.3#76005)
> >
>
>
Re: [jira] [Created] (TAMAYA-326) ServiceLoader picks second
available service provider even if the ordinal is lower
Posted by "P. Ottlinger" <po...@apache.org>.
Hi William,
thanks for spotting the bug ....
sounds reasonable to me.
Please feel free to raise a pull request to the offical repo via Github.
+1 from my side
Phil
Am 30.01.2018 um 07:38 schrieb William Lieurance (JIRA):
> William Lieurance created TAMAYA-326:
> ----------------------------------------
>
> Summary: ServiceLoader picks second available service provider even if the ordinal is lower
> Key: TAMAYA-326
> URL: https://issues.apache.org/jira/browse/TAMAYA-326
> Project: Tamaya
> Issue Type: Bug
> Reporter: William Lieurance
>
>
> While adding some test coverage on the api, I found that org.apache.tamaya.spi.ServiceContextManager has a bug as it searches for the default service provider in loadDefaultServiceProvider. Namely, the "highestOrdinal" is not set after the first service provider is found, so any following service provider with an ordinal higher than 0 will be used, even if that ordinal is lower than the first one's.
>
> I modified the test ServiceContext to demonstrate the bug, as well as fixed the logic on my branch in github. Note that if you run the tests against the ServiceContextManager as-is, they will fail.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v7.6.3#76005)
>