Jacopo Cappellato wrote:
> On Jan 22, 2010, at 6:00 PM, Adam Heath wrote:
>
>> [email protected] wrote:
>>> Author: hansbak
>>> Date: Fri Jan 22 09:09:36 2010
>>> New Revision: 902041
>>>
>>> URL: http://svn.apache.org/viewvc?rev=902041&view=rev
>>> Log:
>>> avoid error on screen if the status of the content item is not set
>>>
>>> Modified:
>>>
>>> ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/ContentList.ftl
>>>
>>> Modified:
>>> ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/ContentList.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/ContentList.ftl?rev=902041&r1=902040&r2=902041&view=diff
>>> ==============================================================================
>>> ---
>>> ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/ContentList.ftl
>>> (original)
>>> +++
>>> ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/ContentList.ftl
>>> Fri Jan 22 09:09:36 2010
>>> @@ -24,7 +24,7 @@
>>> <#assign content = pContent.getRelatedOne("Content")>
>>> <#assign contentType =
>>> content.getRelatedOneCache("ContentType")>
>>> <#assign mimeType =
>>> content.getRelatedOneCache("MimeType")?if_exists>
>>> - <#assign status = content.getRelatedOneCache("StatusItem")>
>>> + <#assign status =
>>> content.getRelatedOneCache("StatusItem")?if_exists>
>>> <#assign pcType = pContent.getRelatedOne("PartyContentType")>
>>> <tr>
>>> <td class="button-col"><a
>>> href="<@ofbizUrl>EditPartyContents?contentId=${pContent.contentId}&partyId=${pContent.partyId}&partyContentTypeId=${pContent.partyContentTypeId}&fromDate=${pContent.fromDate}</@ofbizUrl>">${content.contentId}</a></td>
>>
>> Huh? Based on your log message, you're testing if the 'content' item
>> doesn't exist. But if that is so, then won't contentType also throw a
>> NPE?
>
> Well, the log message says "if the status of the content", not the content
> itself.
Oh, right. So, with that cleared up, if I do this:
<#assign someItem = map.get("key")>
freemarker will throw an error if the key does not exist in the map?