geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r701701 - /geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileDataRegistryImpl.java
Date Sat, 04 Oct 2008 19:45:24 GMT
Author: jdillon
Date: Sat Oct  4 12:45:24 2008
New Revision: 701701

URL: http://svn.apache.org/viewvc?rev=701701&view=rev
Log:
Fixed case when parent file is null

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileDataRegistryImpl.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileDataRegistryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileDataRegistryImpl.java?rev=701701&r1=701700&r2=701701&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileDataRegistryImpl.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileDataRegistryImpl.java
Sat Oct  4 12:45:24 2008
@@ -64,25 +64,27 @@
 
         if (name.getDepth() > 0) {
             FileName parentName = name.getParent();
-            if (containsData(parentName)) {
-                MetaFileData parent = lookupData(parentName);
-
-                if (!parent.hasChild(data)) {
-                    try {
-                        parent.addChild(data);
-                    }
-                    catch (FileSystemException ignore) {
-                        throw new Error(ignore);
+            if (parentName != null) {
+                if (containsData(parentName)) {
+                    MetaFileData parent = lookupData(parentName);
+
+                    if (!parent.hasChild(data)) {
+                        try {
+                            parent.addChild(data);
+                        }
+                        catch (FileSystemException ignore) {
+                            throw new Error(ignore);
+                        }
                     }
                 }
-            }
-            else {
-                //
-                // TODO: Consider auto-creating parents, this will work well
-                //       if we switch to all files as FileType.FILE_OR_FOLDER
-                //
-                
-                log.warn("Missing parent folder: " + parentName);
+                else {
+                    //
+                    // TODO: Consider auto-creating parents, this will work well
+                    //       if we switch to all files as FileType.FILE_OR_FOLDER
+                    //
+
+                    log.warn("Missing parent folder: " + parentName);
+                }
             }
         }
 
@@ -97,7 +99,7 @@
         MetaFileData data = getNodes().remove(name);
 
         FileName parentName = name.getParent();
-        if (containsData(parentName)) {
+        if (parentName != null && containsData(parentName)) {
             MetaFileData parent = lookupData(parentName);
             try {
                 parent.removeChild(data);



Mime
View raw message