[daisy] Strangeness with multivalue-fields
Marc Portier
mpo at outerthought.org
Tue Apr 3 01:25:39 CDT 2007
Caleb,
I haven't tested this myself but I would suspect the mild difference
between javascript and java arrays to be causing this.
(So it's an array in javascript land, but when passed to the Java API it
is seen as one single javascript native object)
here is how you can create a java string array from within javascript
var stringClass = java.lang.Class.forName("java.lang.String");
var vals = java.lang.reflect.Array.newInstance(stringClass, 1);
vals[0]="X5";
pls try this out and report back
HTH,
-marc=
Caleb Callaway wrote:
> Set up a document task with the following Javascript actions:
>
> var document = repository.getDocument(variantKey, true);
> document.setField('Product', new Array("X5"));
> document.save();
>
> It produces the following error:
>
> org.mozilla.javascript.WrappedException: Wrapped
> org.outerj.daisy.repository.DocumentTypeInconsistencyException: The
> value for the multivalue-field "Product" should be an array. (#2)
> at
> org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1776)
> at
> org.mozilla.javascript.MemberBox.invoke(MemberBox.java:191)
> at
> org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:197)
> at
> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:3026)
> at
> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164)
> at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140
> )
> at
> org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304)
> at
> org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769)
> at
> org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2145)
> at
> org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140
> )
> at
> org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:149
> )
> at
> org.outerj.daisy.doctaskrunner.serverimpl.TaskRunner.run(TaskRunner.java:96)
> at java.lang.Thread.run(Unknown Source)
> Caused by:
> org.outerj.daisy.repository.DocumentTypeInconsistencyException: The value
> for the multivalue-field "Product" should be an array.
> at
> org.outerj.daisy.repository.commonimpl.DocumentVariantImpl.checkFieldValue(D
> ocumentVariantImpl.java:279)
> at
> org.outerj.daisy.repository.commonimpl.DocumentVariantImpl.setField(Document
> VariantImpl.java:226)
> at
> org.outerj.daisy.repository.commonimpl.DocumentVariantImpl.setField(Document
> VariantImpl.java:199)
> at
> org.outerj.daisy.repository.commonimpl.DocumentImpl.setField(DocumentImpl.ja
> va:174)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
> Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
> Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at
> org.mozilla.javascript.MemberBox.invoke(MemberBox.java:174)
> ... 11 more
>
> I can't find any relevant messages in the log files, and the value for the
> multivalue-field "Product" jolly well is an array. What gives?
>
> Thanks,
> Caleb
>
> _______________________________________________
> daisy community mailing list
> Professional Daisy support: http://outerthought.org/site/services/daisy/daisysupport.html
> mail to: daisy at lists.cocoondev.org
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy
>
More information about the daisy
mailing list