Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have validator validating, for instance, input data. It gets object product (class Product) created with default constructor. One of Product fields is description, and it has #NotNull annotation.
When I run test it fails obviously and shows NullPointerException. I can surround part of code where NullPointerException was thrown with if-else like this
if(description!=null){
// product validation
}else{
errors.rejectValue("description", errorCode, defaultMessage);
}
That works, but i need something else, maybe using annotations.
You con use something like Mockito to create a mock of the BindingResult that has a method hasErrors() to check for any errors.
See more solutions...
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Hello have problem with the value string and cant compile cause of this
screenshot of the error
https://i.stack.imgur.com/laGkq.png
can someone help? thanks!
You can't assign a generic type to a value in Java since it needs to know what's being set in the memory (for the length).
For more information, you should read a bit about Generic Types
It's hard without the that small amount of code to tell, but normally, if you remove the (T), you should not get that error.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
ProcessEngines.getDefaultProcessEngine()
return me null when I try init a new process in activiti engine.
Do you know what could be the reason ?
Taken from the Activi forums user frederikheremans:
As stated in the Javadoc for ProcessEngines, this class is used by a
ServletContextListener, which calls the ProcessEngines.init(). The
init() will scan the classpath for activiti.properties an tries to
build a ProcessEngine for each file found.
The getDefaultProcessEngine() only works [if] the ProcessEngines.init()
has been called (by
org.activiti.impl.servlet.listener.ProcessEnginesServletContextListener
or by calling it yourself once) and if a process-engine with name
'default' is available.
The OP of the thread I got that from stated that he too received null from getDefaultProcessEngine. Hope that helps.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
THROW:-We have to handle the exception(we in the sense user here).
Throws:We are asking the compiler to handle the exception raised.
Please correct if what I stated above is wrong . If wrong please tell me the correct statement.
Thanks in Adv!
I'd say that both are not exact.
throw statement causes throwing of exception. No-one has to catch it however. For example runtime exception can be thrown without any requirement to catch them in application code.
throws is a keyword that allows to declare that method may throw exception of specific type.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I was reading up this code review questions here and tutorial by BalusC. In that I have found that exception classes are extended.
What is the need of it? I read something along the lines of client layer should not know SQLExecption but I am not sure I understand it.
Could you reason why to make specialized exceptions? What if my DAO method does not have throws and the client code is in a try-catch.?
Because DAO could be today throw SQLException tomorrow if you want to change DAO layer to write to File, it might result in FileNotFoundException, So hiding underlying stuff you show to your client what matters to them (custom business sensible Exception)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
How transmit parameters from href by not method GET?
I use spring. maybe spring tools can to help me?
by method get:
${candidate.name}
candidate.id transmit by get method
How transmit candidate.id by Post(for example method)?
No,By default href hits get method,There is no way to specify a method.
Try some html form to specify Method's or move your logic to GET.
If you can use client script (javascript),There is possibility do it with.