Error in one configured extension results in not loading multiple extensions.

Hi all,

In openmrs-module-appframework the activator is loading all configured extensions.

 List<Extension> extensions = appFrameworkFactory.getExtensions();
if (extensions != null) {
       allFreeStandingExtensions.add(extensions);
}

the allFreeStandingExtensions.add(extensions) validates and adds extensions one by one to the list allFreeStandingExtensions.

     public void add(List<Extension> extensions) {
		for (Extension extension : extensions) {
			add(extension);
		}
	 }
	
	public void add(Extension extension) {
		validate(extension);
		
		synchronized (this.extensions) {
			this.extensions.add(extension);
			Collections.sort(this.extensions);
		}
	}

Here validate method throws an exception if an extension id is a duplicate, and once the exception is thrown no further extensions will be added to the list.

Eg: If there are 10 extensions and the id of the 7th extension is same the Id of any one of the extension added before it, this will throw an exception and hence the 8th, 9th and 10th extension will not be loaded as well.

Can someone please let us if this is done by choice?

In the given example won’'t it be a better approach if we manage to add the 8th, 9th and 10th extension even after the 7th throws an exception.

cc : @angshuonline @mksd

@sukreet so in your above scenario extensions 1-6 would work fine, and extension 7-10 would not be loaded, correct?

Looping in @mogoodrich and @mseaton in case they might recall.

Yes @mksd that is the current behaviour.

I think that was definitely poor design and would be better if it worked as you specify…