Case history

An error occurred while processing the template.
Java method "jdk.proxy3.$Proxy170.getCategory(long)" threw an exception when invoked on jdk.proxy3.$Proxy170 object "com.liferay.portlet.asset.service.impl.AssetCategoryServiceImpl@61782ac0"; see cause exception in the Java stack trace.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign categoryTitle = assetCategory...  [in template "10110#2640274#72734807" at line 66, column 57]
----
1<#assign hasCategories = false /> 
2<#assign assetCategoryService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryService") /> 
3<#assign randomNamespace="0.${turnoverstr(.now?long?string)}"?number?string?replace(".", "") /> 
4 
5<style> 
6  .n_${randomNamespace}.categories-filter .dropdown-toggle { 
7	  text-transform: capitalize; 
8	  display: flex; 
9	  flex-direction: row; 
10		justify-content: space-between; 
11		align-items: center; 
12		height: 50px; 
13		min-width: 240px; 
14		border-color: #E7E7E7; 
15    border-radius: 8px; 
16		background-color: #fff; 
17		font-weight: 400; 
18
19	.n_${randomNamespace}.categories-filter .dropdown-toggle::after { 
20    display: block; 
21    /* margin-left: .255em; */ 
22    /* vertical-align: .255em; */ 
23    content: ""; 
24    /* border-top: .3em solid; */ 
25    /* border-right: .3em solid transparent; */ 
26    /* border-bottom: 0; */ 
27    /* border-left: .3em solid transparent; */ 
28    background-image: url(/o/clivet-liferay-nuance-theme/images/icons/chevron.svg); 
29    width: 24px; 
30    height: 24px; 
31    color: #000; 
32    transform: rotate(0deg); 
33
34	.n_${randomNamespace}.categories-filter .dropdown-item { 
35		text-transform: capitalize; 
36  	color: #000 !important; 
37		font-size: 16px; 
38		font-weight: 400; 
39
40	.n_${randomNamespace}.filter-label { 
41		color: #717171; 
42		font-size: 16px; 
43		font-style: normal; 
44		font-weight: 400; 
45
46	@media only screen and (max-width: 991.98px) { 
47		.n_${randomNamespace}.categories-filter .dropdown, 
48		.n_${randomNamespace}.categories-filter .dropdown-toggle { 
49			width: 100%; 
50
51
52</style> 
53<#assign categoryId = paramUtil.getLong(renderRequest, "categoryId") /> 
54<#assign firstButtonId = "" /> 
55<#if entries?has_content> 
56	<div class="n_${randomNamespace} categories-filter container">  
57		    <div class="n_${randomNamespace} filter-label mb-2 mb-lg-0"><@liferay_ui.message key="filter-by" />:</div> 
58		<div class="d-flex flex-column flex-lg-row justify-content-center align-items-center g-3"> 
59			<#assign index = 0/> 
60			<#list entries as entry> 
61				<#assign categories = entry.getCategories() /> 
62				<#if categories?has_content> 
63					<#assign hasCategories = true /> 
64						<#assign categoryTitle = entry.getUnambiguousTitle(entries, themeDisplay.getSiteGroupId(), themeDisplay.getLocale()) /> 
65						<#if validator.isNotNull(categoryId) && containsCategory(categories, categoryId)> 
66							<#assign categoryTitle = assetCategoryService.getCategory(categoryId).getName() /> 
67						</#if> 
68						<div class="dropdown"> 
69							<#if index == 0 > 
70							  <#assign firstButtonId = "n_${randomNamespace}dropdownMenuButton" />	 
71							</#if> 
72							<button class="btn dropdown-toggle" type="button" id="n_${randomNamespace}dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> 
73    						${categoryTitle} 
74 							</button> 
75							<div class="dropdown-menu" aria-labelledby="n_${randomNamespace}dropdownMenuButton"> 
76								<@displayCategories categories=categories /> 
77							</div> 
78						</div> 
79				</#if> 
80				<#assign index = index + 1/> 
81			</#list> 
82      <#if hasCategories> 
83				<#assign resetCategoryURL = renderResponse.createRenderURL() /> 
84				${resetCategoryURL.setParameter("resetCur", "true")} 
85				${resetCategoryURL.setParameter("categoryId", "")} 
86				<a href="${resetCategoryURL}" class="reset-item btn btn-primary m-auto m-lg-0 justify-content-center"><span class="text-truncate"><@liferay.language key="reset" /></span></a> 
87			</#if> 
88			<#if !hasCategories> 
89				${renderRequest.setAttribute("PORTLET_CONFIGURATOR_VISIBILITY", true)} 
90 
91				<div class="alert alert-info w-100"> 
92					<@liferay_ui.message key="there-are-no-categories" /> 
93				</div> 
94			</#if> 
95		</div> 
96	</div> 
97</#if> 
98 
99<#function containsCategory 
100	categories 
101	lookup 
102
103	<#if categories?has_content> 
104		<#list categories as category> 
105				<#if category.getCategoryId() == lookup> 
106					<#return true /> 
107				</#if> 
108			<#assign childCategories = assetCategoryService.getChildCategories(category.getCategoryId()) /> 
109			<#if childCategories?has_content> 
110				<#return containsCategory(childCategories, lookup)/> 
111			</#if> 
112		</#list> 
113	</#if> 
114	<#return false /> 
115</#function> 
116 
117<#macro displayCategories 
118	categories 
119
120	<#if categories?has_content> 
121			<#list categories as category> 
122					<#assign categoryURL = renderResponse.createRenderURL() /> 
123 
124					${categoryURL.setParameter("resetCur", "true")} 
125					${categoryURL.setParameter("categoryId", category.getCategoryId()?string)} 
126					<#assign categoryURLs = categoryURL.toString()?replace("#p_"+themeDisplay.getPortletDisplay().getId(),"") /> 
127					<a href="${categoryURLs}" class="dropdown-item"><span class="text-truncate">${category.getTitle(themeDisplay.getLocale())}</span></a> 
128 
129					<#if serviceLocator??> 
130						<#assign childCategories = assetCategoryService.getChildCategories(category.getCategoryId()) /> 
131						<@displayCategories categories=childCategories /> 
132					</#if> 
133			</#list> 
134	</#if> 
135</#macro> 
136 
137<#function random > 
138	<#local h="0.${turnoverstr(.now?long?string)}" /> 
139	<#local r=h?number + rnd /> 
140	<#if r >= 1> 
141		<#local r=r-1 /> 
142	</#if> 
143	<#assign rnd=r /> 
144	<#return r/> 
145</#function> 
146 
147<#function turnoverstr str > 
148	<#local l = str?length /> 
149	<#local r = ""/> 
150	<#list 1..l as i> 
151		<#local r = r+str?substring(l-i,l-i+1)/> 
152	</#list> 
153	<#return r/> 
154</#function> 
155 
156 
157<#assign selectedOptionName = "default_value"> 
158<#if filterType?? && filterType.getData()?has_content> 
159    <#if filterType.getData() == 'opzione11682098'> 
160        <#assign selectedOptionName = 'product_filter'> 
161    <#elseif filterType.getData() == 'opzione80749396'> 
162        <#assign selectedOptionName = 'use_case_filter'> 
163    <#elseif filterType.getData() == 'opzione61712593'> 
164        <#assign selectedOptionName = 'job_filter'> 
165    <#elseif filterType.getData() == 'opzione71672717'> 
166        <#assign selectedOptionName = 'content_type_filter'> 
167    <#elseif filterType.getData() == 'opzione22125586'> 
168        <#assign selectedOptionName = 'operator_filter'> 
169    </#if> 
170</#if> 
171					 
172<script> 
173 
174	  $(".n_${randomNamespace}.categories-filter .dropdown-item").on('click', function(event) {  
175    if (typeof sendMeasurementEventFilter === 'function') {   
176		   var filterName = $(this).text(); 
177			  var filterType = '${selectedOptionName}';  
178        sendMeasurementEventFilter('Filter', filterType, filterName, 'no_type'); 
179    } else { 
180      console.error('sendMeasurementEventFilter not defined'); 
181
182  }); 
183	 
184	function fn_${randomNamespace}_fixLabel() { 
185	  let leftBtn = $("#${firstButtonId}").offset().left; 
186		let leftLabel = $(".n_${randomNamespace}.filter-label").offset().left; 
187		$(".n_${randomNamespace}.filter-label").css("paddingLeft", (leftBtn - leftLabel)+'px'); 
188		 
189		 
190
191	$(window).on('resize', function(){ 
192	  fn_${randomNamespace}_fixLabel(); 
193	}); 
194  fn_${randomNamespace}_fixLabel(); 
195</script> 
>
>
>
>
>
>
>