2 Replies Latest reply on Feb 15, 2012 4:56 AM by Sunil Chauraha

    java.lang.NullPointerException while clicking on a link

    Sunil Chauraha Newbie

      Hi All,

       

      I have an strang problem on UAT and PRODUCTION.

      When a user clicks on some link he/she gets the following error.

       

      java.lang.NullPointerException
      at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:1645)
      at javax.faces.component.UIComponentBase$AttributesMap.put(UIComponentBase.java:1515)
      at org.ajax4jsf.taglib.html.facelets.KeepAliveHandler.apply(KeepAliveHandler.java:80)
      at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
      at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
      at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
      at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
      at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
      at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
      at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
      at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
      at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
      at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
      at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:144)
      at com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:55)
      at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
      at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
      at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
      at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)

      This error does not occur on our integration environment and dev environment.

       

      We are using spring web-flow and richfaces in our application.

      Here are the information about jar files.

       

      com.springsource.com.sun.facelets-1.1.14.jar

      com.springsource.com.sun.faces-1.2.0.08.jar

      jsf-facelets-1.0.10.jar

      org.springframework.faces-2.0.3.RELEASE.jar

      org.springframework.web-2.5.5.A.jar

      org.springframework.webflow-2.0.3.RELEASE.jar

      richfaces-ui-3.3.3.Final.jar

      richfaces-impl-jsf2-3.3.3.Final.jar

      richfaces-impl-3.3.3.Final.jar

      richfaces-api-3.3.3.Final.jar

      Please find the attached source code.

       

      <h:commandLink immediate="true" onclick="showMashaWaitDialog();" rendered="#{!caseProc.documentRelated}" action="relatedProceedingViewAction" >

       

      <f:setPropertyActionListener target="#{caseFormBean.caseId}" value="#{caseProc.caseId}"  />

       

      <f:setPropertyActionListener target="#{caseFormBean.caseType}" value="#{caseProc.caseType}"  />

       

      <f:setPropertyActionListener target="#{caseFormBean.caseSubtype}" value="#{caseProc.caseSubtype}" />

       

      <f:setPropertyActionListener target="#{caseFormBean.proceedingId}" value="#{proceeding.proceedingId}" />

       

      <f:setPropertyActionListener target="#{noottyFormBean.caseId}" value="#{proceeding.case1.caseId}" />

       

      <f:setPropertyActionListener target="#{noottyFormBean.proceedingId}" value="#{proceeding.proceedingId}" />

       

      <f:setPropertyActionListener target="#{partyFormBean.proceedingId}" value="#{proceeding.proceedingId}" />

       

      <f:setPropertyActionListener target="#{resolutionFormBean.proceedingId}" value="#{proceeding.proceedingId}" />

       

      <f:setPropertyActionListener target="#{resolutionFormBean.caseId}" value="#{proceeding.case1.caseId}" />

       

      <f:setPropertyActionListener target="#{partyFormBean.caseId}" value="#{proceeding.case1.caseId}" />

       

      <f:setPropertyActionListener target="#{historyFormBean.caseId}" value="#{proceeding.case1.caseId}" />

       

      <f:setPropertyActionListener target="#{historyFormBean.proceedingId}" value="#{proceeding.proceedingId}" />

      <ui:include src="../casesAndProceedingsCommon/proceedingLinkInCaseListView.xhtml" />

      </h:commandLink>

       

      Its an urgent issue.

      Please help me. Thanks in advance.

       

      --

      Sunil C

        • 1. Re: java.lang.NullPointerException while clicking on a link
          Jorge Campos Newbie

          Hi Sunil,

           

          In order to understand what is the real code for this?

          action="relatedProceedingViewAction"

           

          Jorge Campos

          • 2. Re: java.lang.NullPointerException while clicking on a link
            Sunil Chauraha Newbie

            Hi Jorge,

             

            this action 'relatedProceedingViewAction' is defined as a transition inside a flow definition in an xml file (since we are using spring web flow).

             

             

             

             

             

             

             

             

             

             

             

             

             

            <

             

            transition on="relatedProceedingViewAction" to="relatedProceedingView"

            >

             

            <set name=

            "caseFormBean.showProceedingDetailsToModify"

             

            value="false"

            />

             

            <set name=

            "caseFormBean.showProceedingDetailsToReadOnly"

             

            value="true"

            />

             

            <set name="proceedingFormBean.showProceedingEditButton" value="true"

            />

             

            <set name="proceedingFormBean.showProceedingSaveButton" value="false"

            />

             

            <set name="proceedingFormBean.showProceedingReturnButton" value="false"

            />

             

            <set name="proceedingFormBean.showAddAppealProceedingButton" value="true"

            />

             

            <set name="proceedingFormBean.showProceedingDeleteButton" value="false"

            />

             

            <evaluate expression=

            "proceedingServiceAction.showProceedingRelatedData(caseFormBean,personCaseAndProcTO,messageContext,flowRequestContext)"

             

            result="caseFormBean" />

             

            </transition

            >

             

            and java code is here.

            public

            CaseFormBean showProceedingRelatedData(CaseFormBean pCaseFormBean,PersonCaseAndProcTO personCaseAndProcTO,MessageContext pMessageContext, RequestContext flowRequestContext) {

             

            logger.info("Inside show proceeing data...");

             

            ServiceLocator locator =

            null;

            List<AccidentResolutionVO> accidentResolutions =

            null;

            pCaseFormBean.setAddingNewProceeding(

            false);

            personCaseAndProcTO =

            new PersonCaseAndProcTO();

             

            try {

            locator = ServiceLocator.getInstance();

             

            caseServiceRemote = (CaseServiceRemote) locator.lookup("test.facade.CaseServiceRemote");

            Integer personId = (Integer) flowRequestContext.getExternalContext().getSessionMap().get(

            "personId");

             

            if(null==personId){

            personId = pCaseFormBean.getPersonId();

            PersonSearchCriteriaTO criteriaTO =

            new PersonSearchCriteriaTO();

            criteriaTO.setPersonId(personId);

            setPersonIntoSession(

            new Person(), criteriaTO, caseServiceRemote, flowRequestContext);

            }

             

            personCaseAndProcTO.setPersonId(personId);

            personCaseAndProcTO.setCaseId(pCaseFormBean.getCaseId());

            personCaseAndProcTO.setProceedingId(pCaseFormBean.getProceedingId());

            personCaseAndProcTO.setCaseSubtype(pCaseFormBean.getCaseSubtype());

            personCaseAndProcTO.setOperation(MashaConstants.

            SHOW_PROCEEDING_RELATED_DATA);

             

            pCaseFormBean.setSelectedTab(

            "Perustiedot");

             

            //If we are in document's cases n proceeding the code inside if will be executed, other wise code of else block will be executed to show normal proceeding view.

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

             

            if(pCaseFormBean.getShowDocAttachFragmentProcView() != null

            && pCaseFormBean.getShowDocAttachFragmentProcView()){

            pCaseFormBean.setSelectedTab(

            "Asiakirjat"

            );

            pCaseFormBean.setDocumentViewSelectedTab(

            "DocumentsToimenpiteet"

            );

            ActionTO actionTO =

            new

            ActionTO();

            Integer documentCaseId = pCaseFormBean.getDocumentCaseId();

            actionTO.setCaseId(documentCaseId);

            Integer documentProceedingId = pCaseFormBean.getDocumentProceedingId();

            actionTO.setProceedingId(documentProceedingId);

            actionTO.setInquiryID(

            null

            );

            actionTO.setOpenState(

            true

            );

            actionTO.setInProgressState(

            true

            );

            actionTO.setAlarmState(

            true

            );

            actionTO.setReadyState(

            true

            );

            List<ActionsListObject> actionObjectList = loadActions(actionTO, pCaseFormBean, flowRequestContext);

            pCaseFormBean.setActionObjectList(actionObjectList);

            pCaseFormBean = setProceedingDetailForDocument(pCaseFormBean, flowRequestContext, personId);

             

            logger.debug("Returning from the controller, after document proceeding fetch...."

            );

            }

            else

            {

            pCaseFormBean.setSelectedTabForDS(

            "Toimenpiteet"

            );

             

             

            pCaseFormBean.setShowResolutionRowsLink(

            false

            );

            pCaseFormBean.setAccidentDateEditable(

            true

            );

            String caseOfficerId_DB =

            ""

            ;

            String caseType =

            ""

            ;

             

            if(!checkUserHasPermission("showProceedingRelatedData", getUserProfile(flowRequestContext), null

            , flowRequestContext)){

            pCaseFormBean.setMessage(

            null, getLocalizedMessage("privlige.required", flowRequestContext), MashaConstants.ERROR_MESSAGE

            , flowRequestContext, pCaseFormBean);

             

            return

            pCaseFormBean;

            }

             

            logger.info("Showing proceeding of case type : "

            +pCaseFormBean.getCaseType());

            pCaseFormBean.setShowMessage(

            false

            );

            pCaseFormBean.cleanMessages(flowRequestContext);

            NotificationFormBean.loadNotificationDropDowns(pCaseFormBean.getCaseId());

             

            logger.info("Loading dropdown data for party and resolutions"

            );

            PartyFormBean partyFormBean =

            new

            PartyFormBean();

            partyFormBean.loadPartyResolutionDropDownLists(pCaseFormBean.getCaseId(), pCaseFormBean.getProceedingId());

             

            logger.info("Loaded dropdown data for party and resolutions"

            );

            UserProfile userProfile = getUserProfile(flowRequestContext);

            String caseOfficerId = userProfile.getCaseOfficerPO() !=

            null ? userProfile.getCaseOfficerPO().getCaseOfficerId(): ""

            ;

            String cToken = getCaseOfficerLoginToken(caseOfficerId);

            setcToken(cToken);

            Integer caseId = pCaseFormBean.getCaseId();

             

            //pCaseFormBean = new CaseFormBean();

             

            logger.info("Loading case for the current proceeding as we need number of proceedings for this case . "

            );

            CaseVO caseVO =

            caseServiceRemote.getCaseVOByCaseId(caseId, MashaConstants.GET_CASEVO_BY_ID

            , userProfile);

             

            if( caseVO != null

            ){

            Integer numberOfProceedings = caseVO.getProceedings() !=

            null ? caseVO.getProceedings().size() : null

            ;

            pCaseFormBean.setNumberOfProceedingInCase(numberOfProceedings);

            caseType = caseVO.getCaseType();

            caseVO.setCaseTypeLabel(pCaseFormBean.getCaseTypeMap().get(caseType));

            caseVO.setCaseSubtypeLabel(pCaseFormBean.getCaseSubtypeMap().get(

            ""

            +caseVO.getCaseSubtype()));

            pCaseFormBean.setCaseVO(caseVO);

            String caseSubType = caseVO.getCaseSubtype();

             

            if( (caseSubType!=null && (caseSubType.equalsIgnoreCase(MashaConstants.CASE_SUBTYPES_015.toString().trim()) || caseSubType.equalsIgnoreCase(MashaConstants.CASE_SUBTYPES_016

            .toString().trim())

            || caseSubType.equalsIgnoreCase(MashaConstants.

            CASE_SUBTYPES_020.toString().trim()) || caseSubType.equalsIgnoreCase(MashaConstants.CASE_SUBTYPES_030

            .toString().trim())

            || caseSubType.equalsIgnoreCase(MashaConstants.

            CASE_SUBTYPES_090

            .toString().trim()))) ){

            pCaseFormBean.setShowResolutionRowsLink(

            true

            );

            }

             

            if(pCaseFormBean.getShowDocAttachFragmentProcView() != null

            && pCaseFormBean.getShowDocAttachFragmentProcView()){

            pCaseFormBean.getCaseVO().setDocumentRelated(

            true

            );

            }

            else

            {

            pCaseFormBean.getCaseVO().setDocumentRelated(

            false

            );

            }

            accidentResolutions = caseVO.getAccidentResolutions();

            List<AccidentResolutionVO> accidentResolutionListAfterSorting =

            new

            ArrayList<AccidentResolutionVO>();

             

            if ( accidentResolutions != null

            && accidentResolutions.size() > 0){

             

            logger.debug("Inside if loop accidentResolutions.size() ###############: "

            + accidentResolutions.size());

            Collections.sort(accidentResolutions);

            accidentResolutionListAfterSorting.add(accidentResolutions.get(0));

            }

             

            for

            (AccidentResolutionVO accidentResolutionVO : accidentResolutionListAfterSorting) {

             

            if

            (StringUtils.isNotEmpty(accidentResolutionVO.getResolution())){

             

            logger.debug("Inside for loop AccidentResolutionVO ###############"

            );

             

            //accidentResolutionVO.setResolution(pCaseFormBean.getAccidentResolResolutionMap().get(""+accidentResolutionVO.getResolution()));

            pCaseFormBean.setAccidentDateEditable(

            false

            );

            }

            }

            }

             

            // Get Proceeding

             

            logger.debug("Calling caseServiceRemote.getProceedingDetail"

            );

            ProceedingVO proceedingVO =

            caseServiceRemote.getProceedingDetail(personCaseAndProcTO, MashaConstants.GET_PROCEEDING

            , userProfile);

             

            logger.debug("Response caseServiceRemote.getProceedingDetail :"

            + proceedingVO);

             

             

            if(proceedingVO == null

            ){

            pCaseFormBean.setProceedingVO(

            new

            ProceedingVO());

             

            return

            pCaseFormBean;

            }

            else

            {

             

             

            if(proceedingVO.getIsProceedingResolved() != null

            && proceedingVO.getIsProceedingResolved() && StringUtils.isBlank(proceedingVO.getResolverId())){

            String label = getLocalizedMessage(

            "party.resolution.maker.emptyValue"

            , flowRequestContext);

            proceedingVO.setResolverId(label);

            proceedingVO.setResolverName(CaseOfficerProxy.getCaseOfficerNameById(label));

            }

             

            caseOfficerId_DB = proceedingVO.getCaseOfficerId();

            pCaseFormBean.setProceedingVO(proceedingVO);

            List<ProceedingActivationVO> procActivatList = proceedingVO.getProceedingActivations();

            List<PartyVO> partyList = proceedingVO.getParties() !=

            null ? proceedingVO.getParties() : new

            ArrayList<PartyVO>();

            List<AccidentVO> accidentsList =

            new

            ArrayList<AccidentVO>();

             

            if(proceedingVO.getCase1() != null

            ){

            pCaseFormBean.setCaseNumber(proceedingVO.getCase1().getCaseNumber());

            pCaseFormBean.setCaseId(proceedingVO.getCase1().getCaseId());

            pCaseFormBean.setCaseType(proceedingVO.getCase1().getCaseType());

            pCaseFormBean.setCaseSubtypeLabel(proceedingVO.getCase1().getCaseSubtypeLabel());

            accidentsList = proceedingVO.getCase1().getAccidents();

            }

             

            if(accidentsList == null

            ){

            accidentsList =

            new

            ArrayList<AccidentVO>();

            }

             

            if(proceedingVO.getParties() != null

            && proceedingVO.getParties().size() > 0){

            PartyVO partyVO = proceedingVO.getParties().get(0);

            pCaseFormBean.setPartyVO(partyVO);

            pCaseFormBean.setPartyId(partyVO.getPartyId());

            proceedingVO.setPartyId(partyVO.getPartyId());

            }

            pCaseFormBean.setProceedingVO(proceedingVO);

            pCaseFormBean.setProceedingId(proceedingVO.getProceedingId());

            HistoryFormBean historyFormBean = pCaseFormBean.getHistoryFormBean();

            historyFormBean.setProceedingId(proceedingVO.getProceedingId());

            historyFormBean.setViewCaseHistoryDetailsFragment(

            false

            );

             

             

            if( "006"

            .equalsIgnoreCase(proceedingVO.getProceedingReason())

            ||

            "007"

            .equalsIgnoreCase(proceedingVO.getProceedingReason())

            ||

            "007"

            .equalsIgnoreCase(proceedingVO.getProceedingSubject()) ){

            pCaseFormBean.setShowResolutionRowsLink(

            false

            );

            }

            pCaseFormBean.setSelectedProceedingDetail(pCaseFormBean, proceedingVO, procActivatList, partyList, accidentsList,

            true

            );

            }

            pCaseFormBean.setShowProceedingDetailsToReadOnly(

            true

            );

            setViewType(MashaConstants.

            SHOW_PROCEEDING

            , flowRequestContext);

            performRoleCheckForProceedingOperation(pCaseFormBean, caseOfficerId_DB, userProfile, flowRequestContext);

             

            if(pCaseFormBean.getUserAllowedToAddAppealProceeding() != null && pCaseFormBean.getUserAllowedToAddAppealProceeding() == false

            ){

             

            if(isRestrictedUser(flowRequestContext) && caseType != null && !caseType.equals("4"

            )){

            pCaseFormBean.setUserAllowedToAddAppealProceeding(

            true

            );

            }

            else

            {

            pCaseFormBean.setUserAllowedToAddAppealProceeding(

            false

            );

            }

            }

             

            if(checkUserHasPermission("PRINT_OUT"

            , userProfile, caseOfficerId_DB, flowRequestContext)){

            pCaseFormBean.setUserAllowedToPrintProceeding(

            true

            );

            }

            else

            {

            pCaseFormBean.setUserAllowedToPrintProceeding(

            false

            );

            }

            flowRequestContext.getExternalContext().getSessionMap().remove(

            "proceedingStatus"

            );

            flowRequestContext.getExternalContext().getSessionMap().put(

            "proceedingStatus"

            , proceedingVO.getProceedingStatusCode());

             

            logger.debug("Returning from the controller, after normal proceeding fetch...."

            );

            }

             

            }

            catch

            (NamingException ne) {

             

            errorCode = MashaConstants.masha_naming_exception_key

            ;

             

            errorDescription = MashaConstants.masha_naming_exception_value

            ;

             

            logger.error(String.format("errorCode = '%s' errorDescription = '%s' ", errorCode,errorDescription

            ), ne);

            pCaseFormBean.setMessage(

            errorCode, errorDescription, MashaConstants.ERROR_MESSAGE

            , flowRequestContext, pCaseFormBean);

            }

            catch

            (BusinessException mbe) {

             

            errorCode

            = mbe.getErrorCode();

             

            errorDescription

            = mbe.getErrorDescription();

             

            logger.error(String.format("errorCode = '%s' errorDescription = '%s' ", errorCode,errorDescription

            ), mbe);

            pCaseFormBean.setMessage(

            errorCode, errorDescription, MashaConstants.ERROR_MESSAGE

            , flowRequestContext, pCaseFormBean);

            }

            catch

            (Exception e){

             

            errorCode = MashaConstants.masha_application_errorcode_key_100135

            ;

             

            errorDescription = MashaConstants.masha_application_errorcode_value_100135

            ;

             

            logger.error(String.format("errorCode = '%s' errorDescription = '%s'", errorCode,errorDescription

            ),e);

            pCaseFormBean.setMessage(

            errorCode, errorDescription, MashaConstants.ERROR_MESSAGE

            , flowRequestContext, pCaseFormBean);

            }

             

            logger.info("Now show proceeding data to the view.."

            );

             

            // this is for doctor statement usecase of action module

             

            return

            pCaseFormBean;

            }