This class overrides only one of saveState()
and restoreState()
.
Any class that inherits the StateHolder interface must implement both saveState(javax.faces.context.FacesContext)
and restoreState(javax.faces.context.FacesContext, java.lang.Object)
or implement neither of them. Because these two methods have a tightly coupled relationship, it is not permissible to to have the saveState(javax.faces.context.FacesContext)
and restoreState(javax.faces.context.FacesContext, java.lang.Object)
methods reside at different levels of the inheritance hierarchy.
The following class defines saveState()
and not restoreState()
, so it is always in error no matter what any class that extends
it might do.
public class KibitzState implements StateHolder {
public Object saveState(FacesContext fc) {
...
}
}
[1] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 398
[2] Sun Microsystems JavaDoc for StateHolder Interface