<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic [javascript] children property of created space is null in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/javascript-children-property-of-created-space-is-null/m-p/129780#M91186</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm trying to upload files with the upload script to a space I created (Incoming Files). I want to know how many children this space already has, so I can generate a unique prefix to avoid double names.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I get a null pointer exception when I try to access the children property of the space I created. I can access the children property of already existing space with no problem (eg Guest Home). See he code below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;nbsp; incoming1 = companyhome.childByNamePath("Guest Home");&lt;BR /&gt;&amp;nbsp; incoming2 = companyhome.childByNamePath("Incoming Files");&lt;BR /&gt;&amp;nbsp; logger.log("incoming 1: " + incoming1.properties.name);&lt;BR /&gt;&amp;nbsp; logger.log("incoming 2: " + incoming2.properties.name);&lt;BR /&gt;&amp;nbsp; logger.log("incoming 1 children: " + incoming1.children.length);&lt;BR /&gt;&amp;nbsp; logger.log("incoming 2 children: " + incoming2.children.length);&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;This gives the following output:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;&lt;BR /&gt;16:33:34,919 DEBUG [org.alfresco.repo.jscript.ScriptLogger] incoming 1: Guest Home&lt;BR /&gt;16:33:34,929 DEBUG [org.alfresco.repo.jscript.ScriptLogger] incoming 2: Incoming Files&lt;BR /&gt;16:33:34,939 DEBUG [org.alfresco.repo.jscript.ScriptLogger] incoming 1 children: 2&lt;BR /&gt;16:33:34,939 DEBUG [org.alfresco.repo.jscript.RhinoScriptProcessor] Time to execute script: 101ms&lt;BR /&gt;16:33:34,939 INFO&amp;nbsp; [org.alfresco.web.scripts.DeclarativeWebScript] Caught exception &amp;amp; redirecting to status template: Failed to execute script 'D:\alfresco220dev\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension\templates\webscripts\cayman\upload.post.js': Failed to execute script 'D:\alfresco220dev\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension\templates\webscripts\cayman\upload.post.js': Wrapped java.lang.NullPointerException (AlfrescoScript#43)&lt;BR /&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt;The null pointer exception is at line 43, which is: logger.log("incoming 2 children: " + incoming2.children.length);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Accessing incoming.properties.children.length gives a null pointer exception in both cases (line 42), as does incoming.properties["cm:contains"].length. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is all inside the upload.post.js script, which works fine except or this. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Stijn&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Nov 2007 15:44:09 GMT</pubDate>
    <dc:creator>stijndereede</dc:creator>
    <dc:date>2007-11-13T15:44:09Z</dc:date>
    <item>
      <title>[javascript] children property of created space is null</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-children-property-of-created-space-is-null/m-p/129780#M91186</link>
      <description>I'm trying to upload files with the upload script to a space I created (Incoming Files). I want to know how many children this space already has, so I can generate a unique prefix to avoid double names.However, I get a null pointer exception when I try to access the children property of the space I</description>
      <pubDate>Tue, 13 Nov 2007 15:44:09 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-children-property-of-created-space-is-null/m-p/129780#M91186</guid>
      <dc:creator>stijndereede</dc:creator>
      <dc:date>2007-11-13T15:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: [javascript] children property of created space is null</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/javascript-children-property-of-created-space-is-null/m-p/129781#M91187</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;After deleting the whole repository (drop and create database, delete storage directory) the children property works again. Strange….&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Nov 2007 13:09:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/javascript-children-property-of-created-space-is-null/m-p/129781#M91187</guid>
      <dc:creator>stijndereede</dc:creator>
      <dc:date>2007-11-14T13:09:27Z</dc:date>
    </item>
  </channel>
</rss>

