06-08-2006 07:46 AM
Caused by: org.alfresco.error.AlfrescoRuntimeException: Wrapped java.lang.ArrayIndexOutOfBoundsException: 1 (AlfrescoScript#216)
at org.alfresco.repo.jscript.RhinoScriptService.executeScriptImpl(RhinoScriptService.java:220)
at org.alfresco.repo.jscript.RhinoScriptService.executeScript(RhinoScriptService.java:141)
… 81 more
Caused by: org.mozilla.javascript.WrappedException: Wrapped java.lang.ArrayIndexOutOfBoundsException: 1 (AlfrescoScript#216)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1693)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:157)
at org.mozilla.javascript.JavaMembers.get(JavaMembers.java:98)
at org.mozilla.javascript.NativeJavaObject.get(NativeJavaObject.java:102)
at org.mozilla.javascript.ScriptableObject.getProperty(ScriptableObject.java:1312)
at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1334)
at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1323)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2815)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2250)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:149)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:160)
at org.mozilla.javascript.Context.evaluateReader(Context.java:1163)
at org.alfresco.repo.jscript.RhinoScriptService.executeScriptImpl(RhinoScriptService.java:214)
… 82 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at org.alfresco.repo.jscript.Node.getAssocs(Node.java:336)
at sun.reflect.GeneratedMethodAccessor759.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:142)
… 95 more
<aspect name="myCompany:routable">
<title>Routable</title>
<properties>…</properties>
<associations>
<association name="myCompany:targetGroups">
<title>Target Group(s)</title>
<source>
<role>myCompany:contentToRoute</role>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>myCompany:inboxFolder</class>
<role>myCompany:targetGroup</role>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</aspect>
————————- Javascript which fire the Exception
nok = document.assocs["myCompany:targetGroups"];
nok = document.assocs["myCompany:targetGroups"][0];
nok = document.assocs["{myCompany.model.content.1.0}targetGroups"];
nok = document.assocs["{myCompany.model.content.1.0}targetGroups"][0];
nok = document.assocs;
————————- original Javascript loop
var targetGroups = document.assocs["myCompany:targetGroups"]; // EXCEPTION THROWN
if (targetGroups != null)
{
if (debug)
log("number of target groups: not null");
if (debug)
log("number of target groups: " + targetGroups.length);
for (var i=0; i<targetGroups.length; i++)
{
var targetGroup = targetGroups[i];
if (debug)
log("target group #" + i + "; " + targetGroup.nodeRef);
}
}
package org.alfresco.repo.jscript;
…
public Map<String, Node[]> getAssocs()
{
if (this.assocs == null)
{
// this Map implements the Scriptable interface for native JS syntax property access
this.assocs = new ScriptableQNameMap<String, Node[]>(this.services.getNamespaceService());
List<AssociationRef> refs = this.nodeService.getTargetAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
for (AssociationRef ref : refs)
{
String qname = ref.getTypeQName().toString();
Node[] nodes = (Node[])assocs.get(qname);
if (nodes == null)
{
// first access for the list for this qname
nodes = new Node[1];
}
else
{
Node[] newNodes = new Node[nodes.length + 1];
System.arraycopy(nodes, 0, newNodes, 0, nodes.length);
nodes = newNodes;
}
// ############################ EXCEPTION THROWN NEXT LINE:
nodes[nodes.length] = new Node(ref.getTargetRef(), this.services, this.imageResolver);
06-08-2006 09:06 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.