Hi,

I was getting a Null Pointer exception when when using the XMLFileDescriptorsStore. The exception occurred when I was trying to store a resource with the same URI as one that had been deleted earlier.

I had a look at the code for removeObject(Uri uri, ObjectNode object) and it didn't seem to be deleting the reference for the resource URI in the definitions map or the XML properties file.

I added the code below and it all seems to work fine now. Is this a correct solution??


Index: src/stores/slidestore/file/XMLFileDescriptorsStore.java
===================================================================
RCS file: /home/cvspublic/jakarta-slide/src/stores/slidestore/file/XMLFileDescriptorsStore.java,v
retrieving revision 1.5
diff -u -w -r1.5 XMLFileDescriptorsStore.java
--- src/stores/slidestore/file/XMLFileDescriptorsStore.java 14 May 2002 11:53:58 -0000 1.5
+++ src/stores/slidestore/file/XMLFileDescriptorsStore.java 21 Jan 2003 08:23:17 -0000
@@ -311,7 +311,19 @@
if (aProps == null) {
throw new ObjectNotFoundException(uri);
}
+
+
+ // Delete the properties file
+ File file = aProps.getFile(uri);
+ if (file.exists()) {
+ file.delete();
+ }
+
aProps.removeObject(uri,object);
+
+ // Delete the reference to the properties
+ definitions.remove(uri.toString());
+
// System.out.println("----------- XMLMemDescriptorsStore removeObject 2/n uri="+uri+" aProps="+aProps);
}


Regards,

Ben

--

Ben Warren

Plugged In Software
===================
http://www.PIsoftware.com
Ph : +61 (7) 3876 2188
Fax: +61 (7) 3876 4899


--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to