findbugs reports these bugs about my project code.
class channelBean defines non-transient non-serializable instance field subscriptionDao
in ChannelBean.java
Field com.derbyware.qtube.beans.ChannelBean.subscriptionDao
Actual type com.derbyware.qtube.dao.SubscriptionDao
Code:
@Named
@ViewScoped
public class ChannelBean extends BaseBacking implements Serializable {
private static final long serialVersionUID = 1L;
@EJB
private SubscriptionDao subscriptionDao;
Why it says that my EJB should be serializable? I never come across such recommendation before.
AND
getCorrectAnswerTwo()
May expose internal representation by returning reference to mutable object
Code:
public String[] getCorrectAnswerTwo() {
return correctAnswerTwo;
}
I need to display the array in jsf pages. So Why the tool reports that this is a problem.
AND
setCorrectAnswers May expose internal representation by incorporating reference to mutable object
public void setCorrectAnswers(String[] correctAnswers) {
this.correctAnswers = correctAnswers;
}
AND
it says I should use Integer.parseInt()
instead of Integer.valueOf()
. Why is that?