change api 2.0.1 -> 2.4 document.getLastVersion() returns null after creation new document

View: New views
2 Messages — Rating Filter:   Alert me  

change api 2.0.1 -> 2.4 document.getLastVersion() returns null after creation new document

by Bart Van den Abeele-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am switching from daisy 2.0.1 to 2.4.  I have used the api intensively.   I notice that document.getLastVersion() returns null after i  execute myDoc.save(validate); for a new document.  In 2.0.1 i used this function to get the creation date.  Because this returns null now, i get a null-pointer-exception (document.getLastVersion().getCreated()).  Is this supposed to return null?  Why has the behaviour changed?  Am i safe to use "document.getCreated()" instead?
 
-- 
Met vriendelijke groeten,
Bart Van den Abeele
Email: bvda@...
Helpdesk : +32 (09) 389 0560
Persoonlijk : +32 (09) 389 0564

**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm


_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy

Re: change api 2.0.1 -> 2.4 document.getLastVersion() returns null after creation new document

by Karel Vervaeke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

document.getLastVersion() should not return null for saved documents.
That's a bug you found there.
If you would be so kind to file a bug report (issues.cocoondev.org)
I'll have it fixed before you can say "Kabouter Wesley" (give or take
a day) ;-)

document.getCreated() and document.getLastVersion().getCreated() are
definitely not the same, and
are not even guaranteed to be identical for entirely new documents.
You should not depend on the behaviour.

As a workaround, I suggest you use
document.getVersion(document.getLastVersionId()) or re-fetch the
document before calling document.getLastVersion().

HTH,
Karel

On Wed, Sep 30, 2009 at 2:08 PM, Bart Van den Abeele
<bvda@...> wrote:

> Hi,
>
> I am switching from daisy 2.0.1 to 2.4.  I have used the api intensively.
> I notice that document.getLastVersion() returns null after i  execute
> myDoc.save(validate); for a new document.  In 2.0.1 i used this function to
> get the creation date.  Because this returns null now, i get a
> null-pointer-exception (document.getLastVersion().getCreated()).  Is this
> supposed to return null?  Why has the behaviour changed?  Am i safe to use
> "document.getCreated()" instead?
>
> --
> Met vriendelijke groeten,
> Bart Van den Abeele
> Email: bvda@...
> Helpdesk : +32 (09) 389 0560
> Persoonlijk : +32 (09) 389 0564
>
> **** DISCLAIMER ****
> http://www.schaubroeck.be/maildisclaimer.htm
>
> _______________________________________________
> daisy community mailing list
> Professional Daisy support:
> http://outerthought.org/en/services/daisy/support.html
> mail to: daisy@...
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy
>
>
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy@...
list information: http://lists.cocoondev.org/mailman/listinfo/daisy