equal
deleted
inserted
replaced
201 * ({@code '/'}), or {@code parent} is {@code null} and |
201 * ({@code '/'}), or {@code parent} is {@code null} and |
202 * name isn't {@code ""}. |
202 * name isn't {@code ""}. |
203 */ |
203 */ |
204 protected AbstractPreferences(AbstractPreferences parent, String name) { |
204 protected AbstractPreferences(AbstractPreferences parent, String name) { |
205 if (parent==null) { |
205 if (parent==null) { |
206 if (!name.equals("")) |
206 if (!name.isEmpty()) |
207 throw new IllegalArgumentException("Root name '"+name+ |
207 throw new IllegalArgumentException("Root name '"+name+ |
208 "' must be \"\""); |
208 "' must be \"\""); |
209 this.absolutePath = "/"; |
209 this.absolutePath = "/"; |
210 root = this; |
210 root = this; |
211 } else { |
211 } else { |
212 if (name.indexOf('/') != -1) |
212 if (name.indexOf('/') != -1) |
213 throw new IllegalArgumentException("Name '" + name + |
213 throw new IllegalArgumentException("Name '" + name + |
214 "' contains '/'"); |
214 "' contains '/'"); |
215 if (name.equals("")) |
215 if (name.isEmpty()) |
216 throw new IllegalArgumentException("Illegal name: empty string"); |
216 throw new IllegalArgumentException("Illegal name: empty string"); |
217 |
217 |
218 root = parent.root; |
218 root = parent.root; |
219 absolutePath = (parent==root ? "/" + name |
219 absolutePath = (parent==root ? "/" + name |
220 : parent.absolutePath() + "/" + name); |
220 : parent.absolutePath() + "/" + name); |
846 */ |
846 */ |
847 public Preferences node(String path) { |
847 public Preferences node(String path) { |
848 synchronized(lock) { |
848 synchronized(lock) { |
849 if (removed) |
849 if (removed) |
850 throw new IllegalStateException("Node has been removed."); |
850 throw new IllegalStateException("Node has been removed."); |
851 if (path.equals("")) |
851 if (path.isEmpty()) |
852 return this; |
852 return this; |
853 if (path.equals("/")) |
853 if (path.equals("/")) |
854 return root; |
854 return root; |
855 if (path.charAt(0) != '/') |
855 if (path.charAt(0) != '/') |
856 return node(new StringTokenizer(path, "/", true)); |
856 return node(new StringTokenizer(path, "/", true)); |
909 */ |
909 */ |
910 public boolean nodeExists(String path) |
910 public boolean nodeExists(String path) |
911 throws BackingStoreException |
911 throws BackingStoreException |
912 { |
912 { |
913 synchronized(lock) { |
913 synchronized(lock) { |
914 if (path.equals("")) |
914 if (path.isEmpty()) |
915 return !removed; |
915 return !removed; |
916 if (removed) |
916 if (removed) |
917 throw new IllegalStateException("Node has been removed."); |
917 throw new IllegalStateException("Node has been removed."); |
918 if (path.equals("/")) |
918 if (path.equals("/")) |
919 return true; |
919 return true; |