On Tue, May 20, 2008 at 6:14 AM, Sergiu Dumitriu <sergiu(a)xwiki.com> wrote:
Both, but there might still be some bugs that could
cause one or the
other to fail under certain circumstances.
Have other exceptions on import been properly trapped so that they display a
user-vibible error condition rather than failing silently?
In particular, i'm wondering if this situation got "caught" which has to do
with a packages.xml out-of-sync with reality. Also, shouldn't this be a more
severe error condition than WARN. The user clicks a button, and nothing
happens other than writing out an error in log4j.
13:48:52,163 [
http://............./bin/import/XWiki/Import?action=getPackageInfos&name=wiki.xar&xpage=plain&_=<http://nielsmayer.com/curriki/bin/import/XWiki/Import?action=getPackageInfos&name=curriki-wiki.xar&xpage=plain&_=>]
[http-127.0.0.1-8080-Processor2] WARN web.XWikiAction -
Uncaught exception: Error number 11015 in 11: Exception while importing
Wrapped Exception: Error number 0 in 5: Package: document Demo.WECCooley
does not exist in package definition
com.xpn.xwiki.XWikiException: Error number 11015 in 11: Exception while
importing
Wrapped Exception: Error number 0 in 5: Package: document Demo.WECCooley
does not exist in package definition
IMHO -- my EXTREME view is that all uncaught exceptions should abort the
application. For one, this tends to force the application to catch all
exceptions in very short order as it becomes painfully obvious that there's
a problem when you start getting 404's...; for two, you really can't trust
the application state after an uncaught exception anyways...
In the case of import exceptions, it could leave the wiki in a fairly
undetermined state. In the case of an import failure it's pretty easy to
"clean up" after, so aborting might be extreme overkill. But the best would
be for such exceptions to actually "roll back" the import. This means that
if a failed import overwrote a previous page or space, it would revert to
the original version before the import failure. In simple cases, it would
just delete any new pages or spaces created prior to failure.
Of course, that sounds like a ridiculous amount of work. Instead, perhaps
imports should be "pre-validated" (parsed and consistency-checked) to ensure
that once importing starts, it is an "atomic operation" that won't fail and
leave the wiki in an indeterminate state.
--
Niels
http://nielsmayer.com