AnsweredAssumed Answered

Cannot modify a property of a sealed object: unique?

Question asked by targa2000 on Mar 26, 2010
Latest reply on May 10, 2012 by thewickedchild
trying to run todo-list sample dashlet from ixxus and got following error:

Cannot modify a property of a sealed object: unique

code in question:  todolist.get.js

// call over to Alfresco and fetch the todo list
var connector = remote.connect("alfresco");
var data = connector.get("/todo");

// create json object from data
var results = eval('(' + data + ')');

model.tasks = results["tasks"];

// do array unique thingy
var catArray = results["categories"];

// error occurs in line below vvv
Array.prototype.unique = function () {
   var r = new Array();
   o:for(var i = 0, n = this.length; i < n; i++)
   {
      for(var x = 0, y = r.length; x < y; x++)
      {
         if(r[x]==this[i].category)
         {
            continue o;
         }
      }
      r[r.length] = this[i].category;
   }
   return r;
}
if (catArray) {
    var unique = catArray.unique();
    model.cats = unique;
} else {
    model.cats = [];
}

any ideas?

full error message:

An error has occured in the Share component: /share/service/todo/todolist.
It responded with a status of 500 - Internal Error.
Error Code Information: 500 - An error inside the HTTP server which prevented it from fulfilling the request.
Error Message: 02260001 Failed to load script '/org/alfresco/components/dashlets/todo/todolist.get.js (in classpath store file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts)': 02260000 Cannot modify a property of a sealed object: unique. (file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/todo/todolist.get.js#14)
Server: Alfresco Enterprise v3.2.0 (r 416) schema 3.400
Time: 26.03.2010 14:25:04
Click here to view full technical information on the error.
Exception: org.mozilla.javascript.EvaluatorException - Cannot modify a property of a sealed object: unique. (file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/todo/todolist.get.js#14)
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109)
org.mozilla.javascript.Context.reportRuntimeError(Context.java:1030)
org.mozilla.javascript.Context.reportRuntimeError(Context.java:1086)
org.mozilla.javascript.Context.reportRuntimeError1(Context.java:1049)
org.mozilla.javascript.ScriptableObject.checkNotSealed(ScriptableObject.java:1524)
org.mozilla.javascript.ScriptableObject.putImpl(ScriptableObject.java:1991)
org.mozilla.javascript.ScriptableObject.put(ScriptableObject.java:312)
org.mozilla.javascript.IdScriptableObject.put(IdScriptableObject.java:419)
org.mozilla.javascript.NativeArray.put(NativeArray.java:288)
org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:1656)
org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1477)
org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1467)
org.mozilla.javascript.gen.c12._c0(file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/todo/todolist.get.js:14)
org.mozilla.javascript.gen.c12.call(file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/todo/todolist.get.js)
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
org.mozilla.javascript.gen.c12.call(file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/todo/todolist.get.js)
org.mozilla.javascript.gen.c12.exec(file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/todo/todolist.get.js)
org.alfresco.web.scripts.PresentationScriptProcessor.executeScriptImpl(PresentationScriptProcessor.java:314)
org.alfresco.web.scripts.PresentationScriptProcessor.executeScript(PresentationScriptProcessor.java:189)
org.alfresco.web.scripts.AbstractWebScript.executeScript(AbstractWebScript.java:819)
org.alfresco.web.scripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:90)
org.alfresco.web.scripts.PresentationContainer.executeScript(PresentationContainer.java:65)
org.alfresco.web.scripts.LocalWebScriptRuntimeContainer.executeScript(LocalWebScriptRuntimeContainer.java:192)
org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:306)
org.alfresco.web.scripts.AbstractRuntime.executeScript(AbstractRuntime.java:183)
org.alfresco.web.scripts.WebScriptProcessor.executeBody(WebScriptProcessor.java:329)
org.alfresco.web.framework.render.AbstractProcessor.execute(AbstractProcessor.java:85)
org.alfresco.web.framework.render.RenderHelper.processComponent(RenderHelper.java:348)
org.alfresco.web.framework.render.RenderUtil.renderRawComponent(RenderUtil.java:451)
org.alfresco.web.framework.render.RenderUtil.renderRawComponent(RenderUtil.java:434)
org.alfresco.web.framework.render.bean.ComponentRenderer.body(ComponentRenderer.java:135)
org.alfresco.web.framework.render.RenderUtil.renderRegionComponents(RenderUtil.java:328)
org.alfresco.web.site.taglib.RegionIncludeTag.doStartTag(RegionIncludeTag.java:43)
org.alfresco.tools.TagUtil.execute(TagUtil.java:147)
org.alfresco.tools.TagUtil.execute(TagUtil.java:81)
org.alfresco.web.scripts.FreemarkerTagSupportDirective.executeTag(FreemarkerTagSupportDirective.java:89)
org.alfresco.web.scripts.GenericFreemarkerTagDirective.execute(GenericFreemarkerTagDirective.java:127)
freemarker.core.Environment.visit(Environment.java:261)
freemarker.core.UnifiedCall.accept(UnifiedCall.java:126)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.Environment.process(Environment.java:188)
freemarker.template.Template.process(Template.java:237)
org.alfresco.web.scripts.PresentationTemplateProcessor.process(PresentationTemplateProcessor.java:185)
org.alfresco.web.scripts.FreemarkerProcessor.executeBody(FreemarkerProcessor.java:266)
org.alfresco.web.framework.render.AbstractProcessor.execute(AbstractProcessor.java:85)
org.alfresco.web.framework.render.RenderHelper.processRenderable(RenderHelper.java:284)
org.alfresco.web.framework.render.bean.ChromeRenderer.body(ChromeRenderer.java:60)
org.alfresco.web.framework.render.AbstractRenderer.render(AbstractRenderer.java:105)
org.alfresco.web.framework.render.bean.RegionRenderer.body(RegionRenderer.java:134)
org.alfresco.web.framework.render.AbstractRenderer.render(AbstractRenderer.java:105)
org.alfresco.web.framework.render.RenderUtil.startRegionRenderer(RenderUtil.java:273)
org.alfresco.web.framework.render.RenderUtil.renderRegion(RenderUtil.java:213)
org.alfresco.web.framework.render.PresentationUtil.renderRegion(PresentationUtil.java:125)
org.alfresco.web.site.taglib.RegionTag.doStartTag(RegionTag.java:109)
org.alfresco.tools.TagUtil.execute(TagUtil.java:147)
org.alfresco.tools.TagUtil.execute(TagUtil.java:81)
org.alfresco.web.scripts.FreemarkerTagSupportDirective.executeTag(FreemarkerTagSupportDirective.java:89)
org.alfresco.web.scripts.RegionFreemarkerTagDirective.execute(RegionFreemarkerTagDirective.java:128)
freemarker.core.Environment.visit(Environment.java:261)
freemarker.core.UnifiedCall.accept(UnifiedCall.java:126)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
freemarker.core.Environment.visit(Environment.java:415)
freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
freemarker.core.Environment.visit(Environment.java:415)
freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.Macro$Context.runMacro(Macro.java:164)
freemarker.core.Environment.visit(Environment.java:601)
freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.IfBlock.accept(IfBlock.java:82)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.Macro$Context.runMacro(Macro.java:164)
freemarker.core.Environment.visit(Environment.java:601)
freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.Environment.visit(Environment.java:393)
freemarker.core.BodyInstruction.accept(BodyInstruction.java:93)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.Macro$Context.runMacro(Macro.java:164)
freemarker.core.Environment.visit(Environment.java:601)
freemarker.core.UnifiedCall.accept(UnifiedCall.java:106)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:208)
freemarker.core.Environment.process(Environment.java:188)
freemarker.template.Template.process(Template.java:237)
org.alfresco.web.scripts.PresentationTemplateProcessor.process(PresentationTemplateProcessor.java:185)
org.alfresco.web.scripts.FreemarkerProcessor.executeBody(FreemarkerProcessor.java:266)
org.alfresco.web.framework.render.AbstractProcessor.execute(AbstractProcessor.java:85)
org.alfresco.web.framework.render.RenderHelper.processTemplate(RenderHelper.java:423)
org.alfresco.web.framework.render.bean.TemplateInstanceRenderer.body(TemplateInstanceRenderer.java:140)
org.alfresco.web.framework.render.AbstractRenderer.render(AbstractRenderer.java:105)
org.alfresco.web.framework.render.bean.PageRenderer.body(PageRenderer.java:81)
org.alfresco.web.framework.render.AbstractRenderer.render(AbstractRenderer.java:105)
org.alfresco.web.framework.render.RenderUtil.startPageRenderer(RenderUtil.java:144)
org.alfresco.web.framework.render.RenderUtil.renderPage(RenderUtil.java:117)
org.alfresco.web.framework.render.PresentationUtil.renderPage(PresentationUtil.java:86)
org.alfresco.web.site.servlet.DispatcherServlet.dispatchPage(DispatcherServlet.java:512)
org.alfresco.web.site.servlet.DispatcherServlet.dispatch(DispatcherServlet.java:389)
org.alfresco.web.site.servlet.DispatcherServlet.service(DispatcherServlet.java:165)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)
Exception: org.alfresco.web.scripts.WebScriptException - 02260000 Cannot modify a property of a sealed object: unique. (file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/todo/todolist.get.js#14)
org.alfresco.web.scripts.PresentationScriptProcessor.executeScriptImpl(PresentationScriptProcessor.java:324)
Exception: org.alfresco.web.scripts.WebScriptException - 02260001 Failed to load script '/org/alfresco/components/dashlets/todo/todolist.get.js (in classpath store file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts)': 02260000 Cannot modify a property of a sealed object: unique. (file:C:/Programs/Alfresco/AlfrescoEE3.2r_test_todolist/tomcat/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/dashlets/todo/todolist.get.js#14)
org.alfresco.web.scripts.PresentationScriptProcessor.executeScript(PresentationScriptProcessor.java:193)

Outcomes