Skip to main content



      Home
Home » Modeling » TMF (Xtext) » How to disable error message from Composite EValidator
How to disable error message from Composite EValidator [message #1754273] Wed, 15 February 2017 22:03 Go to next message
Eclipse UserFriend
I am getting this error message whenever there is an invalid cross-reference configuration.

1    [main] ERROR text.validation.CompositeEValidator  - Error executing EValidator
java.lang.NullPointerException
	at org.prscDeveloper.impl.TestImpl.getSName(Unknown Source)
	at org.prscDeveloper.impl.TestImpl.eIsSet(Unknown Source)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObjectImpl.java:1241)
	at org.eclipse.emf.ecore.util.EObjectValidator.validate_DataValueConforms(EObjectValidator.java:832)
	at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryDataValueConforms(EObjectValidator.java:820)
	at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryDefaultConstraint(EObjectValidator.java:363)
	at org.eclipse.emf.ecore.util.EObjectValidator$DynamicEClassValidator.validate(EObjectValidator.java:1420)
	at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:333)
	at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:151)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:171)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:158)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
	at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
	at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
	at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
	at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:70)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
	at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:39)
	at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:120)
	at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:146)
	at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:124)
	at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:90)
	at org.generator.Main.runValidator(Unknown Source)
	at org.generator.Main.main(Unknown Source)


As the "Couldn't resolve reference to... " error message is already being displayed, why does this have to show up? Can I disable this?
Re: How to disable error message from Composite EValidator [message #1754275 is a reply to message #1754273] Thu, 16 February 2017 01:47 Go to previous messageGo to next message
Eclipse UserFriend
Wouldn't or be interesting why the validator crashes?
You want to prevent it from crashing or disable certain validations

Do you have any hints on how to reproduce this
Re: How to disable error message from Composite EValidator [message #1754290 is a reply to message #1754275] Thu, 16 February 2017 03:50 Go to previous messageGo to next message
Eclipse UserFriend
My xcore model is this:
class Model {
	contains EObject[] greetings
}

class Greeting {
	refers Test sample
	int age
	derived String sname get {
		sample.SName
	}
}

class Test {
	String sName
	String date
}


xtext:
Model:
	greetings+=(Greeting| Test)*;
	
Greeting:
	'Hello' sample=[Test] 'age' age=INT '!';
Test:
	'Bye' sName=ID '!' 'see' 'you' date=ID';'
;



My input is:
Hello a age 1!
Bye abc! see you today;

And I get the "Couldn't resolve reference" error which was expected but it also shows this NullPointerException which is already redundant.
I am running from a runnable jar.
Re: How to disable error message from Composite EValidator [message #1754301 is a reply to message #1754290] Thu, 16 February 2017 04:29 Go to previous messageGo to next message
Eclipse UserFriend
its actually not redundant, its redundant on how you implement your sname thingy right? by making it nullsafe?

but why dont you use a op instead of a derived in your xcore?

class Greeting {
	refers Test sample
	int age
	op String getSname() {
		sample.SName
	}
}



of course you can do disable the validation completely or partially

public class CustomCompositeEValidator extends CompositeEValidator {
	
	@Override
	protected void initDefaults() {
		if (isUseEObjectValidator()) {
			this.addValidator(new EObjectValidator() {
				@Override
				public boolean validate_EveryProxyResolves(EObject eObject, DiagnosticChain diagnostics,
						Map<Object, Object> context) {
					// don't check, we have our own implementation, which creates nicer messages
					return true;
				}

				@Override
				public boolean validate_NoCircularContainment(EObject eObject, DiagnosticChain diagnostics,
						Map<Object, Object> context) {
					// don't check
					return true;
				}

				@Override
				protected boolean validate_DataValueConforms(EObject eObject, EAttribute eAttribute,
						DiagnosticChain diagnostics, Map<Object, Object> context) {
					//maybe some custom logic, maybe always, depends on the cases where you want to disable the validation
					if (1==1) return true;
					return super.validate_DataValueConforms(eObject, eAttribute, diagnostics, context);
				}
			});
		}
	}

}


def Class<? extends org.eclipse.xtext.validation.CompositeEValidator> bindCompositeEValidator() {
		return Custom CompositeEValidator
	}


Re: How to disable error message from Composite EValidator [message #1754379 is a reply to message #1754301] Fri, 17 February 2017 01:10 Go to previous messageGo to next message
Eclipse UserFriend
What exactly is the difference between derived and op? I thought that you use op when you need to do some data manipulation, but simply getting the name should be a derived method, right? Or is it because I am using the cross-reference?
Re: How to disable error message from Composite EValidator [message #1754390 is a reply to message #1754379] Fri, 17 February 2017 03:05 Go to previous message
Eclipse UserFriend
it seems the validator validates derived (properties) different than operations
Previous Topic:createProposals gets called twice within same context
Next Topic:Autocompletion on deployed xtext feature not working
Goto Forum:
  


Current Time: Wed Jul 23 16:19:37 EDT 2025

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

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

Back to the top