users@jaxb.java.net

Re: Out of sync issue with JAXB

From: Martin Grebac <Martin.Grebac_at_Sun.COM>
Date: Thu, 02 Jul 2009 11:37:56 +0200

As Lexi mentioned, this is not JAXB issue. Please refer to Eclipse
mailing lists for help. However, I encountered similar issue while
implementing Metro plugin for Eclipse. Eclipse doesn't refresh local
files automatically (it's possible to set it in workspace preferences
though). Calling eclipse's .refreshLocal() method on your file/resource
instance solves the problem, but only if you call it after all opened
streams are closed. E.g. my error was caused by overlooking this line:

resource.save(new FileOutputStream(f), Collections.EMPTY_MAP);

and thus not closing the stream properly.

 MartiNG
 

Aleksei Valikov wrote:
> Hi,
>
>
>> I am writing an Eclipse plugin that creates a project in the Workspace, and I
>> have to access to some files contained is this project. Especially, I have
>> to read an XML file, do some stuff, and then update this file. I use JAXB
>> 2.0 for this.
>> Everything works fine, excepted that when I try to open my modified XML file
>> within Eclipse, an "Resource is out of sync with the file system" exception
>> occures. The only way to avoid this problem is to refresh the Workspace
>> using F5, but I really need to do this programatically (because I don't want
>> the plugin's users to hit F5 each time the file has to be synchronized !!).
>>
>
> I thinks it's more Eclipse issue than JAXB issue. I think you'd have
> the same effects if you modify the file in any other way.
>
> Bye.
> /lexi
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>

-- 
Martin Grebac, http://blogs.sun.com/mgrebac
Web Technologies & Standards
Sun Microsystems Czech
ICQ: 93478885