Skip to content
This repository was archived by the owner on Mar 20, 2021. It is now read-only.
This repository was archived by the owner on Mar 20, 2021. It is now read-only.

NullPointerException in StateHolderSaver contructor #4092

@javaserverfaces

Description

@javaserverfaces

Seems like the contructor for StateHolderSaver is not null safe?
I got a NullPointerException in a table when the state should be saved.

  1. Location in code where the constructors i called - UIComponentBase, method saveAttachedState, row 1175```
    ...
    resultList.add(new StateHolderSaver(context, value));
    ...
    
    
  2. In my case the 'value' above is null so that StateHolderSaver constructor will then throw a NullPointerException since the code invokes toSave.getClass().getName(). Se below:```
    ....
    public StateHolderSaver(FacesContext context, Object toSave) {
    this.className = toSave.getClass().getName();
    ....
    }
    
    
  • This must be a very common use case (that a 'value' is null to be persisted/restored). Is it my code that´s using the StateHolderSaver in a special way or is this a new bug in 2.1.12?

Environment

Mojarra 2.2.12, Primefaces 5.3

Affected Versions

[2.2.12]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions