struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Hermann <therm...@mtg.de>
Subject Validation with DefaultActionValidatorManager throws NullPointerExeption
Date Wed, 26 Feb 2014 12:35:00 GMT
Hello,

In a JUnit-Test and in a Ajax-Server I try to validate an Object with 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager (Version 
2.3.15.3).

The MyObject-validation.xml file is provided in the same directory as 
the MyObject-Class (no action alias used).

I instantiate the validator manually with the new operator because the 
ActionValidatorManagerFactory is no longer supported in the version 
2.3.15.3:

--------------------------------------
DefaultActionValidatorManager validator = new 
DefaultActionValidatorManager();
validator.validate(myObject, null);
--------------------------------------

but at runtime I get a NullPointerException:

--------------------------------------
java.lang.NullPointerException
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.loadFile(DefaultActionValidatorManager.java:342)
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.buildClassValidatorConfigs(DefaultActionValidatorManager.java:245)
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.buildValidatorConfigs(DefaultActionValidatorManager.java:324)
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.buildValidatorConfigs(DefaultActionValidatorManager.java:305)
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.buildValidatorConfigs(DefaultActionValidatorManager.java:305)
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.getValidators(DefaultActionValidatorManager.java:93)
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.validate(DefaultActionValidatorManager.java:127)
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.validate(DefaultActionValidatorManager.java:119)
     at 
com.opensymphony.xwork2.validator.DefaultActionValidatorManager.validate(DefaultActionValidatorManager.java:114)
--------------------------------------

The problem seems to be caused by the fileManager, that is set to NULL.

Has anyone an idea how to solve the problem?
How is the DefaultActionValidatorManager used correctly?

Thanks,
Thomas




Mime
View raw message