Asset Publisher

An error occurred while processing the template.
The following has evaluated to null or missing:
==> fileUrlView  [in template "20099#20135#68566" at line 116, column 49]

----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: ${fileUrlView}  [in template "20099#20135#68566" at line 116, column 47]
----
1<#-- Docs and Tools Detail Page --> 
2 
3<#assign splitter=themeDisplay.getURLCurrent()?split("?")> 
4<#assign s=splitter?last /> 
5<#assign val=s?split("&") /> 
6<#if val?size gte 3> 
7  <#assign ids=val[0]?split("=") />  
8  <#assign nAccs = val[1]?split("=") />  
9  <#assign files = val[2]?split("=") />  
10  <#assign id = ids[1] />  
11  <#assign nAcc = nAccs[1] />  
12  <#assign file = files[1] />  
13  <#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")> 
14  <#assign assetEntryLocalService=serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")> 
15  <#assign article=journalArticleLocalService.getArticle(groupId, id)> 
16  <#if article?has_content> 
17    <#assign docXml=saxReaderUtil.read(article.getContent()) /> 
18    <#assign listaAccordion=docXml.getRootElement().selectNodes("dynamic-element[@name='AccordionTitle' ]") /> 
19    <#assign accordion=listaAccordion[nAcc?number - 1] /> 
20    <#assign a=accordion.valueOf("dynamic-content/text()") /> 
21    <#assign fileLinksTitle=accordion.selectNodes("dynamic-element[@name='FileLinkTitle' ]") /> 
22    <#assign fileLink=fileLinksTitle[file?number - 1] /> 
23    <#assign fTitle=fileLink.valueOf("dynamic-content/text()") /> 
24    <#assign fDescription=fileLink.valueOf("dynamic-element[@name='FileDescription' ]/dynamic-content/text()") /> 
25    <#assign fAttachment=fileLink.valueOf("dynamic-element[@name='FileAttachment' ]/dynamic-content/text()") /> 
26    <#assign image=fileLink.valueOf("dynamic-element[@name='FileImage' ]/dynamic-content/text()") /> 
27    <#assign imgUrl='' /> 
28    <#if image?has_content> 
29      <#assign jsonObject1=image?eval /> 
30      <#assign entryUuid1=jsonObject1.uuid /> 
31      <#assign entryGroupId1=getterUtil.getLong(jsonObject1.groupId) /> 
32      <#assign dlFileEntryLocalService=serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")> 
33      <#assign dlFileEntry1=dlFileEntryLocalService.getDLFileEntryByUuidAndGroupId(entryUuid1, entryGroupId1) /> 
34      <#assign assetEntry1=assetEntryLocalService.getEntry("com.liferay.document.library.kernel.model.DLFileEntry", dlFileEntry1.fileEntryId) /> 
35      <#assign assetRenderer1=assetEntry1.assetRenderer /> 
36      <#assign imgUrl=assetRenderer1.getURLDownload(themeDisplay) /> 
37    </#if> 
38    <#if fAttachment?has_content> 
39      <#assign jsonObject=fAttachment?eval /> 
40      <#assign entryUuid=jsonObject.uuid /> 
41      <#assign entryGroupId=getterUtil.getLong(jsonObject.groupId) /> 
42      <#assign dlFileEntryLocalService=serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")> 
43      <#assign dlFileEntry=dlFileEntryLocalService.getDLFileEntryByUuidAndGroupId(entryUuid, entryGroupId) /> 
44      <#assign assetEntry=assetEntryLocalService.getEntry("com.liferay.document.library.kernel.model.DLFileEntry", dlFileEntry.fileEntryId) /> 
45      <#assign assetRenderer=assetEntry.assetRenderer /> 
46      <#assign fileUrl=assetRenderer.getURLDownload(themeDisplay) /> 
47      <#assign fileUrlView=fileUrl /> 
48      <#if fileUrl?contains('&download=true')> 
49        <#assign fileUrlView=fileUrl?replace('&download=true', '' ) /> 
50      </#if> 
51    </#if> 
52    <div class="docsDetails pb-5"> 
53      <!-- <div class="breadcrumb-details d-flex pb-3 pl-5 ml-2 font-weight-bold"> <a href="/home">Home</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a href="/docs-and-tools">Docs & Tools</a>&nbsp;&nbsp;/&nbsp;&nbsp;<a href="" style="color: #1abae9">Details</a> </div> --> 
54      <div class="slider-details d-flex align-items-center justify-content-center" style="background-image: url('/documents/20126/51018/Rectangle.png/e994fa0f-49e8-a3ca-d66a-51eb385cfafc?t=1547458674086'); background-size: cover; background-position: center;"> 
55        <div class="row slider-details-info d-flex flex-column justify-content-center text-center"> 
56          <#if fTitle?has_content> 
57            <h2 class="slider-title w-75">${fTitle}</h2> 
58          </#if> 
59          <#if fAttachment?has_content> 
60            <#-- take file version --> 
61            <#assign fileVersion=dlFileEntry.getFileVersion().version /> 
62            <#assign currentDate=.now> 
63            <#assign numberOfDays=30?long> 
64            <#assign timeInMillisecond=(1000 * 60 * 60 * 24 * numberOfDays)> 
65            <#if fileVersion !="1.0"> 
66              <#-- if file version is update --> 
67              <#if (currentDate?long - dlFileEntry.getModifiedDate()?long) lte timeInMillisecond> 
68                <div class="subtitle pb-3 align-self-center"> 
69                  <h5 class="mb-0 docsToolsFileInfo" style="color:white">Updated on :${dlFileEntry.getModifiedDate()?string("dd/MM/yyyy")} <span class="badge badge-new-version p-2">New Version</span></h5> 
70                </div> 
71              <#else> 
72                <#-- no label "new version" --> 
73                <div class="subtitle pb-3 align-self-center"> 
74                  <h5 class="mb-0 docsToolsFileInfo" style="color:white">Updated on :${dlFileEntry.getModifiedDate()?string("dd/MM/yyyy")}</h5> 
75                </div> 
76              </#if> 
77            <#else> 
78              <#-- if file version isn't update --> 
79              <#if (currentDate?long - dlFileEntry.getCreateDate()?long) lte timeInMillisecond> 
80                <div class="subtitle pb-3 align-self-center"> 
81                  <h5 class="mb-0 docsToolsFileInfo" style="color:white"> Updated on : ${dlFileEntry.getModifiedDate()?string("dd/MM/yyyy")} <span class="badge badge-default-version p-2">New</span></h5> 
82                </div> 
83              <#else> 
84                <#-- no label "new version" --> 
85                  <div class="subtitle pb-3 align-self-center"> 
86                    <h5 class="mb-0 docsToolsFileInfo" style="color:white">Updated on :${dlFileEntry.getModifiedDate()?string("dd/MM/yyyy")}</h5> 
87                  </div> 
88              </#if> 
89            </#if> 
90          </#if> 
91          <#if themeDisplay.getSiteGroup().getParentGroupId() !=0> 
92            <#assign url=themeDisplay.getURLCurrent()?substring(0, themeDisplay.getURLCurrent()?last_index_of("/docs-and-tools-details")) />  
93            <a href="${url}/docs-and-tools"> 
94          <#else>  
95            <a href="/docs-and-tools">  
96          </#if>  
97            <button type="button" class="btn bottone white" style="font-size: larger;">BACK TO ALL DOCS & TOOLS</button> 
98            </a> 
99        </div> 
100      </div> 
101      <div class="row pt-5 d-flex align-items-center justify-content-center"> 
102        <div class="w-75"> 
103          <div class="row d-flex align-items-center justify-content-center"> 
104            <div class="col-md-4"> 
105              <#if imgUrl?has_content> <img src="${imgUrl}" /> </#if> 
106            </div> 
107            <div class="col-md-8"> 
108              <#if fDescription?has_content> 
109                <div class="text">${fDescription}</div> 
110              </#if> 
111              <#if fAttachment?has_content>  
112                <a href="${fileUrl}">  
113                  <button type="button" class="btn bottone">DOWNLOAD (${dlFileEntry.getExtension()?upper_case}, ${((dlFileEntry.getSize()/1024)/1024)?string["0.##"]} Mb)&nbsp;&nbsp; <i class="glyphicon glyphicon-download-alt"></i> </button>  
114                </a>  
115              </#if> 
116              <#if file?has_content> <a href="${fileUrlView}" target="_blank"> <button class="btn bottone ml-4"> VIEW </button> </a> </#if> 
117            </div> 
118          </div> 
119        </div> 
120      </div> 
121    </div> 
122  </#if> 
123</#if> 
124    <style type="text/css"> 
125    .badge-new-version { 
126        background-color: #ffcc00; 
127        color: #003399; 
128        font-weight: 700; 
129        text-transform: uppercase; 
130
131 
132    .badge-default-version { 
133        background-color: #a0ddf9; 
134        color: #003399; 
135        font-weight: 700; 
136        text-transform: uppercase; 
137
138    </style>