Expand my Community achievements bar.

SOLVED

breadcrumb issue in AEM 6.1

Avatar

Level 4

Hi Everyone,

When migrating from 5.6.1 to 6.1, I am getting an error in breadcrumb.jsp. "Type mismatch:cannot convert from Integer to long" .I don't see any issue in 5.6.1 but 6.1 it throws an error. What could be the reason?

Any ideas..?PFB the code used for breadcrumb.

 

<%--
  Breadcrumb component

--%><%@include file="/libs/foundation/global.jsp"%>
<%@include file="/apps/vaa/global/functions.jsp"%>
<%@page import="com.vaaWebsite.vaa.helpers.StaticResourceHelper,com.day.cq.wcm.api.WCMMode"%>

<%
    StaticResourceHelper resourceHelper = sling.getService(StaticResourceHelper.class);
    String clearImagePath = resourceHelper.getAkamaiPathNoTimeStamp("/content/dam/virgin-applications/images/staticpages/misc/clear.gif");

%>

<div class="breadCrumbsComp"> 
    <h2 class="aria-offscreen">You are here on our website:</h2>
    <ul class="breadcrumb">
<%

    // get starting point of trail
    long level = currentStyle.get("absParent", 2L);
    long endLevel = currentStyle.get("relParent", 0);
    String delimStr = currentStyle.get("delim", " &gt; ");
    String trailStr = currentStyle.get("trail", "");
    int currentLevel = currentPage.getDepth();
    String delim = "";
    int homeCounter = 0;
    int counter = 1;
    boolean isOnlyHomePage = true;
    String category = "";
    while (level < currentLevel - endLevel) {
        Page trail = currentPage.getAbsoluteParent((int) level);
        if (trail == null) {
            break;
        }
        String title = trail.getNavigationTitle();
        if (title == null || title.equals("")) {
            title = trail.getNavigationTitle();
        }
        if (title == null || title.equals("")) {
            title = trail.getTitle();
        }
        if (title == null || title.equals("")) {
            title = trail.getName();
        }
        if(homeCounter==0){
            title = "Home";
            homeCounter++;
        %>
        <c:set var="path" value="<%= xssAPI.getValidHref(trail.getPath()+".html") %>"/>
        <c:set var="subPath" value="${fn:substringBefore(path,'.html')}"/>
        <c:set var="sPath" value="${fn:split(subPath,'/')}" />
        <%
            String homePagePath = "";
            String[] spath=(String [])pageContext.getAttribute("sPath");
            if(null!=spath && spath.length>3) {
                if(spath[3].equals("zh-hans")){
                    homePagePath = "//stg-zh.virginatlantic.com";
                }else if(spath[3].equals("zh-hant")){
                    homePagePath = "//stg-hk.virginatlantic.com";
                }else{
                    if (WCMMode.fromRequest(request) != WCMMode.DISABLED) {
                        homePagePath = "/"+spath[2]+"/"+spath[3]+".html";
                    }else{
                        homePagePath = "/"+spath[2]+"/"+spath[3];
                    }
                }

                String[] categories = currentPage.getPath().split("/");
                   category = categories[categories.length-1];

                %>

        <%
            }
        %>
            <li><a href="<%=homePagePath%>"><span class="aria-offscreen">Level <%=counter%>: </span>
            <% }else { 

            if(level!=(currentLevel-1)) {%>
                <li><a href="<%=getResourceResolverMapURl(slingRequest,trail.getPath())%>"><span class="aria-offscreen">Level <%=counter%>: </span>
                <%
                if(counter==2){
                    String[] categories = trail.getPath().split("/");
                    category = categories[categories.length-1];
                }
            %>
                <% }else{%>
                <li><span class="aria-offscreen">Level <%=counter%>: Your current page is </span>
            <%
                if(counter==2){
                    String[] categories = trail.getPath().split("/");
                    category = categories[categories.length-1];
                }
            %>
                <% }
                         } %>
           <%= xssAPI.encodeForHTML(title) %></a></li>
                <% if(level!=(currentLevel-1)) {%>
        <img alt="" class="brdCrumbArrow" src="<%=clearImagePath%>" >

                <%}

        delim = delimStr;
        level++;
        counter++;
    }
    if (trailStr.length() > 0) {
        %><%= xssAPI.filterHTML(trailStr) %><%
    }

%>
    </ul>
    <script>var mobile_loc_category = "<%=category%>";</script>
</div>

 

Thanks
Yamini

1 Accepted Solution

Avatar

Correct answer by
Administrator

Please have a look at this forum post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

// Convert "  long endLevel = currentStyle.get("relParent", 0);"  to "  long endLevel = currentStyle.get("relParent", 0L);"

 

See this :- http://aem-docs.tostring.me/?d=/docs/de/aem/6-0/release-notes/known-issues.html

// It  was known issue got fixed in 6.0

Solution:- https://helpx.adobe.com/x-productkb/global/jsp-compilation-issues-java-8.html

// Convert "long l = conf.get("foo", 1);" to "long l = conf.get("foo", 1L);"

~kautuk



Kautuk Sahni

View solution in original post

1 Reply

Avatar

Correct answer by
Administrator

Please have a look at this forum post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

// Convert "  long endLevel = currentStyle.get("relParent", 0);"  to "  long endLevel = currentStyle.get("relParent", 0L);"

 

See this :- http://aem-docs.tostring.me/?d=/docs/de/aem/6-0/release-notes/known-issues.html

// It  was known issue got fixed in 6.0

Solution:- https://helpx.adobe.com/x-productkb/global/jsp-compilation-issues-java-8.html

// Convert "long l = conf.get("foo", 1);" to "long l = conf.get("foo", 1L);"

~kautuk



Kautuk Sahni