Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » UniqueValueValidationService init() fails with @NoDuplicates declared on super class property
UniqueValueValidationService init() fails with @NoDuplicates declared on super class property [message #1115531] Tue, 24 September 2013 08:15 Go to next message
Greg Amerson is currently offline Greg Amerson
Messages: 116
Registered: March 2010
Senior Member
Hey guys,

I have a model where a Portlet has a ElementList property for a list of Params, the Param object itself is just a sub-class that inherits from several super interfaces namely, the NameValue element. This NameValue element has a Name property that specifies @NoDuplicates.

This relationship appears to be giving UniqueValueValidationService some problems. Here is the stack trace.

java.lang.IllegalStateException: UniqueValueValidationService data accessed prior to service initialization.
	at org.eclipse.sapphire.services.DataService.data(DataService.java:60)
	at org.eclipse.sapphire.services.ValidationService.validation(ValidationService.java:49)
	at org.eclipse.sapphire.Property.refreshValidation(Property.java:253)
	at org.eclipse.sapphire.Property.validation(Property.java:410)
	at org.eclipse.sapphire.ui.PropertyEditorPart.computeValidation(PropertyEditorPart.java:646)
	at org.eclipse.sapphire.ui.SapphirePart.refreshValidation(SapphirePart.java:454)
	at org.eclipse.sapphire.ui.SapphirePart.validation(SapphirePart.java:425)
	at org.eclipse.sapphire.ui.FormPart.computeValidation(FormPart.java:157)
	at org.eclipse.sapphire.ui.SapphirePart.refreshValidation(SapphirePart.java:454)
	at org.eclipse.sapphire.ui.SapphirePart.validation(SapphirePart.java:425)
	at org.eclipse.sapphire.ui.form.editors.masterdetails.MasterDetailsContentNode.computeValidation(MasterDetailsContentNode.java:710)


I trace this problem down to this line:

UniqueValueValidationService.java line 54 where is tries to create the index. In the index() method the following must be true
property.getModelElementType() == entryType
However in my adopter case this isn't true, the property.getModelElementType() is on a super-interface of entryType. However the following expression does evaluate to true in my adopter case:
property.getModelElementType().getModelElementClass().isAssignableFrom(entryType.getModelElementClass())
Because in my case property.getModelElementType() is a super element to that of entryType. When the index() call fails, then the overall initValidationService() call fails so the service is never initialized properly and this eventually leads to the error in the UI part saying that validation is happening on a validation service that was never initialized.

Thoughts? Is it valid to add this case to the logic of the ElementList.index() method?

[Updated on: Tue, 24 September 2013 15:03]

Report message to a moderator

Re: UniqueValueValidationService init() fails with @NoDuplicates declared on super class property [message #1115580 is a reply to message #1115531] Tue, 24 September 2013 09:38 Go to previous messageGo to next message
Greg Amerson is currently offline Greg Amerson
Messages: 116
Registered: March 2010
Senior Member
I was able to fix this locally by doing this: https://github.com/gamerson/sapphire/commit/94ebbb36b62ddb060add868c5b9bd05a4a0ca2c0

Btw, how do we contribute code to sapphire now? I noticed it isn't in gerrit yet. Attaching patches to bugzilla still the best way? I guess its git patches now?
Re: UniqueValueValidationService init() fails with @NoDuplicates declared on super class property [message #1115797 is a reply to message #1115580] Tue, 24 September 2013 15:35 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 941
Registered: July 2009
Senior Member
Please open a bug and attach a patch. Sapphire isn't in gerrit yet as there hasn't been much call for that so far.

Eclipse Foundation now requires all contributors to accept the new Contributor License Agreement (CLA). Nothing in the agreement is new. They are just trying to automate the bookkeeping. You can see CLA status next to your name in any bugzilla task. Click on that button and follow the instructions. This needs to be completed before I can merge your fix.
Re: UniqueValueValidationService init() fails with @NoDuplicates declared on super class property [message #1116287 is a reply to message #1115797] Wed, 25 September 2013 07:40 Go to previous message
Greg Amerson is currently offline Greg Amerson
Messages: 116
Registered: March 2010
Senior Member
Opened and attached! https://bugs.eclipse.org/bugs/show_bug.cgi?id=417977

I have signed the CLA using the projects portal thing, but it hasn't updated my icon just yet.
Previous Topic:sapphire wizard displaying initial error message
Next Topic:Sapphire 0.7 delayed
Goto Forum:
  


Current Time: Tue Oct 21 02:13:23 GMT 2014

Powered by FUDForum. Page generated in 0.01726 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software