question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slider: NullPointerException when using in dynamic TabView

See original GitHub issue

1) Environment

2) Expected behavior

When submitted the given form I do not expect a NullPointerException to be thrown.

3) Actual behavior

A NullPointerException is thrown

4) Steps to reproduce

Use the given example (extended example from PrimeFaces Demo of Slider), when clicking the “ok” button then following error is thrown:

Caused by: java.lang.NullPointerException
        at deployment.infoChantier-wildfly16-PROD.war//org.primefaces.component.slider.Slider.validate(Slider.java:106)

The error seems to be coming from the “getSubmittedValue” funtion in the Slider.java. The line: return input.getSubmittedValue() == null && input.isLocalValueSet() ? input.getValue() : input.getSubmittedValue(); returns “NULL” because the “isLocalValueSet” return “false” and so the “getSubmittedValue” is returned which is “NULL” whereas the “getValue” would return the right number.

I do not know if this helps but this is as far as I came.

5) Sample XHTML

<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui">
    <f:view>
        <h:head>
            <title>InfoChantier</title>
        </h:head>
        <h:body>
            <h:form>
                <p:tabView dynamic="true" rows="20" value="#{sliderView.tabs}" var="tab">
                    <p:tab title="#{tab}">
                        <h:panelGrid columns="1" style="margin-bottom: 10px">
                            <h:outputText id="displayRange" value="Between #{sliderView.number8} and #{sliderView.number9}" />
                            <p:slider for="txt6,txt7" display="displayRange" style="width: 400px" range="true" displayTemplate="Between {min} and {max}" />
                        </h:panelGrid>
                        <h:inputHidden id="txt6" value="#{sliderView.number8}" />
                        <h:inputHidden id="txt7" value="#{sliderView.number9}" />
                    </p:tab>
                </p:tabView>
                <p:commandButton value="Ok" />
            </h:form>
        </h:body>
    </f:view>
</ui:composition>

6) Sample bean

package lu.etat.pch.infoChantier.ejb.controllers;

import javax.inject.Named;

@Named
public class SliderView {
    private int number8 = 30;
    private int number9 = 80;

    public int getNumber8() {
        return number8;
    }

    public void setNumber8(int number8) {
        this.number8 = number8;
    }

    public int getNumber9() {
        return number9;
    }

    public void setNumber9(int number9) {
        this.number9 = number9;
    }

    public String[] getTabs() {
        String[] result = new String[2];
        result[0] = "Tab 1";
        result[1] = "Tab 2";
        return result;
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
tandraschkocommented, May 9, 2019

@mertsincan can be ported to elite

0reactions
mellowarecommented, Aug 15, 2019

I am going to close this as a Mojarra issue. We can re-open if we determine its anything other than that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is Tablayout and Viewpager crashing with ...
Why is Tablayout and Viewpager crashing with NullpointerException when I start a fragment with LoaderManager from TabFragment?
Read more >
TabView dynamic="true" error - Prime Community Forum
I have a problem with TabView and the attribute dynamic="true". ... I'm using PrimeFaces 3.5 with GlassFish 3.1.1 ... NullPointerException at java.io.
Read more >
Getting NullPointerException, the getCurrentInstance() in the ...
I am trying to implement dynamic tabs using ADF Dynamic UI Shell. After clicking on a link, a dynamic tab opens up which...
Read more >
Primefaces Tree, TreeNode, TreeTable Example Tutorial
Specifies caching on dynamically loaded nodes.When set to true expanded nodes will be kept in memory. onNodeClick, null, String, Javascript ...
Read more >
Fix list for IBM Business Automation Workflow
JR64286, CACHED ENTRIES CANNOT BE SAVED TO DISK WHILE USING DYNAMIC CACHE ... JR64511, A NULLPOINTEREXCEPTION IS THROWN AND CASE EVENT EMITTER STOPS ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found