From 7bfb70430ee7cd093efa746377bf3b97580554c1 Mon Sep 17 00:00:00 2001 From: hns Date: Thu, 19 Feb 2004 10:47:43 +0000 Subject: [PATCH] * Work around Java/Windows quirk where File can't be renamed if a file with the target name exists by deleting the existing file. http://helma.org/bugs/show_bug.cgi?id=338 * Catch all Exceptions when reading XML in getNode, and rethrow as IOException rather then ObjectNotFoundException (which is only thrown if the file in question doesn't exist). --- src/helma/objectmodel/db/XmlDatabase.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/helma/objectmodel/db/XmlDatabase.java b/src/helma/objectmodel/db/XmlDatabase.java index 388d83cb..897b4f19 100644 --- a/src/helma/objectmodel/db/XmlDatabase.java +++ b/src/helma/objectmodel/db/XmlDatabase.java @@ -171,7 +171,7 @@ public final class XmlDatabase implements IDatabase { File f = new File(dbHomeDir, kstr + ".xml"); if (!f.exists()) { - throw new ObjectNotFoundException("Object not found for key " + kstr + "."); + throw new ObjectNotFoundException("Object not found for key " + kstr); } try { @@ -179,9 +179,9 @@ public final class XmlDatabase implements IDatabase { Node node = reader.read(f); return node; - } catch (RuntimeException x) { - nmgr.app.logError("Error reading " +f+": " + x.toString()); - throw new ObjectNotFoundException(x.toString()); + } catch (Exception x) { + nmgr.app.logError("Error reading " +f, x); + throw new IOException(x.toString()); } } @@ -261,6 +261,11 @@ public final class XmlDatabase implements IDatabase { for (int i=0; i