You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Stefan Guggisberg <st...@gmail.com> on 2006/02/01 15:17:02 UTC

Re: Empty date value

hi phil,

On 1/31/06, Phil Bingley <Ph...@tvnz.co.nz> wrote:
>
> Hi,
>
> I am just trying to get my teeth in to things and I have a problem with
> a Date value in a custom node type that I have created.
>
> My type is defined as follows
>
> <exp = 'http://bixby/test'>
> [exp:article] > mix:referenceable
> - exp:title (string) = '' mandatory autocreated
> - exp:created (date) mandatory
> - exp:body (string) = '' autocreated
> - exp:related (reference) multiple
>
>
> I add content like so
>
> Node test = content.addNode("Test Node", "exp:article");
>    test.setProperty("exp:created", Calendar.getInstance());
>    test.setProperty("exp:title", "Its a test title");
>    test.setProperty("exp:body", "blah blah blah");
>
> then can output the content and all is fine (using the dump() method
> from the First Hops doc)
>
> If I run the application again, having removed the code to add the node,
> I get the following exception when trying to dump() the content.
>
> javax.jcr.ValueFormatException: empty value
> at
> org.apache.jackrabbit.value.DateValue.getInternalString(DateValue.java:1
> 14)
> at org.apache.jackrabbit.value.BaseValue.getString(BaseValue.java:207)
> at
> org.apache.jackrabbit.core.PropertyImpl.getString(PropertyImpl.java:525)
>
> I have verified that the date is stored in the data (XMLPersistenceMgr)
> and have tested with the Derby PM as well - same result.  So there seems
> to be an issue of some sort when loading from the store I guess.
> Anyone have any ideas on this one?

i tested with the following code fragment:

            String nodeName = "Test Node";
            Node test;
            if (!root.hasNode(nodeName)) {
                test = root.addNode(nodeName, "exp:article");
                test.setProperty("exp:created", Calendar.getInstance());
                test.setProperty("exp:title", "Its a test title");
                test.setProperty("exp:body", "blah blah blah");
                root.save();
            } else {
                test = root.getNode(nodeName);
            }
            dumpTree(test, System.out);


i was unable to reproduce the problem you described. are you accessing the
repository through rmi? if the problem persists please provide the complete
stack trace and a complete simple test program (incl. your configuration etc).

cheers
stefan

>
> Thanks,
> Phil
>
>
>
>
>
>
>
>
>
>
>
>
>
> =====================================================================
> CAUTION: This e-mail and any attachment(s) contains information that
> is intended to be read only by the named recipient(s). It may contain
> information that is confidential, proprietary or the subject of legal
> privilege. This information is not to be used by any other person
> and/or organisation. If you are not the intended recipient, please
> advise us immediately and delete this e-mail from your system. Do not
> use any information contained in it.
>
> ================================================================
> For more information on the Television New Zealand Group, visit us
> online at http://www.tvnz.co.nz
> ================================================================
>