diff options
author | Michi Henning <michi@zeroc.com> | 2009-03-05 21:04:52 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2009-03-05 21:04:52 +1000 |
commit | a4b3243e9ff67d69ba8e05e1d20eeeb86890bbff (patch) | |
tree | 8c75a5e8fbc26de10319739f8ae1c01d35aadba6 /java/demo | |
parent | Additional fixes for bug 3755 (diff) | |
download | ice-a4b3243e9ff67d69ba8e05e1d20eeeb86890bbff.tar.bz2 ice-a4b3243e9ff67d69ba8e05e1d20eeeb86890bbff.tar.xz ice-a4b3243e9ff67d69ba8e05e1d20eeeb86890bbff.zip |
Bug 3201 - freeze file system demo errata
Add missing "_destroyed = true". Aligned file and directory destroy implementations.
Made spelling of error messages consistent.
Diffstat (limited to 'java/demo')
-rw-r--r-- | java/demo/book/freeze_filesystem/DirectoryI.java | 5 | ||||
-rw-r--r-- | java/demo/book/freeze_filesystem/FileI.java | 14 |
2 files changed, 12 insertions, 7 deletions
diff --git a/java/demo/book/freeze_filesystem/DirectoryI.java b/java/demo/book/freeze_filesystem/DirectoryI.java index c3c90cffb09..d551f487910 100644 --- a/java/demo/book/freeze_filesystem/DirectoryI.java +++ b/java/demo/book/freeze_filesystem/DirectoryI.java @@ -42,7 +42,7 @@ public final class DirectoryI extends PersistentDirectory { if(parent == null) { - throw new PermissionDenied("cannot remove root directory"); + throw new PermissionDenied("cannot destroy root directory"); } synchronized(this) @@ -53,8 +53,9 @@ public final class DirectoryI extends PersistentDirectory } if(!nodes.isEmpty()) { - throw new PermissionDenied("Cannot destroy non-empty directory"); + throw new PermissionDenied("cannot destroy non-empty directory"); } + _destroyed = true; } parent.removeNode(nodeName); diff --git a/java/demo/book/freeze_filesystem/FileI.java b/java/demo/book/freeze_filesystem/FileI.java index 010998b5524..8b84ae13b34 100644 --- a/java/demo/book/freeze_filesystem/FileI.java +++ b/java/demo/book/freeze_filesystem/FileI.java @@ -35,14 +35,18 @@ public final class FileI extends PersistentFile return nodeName; } - public synchronized void + public void destroy(Ice.Current current) throws PermissionDenied { - if(_destroyed) - { - throw new Ice.ObjectNotExistException(current.id, current.facet, current.operation); - } + synchronized(this) + { + if(_destroyed) + { + throw new Ice.ObjectNotExistException(current.id, current.facet, current.operation); + } + _destroyed = true; + } parent.removeNode(nodeName); _evictor.remove(_id); |