[jboss-cvs] JBossAS SVN: r69082 - in projects/vfs/trunk/src: main/java/org/jboss/virtual/plugins/context and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 17 15:06:29 EST 2008
Author: alesj
Date: 2008-01-17 15:06:28 -0500 (Thu, 17 Jan 2008)
New Revision: 69082
Modified:
projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/VirtualFile.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java
projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java
projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java
Log:
Removing findChild from spi.
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/VFS.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -206,7 +206,9 @@
throw new IllegalArgumentException("Null path");
VirtualFileHandler handler = context.getRoot();
- VirtualFileHandler result = context.findChild(handler, VFSUtils.fixName(path));
+ VirtualFileHandler result = context.getChild(handler, VFSUtils.fixName(path));
+ if (result == null)
+ throw new IOException("Child not found " + path + " for " + handler);
return result.getVirtualFile();
}
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/VFSUtils.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -177,7 +177,7 @@
VirtualFile manifest;
try
{
- manifest = archive.findChild(JarFile.MANIFEST_NAME);
+ manifest = archive.findChild(JarFile.MANIFEST_NAME);
}
catch (IOException ignored)
{
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/VirtualFile.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/VirtualFile.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/VirtualFile.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -376,12 +376,16 @@
@Deprecated
public VirtualFile findChild(String path) throws IOException
{
- VirtualFileHandler handler = getHandler();
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+ VirtualFileHandler handler = getHandler();
if (handler.isLeaf())
throw new IllegalStateException("File cannot contain children: " + this);
- VirtualFileHandler child = handler.findChild(VFSUtils.fixName(path));
+ VirtualFileHandler child = handler.getChild(VFSUtils.fixName(path));
+ if (child == null)
+ throw new IOException("Child not found " + path + " for " + handler);
return child.getVirtualFile();
}
@@ -396,12 +400,11 @@
*/
public VirtualFile getChild(String path) throws IOException
{
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+
VirtualFileHandler handler = getHandler();
- VirtualFileHandler child = null;
- if (handler.isLeaf() == false)
- {
- child = handler.getChild(VFSUtils.fixName(path));
- }
+ VirtualFileHandler child = handler.getChild(VFSUtils.fixName(path));
return child != null ? child.getVirtualFile() : null;
}
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVFSContext.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -116,15 +116,6 @@
return parent.getChildren(ignoreErrors);
}
- public VirtualFileHandler findChild(VirtualFileHandler parent, String path) throws IOException
- {
- if (parent == null)
- throw new IllegalArgumentException("Null parent");
- if (path == null)
- throw new IllegalArgumentException("Null path");
- return parent.findChild(path);
- }
-
public VirtualFileHandler getChild(VirtualFileHandler parent, String path) throws IOException
{
if (parent == null)
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/AbstractVirtualFileHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -321,55 +321,6 @@
}
/**
- * Structured implementation of find child
- *
- * @param path the path
- * @return the handler
- * @throws IOException for any error accessing the virtual file system
- * @throws IllegalArgumentException for a null name
- */
- public VirtualFileHandler structuredFindChild(String path) throws IOException
- {
- checkClosed();
-
- // Parse the path
- String[] tokens = PathTokenizer.getTokens(path);
- if (tokens == null || tokens.length == 0)
- return this;
-
- // Go through each context starting from ours
- // check the parents are not leaves.
- VirtualFileHandler current = this;
- for (int i = 0; i < tokens.length; ++i)
- {
- if (current.isLeaf())
- throw new IOException("File cannot have children: " + current);
-
- if (PathTokenizer.isReverseToken(tokens[i]))
- {
- VirtualFileHandler parent = current.getParent();
- if (parent == null)
- throw new IOException("Using reverse path on top file handler: " + current + ", " + path);
- else
- current = parent;
- }
- else if (current instanceof StructuredVirtualFileHandler)
- {
- StructuredVirtualFileHandler structured = (StructuredVirtualFileHandler) current;
- current = structured.createChildHandler(tokens[i]);
- }
- else
- {
- String remainingPath = PathTokenizer.getRemainingPath(tokens, i);
- return current.findChild(remainingPath);
- }
- }
-
- // The last one is the result
- return current;
- }
-
- /**
* Structured implementation of get child
*
* @param path the path
@@ -377,7 +328,7 @@
* @throws IOException for any error accessing the virtual file system
* @throws IllegalArgumentException for a null name
*/
- public VirtualFileHandler structuredGetChild(String path) throws IOException
+ public VirtualFileHandler structuredFindChild(String path) throws IOException
{
checkClosed();
@@ -397,7 +348,7 @@
if (PathTokenizer.isReverseToken(tokens[i]))
{
VirtualFileHandler parent = current.getParent();
- if (parent == null)
+ if (parent == null) // TODO - still IOE or null?
throw new IOException("Using reverse path on top file handler: " + current + ", " + path);
else
current = parent;
@@ -405,7 +356,7 @@
else if (current instanceof StructuredVirtualFileHandler)
{
StructuredVirtualFileHandler structured = (StructuredVirtualFileHandler) current;
- current = structured.getChildHandler(tokens[i]);
+ current = structured.createChildHandler(tokens[i]);
}
else
{
@@ -428,20 +379,6 @@
*/
public VirtualFileHandler simpleFindChild(String path) throws IOException
{
- return simpleFindChild(path, false);
- }
-
- /**
- * Simple implementation of findChild
- *
- * @param path the path
- * @param allowNull do we allow null
- * @return the handler or <code>null</code> if not found
- * @throws IOException for any error accessing the virtual file system
- * @throws IllegalArgumentException for a null name
- */
- protected VirtualFileHandler simpleFindChild(String path, boolean allowNull) throws IOException
- {
if (path == null)
throw new IllegalArgumentException("Null path");
@@ -456,10 +393,7 @@
if (child.getName().equals(appliedPath))
return child;
}
- if (allowNull)
- return null;
- else
- throw new IOException("Child not found " + path + " for " + this);
+ return null;
}
@Override
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/DelegatingHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -65,11 +65,6 @@
this.delegate = delegate;
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return delegate.findChild(path);
- }
-
public VirtualFileHandler getChild(String path) throws IOException
{
return delegate.getChild(path);
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/StructuredVirtualFileHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -43,14 +43,4 @@
* @throws IllegalArgumentException for a null name
*/
VirtualFileHandler createChildHandler(String name) throws IOException;
-
- /**
- * Get a virtual file context
- *
- * @param name the name
- * @return the handler or <code>null</code> if cannot create one
- * @throws IOException for any error accessing the virtual file system
- * @throws IllegalArgumentException for a null name
- */
- VirtualFileHandler getChildHandler(String name) throws IOException;
}
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/FileHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -192,11 +192,6 @@
return result;
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
public VirtualFileHandler createChildHandler(String name) throws IOException
{
FileSystemContext context = getVFSContext();
@@ -219,15 +214,9 @@
public VirtualFileHandler getChild(String path) throws IOException
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
- // TODO - this OK?
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- return createChildHandler(name);
- }
-
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
{
in.defaultReadObject();
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/file/LinkHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -21,12 +21,11 @@
*/
package org.jboss.virtual.plugins.context.file;
-import java.io.FileNotFoundException;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -80,11 +79,6 @@
children.put(name, child);
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
public VirtualFileHandler createChildHandler(String name) throws IOException
{
return children.get(name);
@@ -92,14 +86,9 @@
public VirtualFileHandler getChild(String path) throws IOException
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- return children.get(name);
- }
-
public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
{
return null;
@@ -143,16 +132,16 @@
int n = 0;
VirtualFileHandler linkParent = this;
String atom;
- // Look for an existing parent
+ // Look for an existing parent
+ VirtualFileHandler previous;
for(; n < paths.length-1; n ++)
{
+ previous = linkParent;
atom = paths[n];
- try
+ linkParent = previous.getChild(atom);
+ if (linkParent == null)
{
- linkParent = linkParent.findChild(atom);
- }
- catch(IOException e)
- {
+ linkParent = previous;
break;
}
}
@@ -166,11 +155,15 @@
{
linkTargets.put(atom, pol);
}
- else
+ else if (linkParent instanceof ParentOfLink)
{
ParentOfLink prevPOL = (ParentOfLink) linkParent;
prevPOL.addChild(pol, atom);
}
+ else
+ {
+ throw new IOException("Link parent not ParentOfLink.");
+ }
linkParent = pol;
}
@@ -200,30 +193,16 @@
return new ArrayList<VirtualFileHandler>(linkTargets.values());
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
public VirtualFileHandler createChildHandler(String name) throws IOException
{
- VirtualFileHandler handler = linkTargets.get(name);
- if(handler == null)
- throw new FileNotFoundException("Failed to find link for: " + name + ", parent: " + this);
-
- return handler;
+ return linkTargets.get(name);
}
public VirtualFileHandler getChild(String path) throws IOException
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- return linkTargets.get(name);
- }
-
@Override
protected void doClose()
{
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/AbstractStructuredJarHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -21,24 +21,23 @@
*/
package org.jboss.virtual.plugins.context.jar;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.jar.JarFile;
import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
import org.jboss.virtual.plugins.context.HierarchyVirtualFileHandler;
+import org.jboss.virtual.plugins.context.StructuredVirtualFileHandler;
import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
import org.jboss.virtual.spi.VFSContext;
import org.jboss.virtual.spi.VirtualFileHandler;
@@ -223,33 +222,35 @@
VirtualFileHandler next;
pathName.append(path);
pathName.append('/');
- try
- {
- next = parent.findChild(path);
- }
- catch (IOException e)
- {
- // Create a synthetic parent
- URL url = getURL(parent, path, true);
- next = new SynthenticDirEntryHandler(getVFSContext(), parent, path, wrapper.getTime(), url);
- if (parent == this)
- {
- // This is an immeadiate child of the jar handler
- entries.add(next);
- entryMap.put(path, next);
- }
- else if (parent instanceof HierarchyVirtualFileHandler)
- {
- HierarchyVirtualFileHandler ehandler = (HierarchyVirtualFileHandler) parent;
- ehandler.addChild(next);
- }
- }
+ next = parent.getChild(path);
+ if (next == null)
+ next = createSynthenticParent(parent, path, wrapper);
parentMap.put(pathName.toString(), next);
parent = next;
}
return parent;
}
+ protected VirtualFileHandler createSynthenticParent(VirtualFileHandler parent, String path, ZipEntryWrapper<T> wrapper)
+ throws IOException
+ {
+ VirtualFileHandler next;// Create a synthetic parent
+ URL url = getURL(parent, path, true);
+ next = new SynthenticDirEntryHandler(getVFSContext(), parent, path, wrapper.getTime(), url);
+ if (parent == this)
+ {
+ // This is an immeadiate child of the jar handler
+ entries.add(next);
+ entryMap.put(path, next);
+ }
+ else if (parent instanceof HierarchyVirtualFileHandler)
+ {
+ HierarchyVirtualFileHandler ehandler = (HierarchyVirtualFileHandler) parent;
+ ehandler.addChild(next);
+ }
+ return next;
+ }
+
public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
{
checkClosed();
@@ -259,29 +260,16 @@
return Collections.unmodifiableList(entries);
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
public VirtualFileHandler createChildHandler(String name) throws IOException
{
- VirtualFileHandler child = entryMap.get(name);
- if (child == null)
- throw new FileNotFoundException(this + " has no child: " + name);
- return child;
+ return entryMap.get(name);
}
public VirtualFileHandler getChild(String path) throws IOException
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- return entryMap.get(name);
- }
-
/**
* Create a new virtual file handler
*
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarContext.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -87,7 +87,7 @@
return jar;
// todo This is a hack until we can fix http://jira.jboss.com/jira/browse/JBMICROCONT-164
- AbstractVirtualFileHandler result = (AbstractVirtualFileHandler)jar.findChild(entryPath);
+ AbstractVirtualFileHandler result = (AbstractVirtualFileHandler)jar.getChild(entryPath);
result.setPathName("");
return result;
}
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryContents.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -138,29 +138,9 @@
return Collections.unmodifiableList(children);
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- if (path == null)
- throw new IllegalArgumentException("Null path");
-
- if ("".equals(path))
- return this;
-
- if (isJar)
- {
- initNestedJar();
- return njar.findChild(path);
- }
- else if (getEntry().isDirectory())
- {
- return structuredFindChild(path);
- }
- throw new FileNotFoundException("JarEntryContents(" + getName() + ") has no children");
- }
-
public VirtualFileHandler createChildHandler(String name) throws IOException
{
- return findChildHandler(name, false);
+ return findChildHandler(name, true);
}
public VirtualFileHandler getChild(String path) throws IOException
@@ -174,20 +154,15 @@
if (isJar)
{
initNestedJar();
- return njar.findChild(path);
+ return njar.getChild(path);
}
else if (getEntry().isDirectory())
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
return null;
}
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- return findChildHandler(name, true);
- }
-
/**
* Find the handler.
* TODO: synchronization on lazy entryMap creation
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/JarEntryHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -138,11 +138,6 @@
return Collections.unmodifiableList(entryChildren);
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
@Override
public InputStream openStream() throws IOException
{
@@ -151,19 +146,14 @@
public VirtualFileHandler createChildHandler(String name) throws IOException
{
- return findChildHandler(name, false);
+ return findChildHandler(name, true);
}
public VirtualFileHandler getChild(String path) throws IOException
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- return findChildHandler(name, true);
- }
-
/**
* Find the handler.
* TODO: synchronization on lazy entryMap creation
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NestedJarFromStream.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -103,10 +103,10 @@
return super.getChildren(ignoreErrors);
}
- public VirtualFileHandler findChild(String path) throws IOException
+ public VirtualFileHandler getChild(String path) throws IOException
{
init();
- return super.findChild(path);
+ return super.getChild(path);
}
protected void extraWrapperInfo(ZipEntryWrapper<byte[]> wrapper) throws IOException
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/NoCopyNestedJarHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -119,17 +119,6 @@
return getJar().getInputStream(getEntry());
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- if (path == null)
- throw new IllegalArgumentException("Null path");
-
- if ("".equals(path))
- return this;
-
- return njar.findChild(path);
- }
-
public VirtualFileHandler getChild(String path) throws IOException
{
if (path == null)
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/jar/SynthenticDirEntryHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -148,11 +148,6 @@
return Collections.unmodifiableList(entryChildren);
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
/**
* Create a child handler for the given name. This looks to the entryMap
* for an existing child.
@@ -164,19 +159,14 @@
*/
public synchronized VirtualFileHandler createChildHandler(String name) throws IOException
{
- return findChildHandler(name, false);
+ return findChildHandler(name, true);
}
public VirtualFileHandler getChild(String path) throws IOException
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- return findChildHandler(name, true);
- }
-
/**
* Find the handler.
* TODO: synchronization on lazy entryMap creation
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextFactory.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -194,7 +194,7 @@
MemoryContext ctx = registry.get(rootName);
if (ctx != null)
{
- MemoryContextHandler child = (MemoryContextHandler)ctx.findChild(ctx.getRoot(), url.getPath());
+ MemoryContextHandler child = (MemoryContextHandler)ctx.getChild(ctx.getRoot(), url.getPath());
MemoryContextHandler parent = (MemoryContextHandler)child.getParent();
return parent.deleteChild(child);
}
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/memory/MemoryContextHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -22,7 +22,6 @@
package org.jboss.virtual.plugins.context.memory;
import java.io.ByteArrayInputStream;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -78,11 +77,6 @@
return entryMap.remove(child.getName()) != null;
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
MemoryContextHandler getDirectChild(String name)
{
return entryMap.get(name);
@@ -103,22 +97,14 @@
*/
public VirtualFileHandler createChildHandler(String name) throws IOException
{
- VirtualFileHandler child = entryMap.get(name);
- if(child == null)
- throw new FileNotFoundException(this+" has no child: "+name);
- return child;
+ return entryMap.get(name);
}
public VirtualFileHandler getChild(String path) throws IOException
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- return entryMap.get(name);
- }
-
@Override
public boolean exists() throws IOException
{
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectory.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -118,7 +118,7 @@
AssembledDirectoryHandler dir = directory;
for (int i = 0; i < pkgs.length - 1; i++)
{
- AssembledDirectoryHandler next = (AssembledDirectoryHandler) dir.getChild(pkgs[i]);
+ AssembledDirectoryHandler next = (AssembledDirectoryHandler) dir.findChild(pkgs[i]);
if (next == null)
{
try
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledDirectoryHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -78,11 +78,16 @@
return handler;
}
- public VirtualFileHandler getChild(String name)
+ public VirtualFileHandler findChild(String name)
{
return childrenMap.get(name);
}
+ public VirtualFileHandler getChild(String path) throws IOException
+ {
+ return structuredFindChild(path);
+ }
+
public URI toURI() throws URISyntaxException
{
return getVfsUrl().toURI();
@@ -125,19 +130,6 @@
public VirtualFileHandler createChildHandler(String name) throws IOException
{
- VirtualFileHandler handler = childrenMap.get(name);
- if (handler == null)
- throw new IOException("Could not locate child: " + name);
- return handler;
- }
-
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
return childrenMap.get(name);
}
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledFileHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -49,7 +49,7 @@
throw new IOException("File cannot have children: " + this);
}
- public VirtualFileHandler findChild(String path) throws IOException
+ public VirtualFileHandler getChild(String path) throws IOException
{
throw new IOException("File cannot have children: " + this);
}
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledUrlStreamHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -47,7 +47,7 @@
protected URLConnection openConnection(URL url) throws IOException
{
String path = url.getPath();
- VirtualFileHandler vf = context.getRoot().findChild(path);
+ VirtualFileHandler vf = context.getRoot().getChild(path);
if (vf == null)
throw new IOException(path + " was not found in Assembled VFS context " + context.getName());
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/context/vfs/ByteArrayHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -99,11 +99,6 @@
throw new IOException("File cannot have children");
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- throw new IOException("File cannot have children");
- }
-
public VirtualFileHandler getChild(String path) throws IOException
{
throw new IOException("File cannot have children");
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/plugins/vfs/VirtualFileUrlStreamHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -62,7 +62,7 @@
throw new IOException(u.toString() + " does not belong to the same VFS context as " + baseRootUrl);
String path = urlString.substring(baseRootUrl.length());
- VirtualFileHandler vf = context.getRoot().findChild(path);
+ VirtualFileHandler vf = context.getRoot().getChild(path);
if (vf == null)
throw new IOException(path + " was not found in VFS context " + baseRootUrl);
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/protocol/vfsmemory/Handler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -47,7 +47,7 @@
if (ctx == null)
throw new IOException("vfs does not exist: " + u.toString());
- VirtualFile vf = ctx.findChild(ctx.getRoot(), u.getPath()).getVirtualFile();
+ VirtualFile vf = ctx.getChild(ctx.getRoot(), u.getPath()).getVirtualFile();
if (vf == null)
throw new IOException("vfs does not exist: " + u.toString());
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VFSContext.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -78,17 +78,6 @@
List<VirtualFileHandler> getChildren(VirtualFileHandler parent, boolean ignoreErrors) throws IOException;
/**
- * Find a child
- *
- * @param parent the parent
- * @param path the path
- * @return the child
- * @throws IOException for any problem accessing the VFS
- * @throws IllegalArgumentException for a null parent or name
- */
- VirtualFileHandler findChild(VirtualFileHandler parent, String path) throws IOException;
-
- /**
* Get a child
*
* @param parent the parent
Modified: projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/main/java/org/jboss/virtual/spi/VirtualFileHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -164,16 +164,6 @@
List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException;
/**
- * Find a child
- *
- * @param path the path
- * @return the child
- * @throws IOException for an error accessing the file system (or the child doesn't exist)
- * @throws IllegalStateException if closed
- */
- VirtualFileHandler findChild(String path) throws IOException;
-
- /**
* Get a child
*
* @param path the path
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockSimpleVirtualFileHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -48,15 +48,9 @@
super(context, parent, name);
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- throwIOException("findChild");
- return simpleFindChild(path);
- }
-
public VirtualFileHandler getChild(String path) throws IOException
{
throwIOException("getChild");
- return simpleFindChild(path, true);
+ return simpleFindChild(path);
}
}
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/support/MockStructuredVirtualFileHandler.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -49,11 +49,6 @@
super(context, parent, name);
}
- public VirtualFileHandler findChild(String path) throws IOException
- {
- return structuredFindChild(path);
- }
-
public VirtualFileHandler createChildHandler(String name) throws IOException
{
for (VirtualFileHandler child : getChildren(false))
@@ -61,21 +56,11 @@
if (name.equals(child.getName()))
return child;
}
- throw new IOException("Child not found: " + name + " for " + toURI());
+ return null;
}
public VirtualFileHandler getChild(String path) throws IOException
{
- return structuredGetChild(path);
+ return structuredFindChild(path);
}
-
- public VirtualFileHandler getChildHandler(String name) throws IOException
- {
- for (VirtualFileHandler child : getChildren(false))
- {
- if (name.equals(child.getName()))
- return child;
- }
- return null;
- }
}
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractMockVFSTest.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -275,7 +275,7 @@
VirtualFileHandler root = context.getRoot();
assertNotNull(root);
- VirtualFileHandler handler = context.findChild(root, path);
+ VirtualFileHandler handler = context.getChild(root, path);
assertNotNull(handler);
return handler;
}
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVFSContextTest.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -127,7 +127,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler found = context.findChild(root, "");
+ VirtualFileHandler found = context.getChild(root, "");
assertEquals(root, found);
}
@@ -135,7 +135,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler found = context.findChild(root, "child");
+ VirtualFileHandler found = context.getChild(root, "child");
assertEquals("child", found.getPathName());
}
@@ -143,7 +143,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler found = context.findChild(root, "subfolder");
+ VirtualFileHandler found = context.getChild(root, "subfolder");
assertEquals("subfolder", found.getPathName());
}
@@ -151,7 +151,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler found = context.findChild(root, "subfolder/subchild");
+ VirtualFileHandler found = context.getChild(root, "subfolder/subchild");
assertEquals("subfolder/subchild", found.getPathName());
}
@@ -161,8 +161,7 @@
VirtualFileHandler root = context.getRoot();
try
{
- context.findChild(root, "doesnotexist");
- fail("Should not be here!");
+ assertNull(context.getChild(root, "doesnotexist"));
}
catch (Throwable t)
{
@@ -175,7 +174,7 @@
VFSContext context = getVFSContext("complex");
try
{
- context.findChild(null, "");
+ context.getChild(null, "");
fail("Should not be here!");
}
catch (Throwable t)
@@ -190,7 +189,7 @@
VirtualFileHandler root = context.getRoot();
try
{
- context.findChild(root, null);
+ context.getChild(root, null);
fail("Should not be here!");
}
catch (Throwable t)
@@ -236,7 +235,7 @@
{
VFSContext context = getParentVFSContext();
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, path);
+ VirtualFileHandler child = context.getChild(root, path);
assertNotNull(child);
assertTrue(child.isLeaf());
assertEquals(fileName, child.getName());
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AbstractVirtualFileHandlerTest.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -69,7 +69,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
assertEquals("child", child.getName());
}
@@ -77,7 +77,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder");
+ VirtualFileHandler child = context.getChild(root, "subfolder");
assertEquals("subfolder", child.getName());
}
@@ -85,7 +85,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
+ VirtualFileHandler child = context.getChild(root, "subfolder/subchild");
assertTrue(child.getName().endsWith("subchild"));
}
@@ -100,7 +100,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
assertEquals("child", child.getPathName());
}
@@ -108,7 +108,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder");
+ VirtualFileHandler child = context.getChild(root, "subfolder");
assertEquals("subfolder", child.getPathName());
}
@@ -116,7 +116,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
+ VirtualFileHandler child = context.getChild(root, "subfolder/subchild");
assertEquals("subfolder/subchild", child.getPathName());
}
@@ -130,9 +130,9 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder/subsubfolder/subsubchild");
+ VirtualFileHandler child = context.getChild(root, "subfolder/subsubfolder/subsubchild");
assertEquals("subfolder/subsubfolder/subsubchild", child.getPathName());
- VirtualFileHandler parent = context.findChild(root, "subfolder/subsubfolder");
+ VirtualFileHandler parent = context.getChild(root, "subfolder/subsubfolder");
List<VirtualFileHandler> children = parent.getChildren(false);
// Filter out an .svn stuff since this is run from the source tree
Iterator<VirtualFileHandler> iter = children.iterator();
@@ -175,7 +175,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
long realLastModified = getRealLastModified("simple", "child");
assertEquals(realLastModified, child.getLastModified());
}
@@ -184,7 +184,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
@@ -209,7 +209,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
long realSize = getRealSize("simple", "child");
assertEquals(realSize, child.getSize());
}
@@ -218,7 +218,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
@@ -242,7 +242,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
assertTrue(child.isLeaf());
}
@@ -250,7 +250,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder");
+ VirtualFileHandler child = context.getChild(root, "subfolder");
assertFalse(child.isLeaf());
}
@@ -258,7 +258,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
+ VirtualFileHandler child = context.getChild(root, "subfolder/subchild");
assertTrue(child.isLeaf());
}
@@ -266,7 +266,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
@@ -292,7 +292,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
assertFalse(child.isHidden());
}
@@ -300,7 +300,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
@@ -317,7 +317,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
InputStream stream = child.openStream();
try
{
@@ -342,7 +342,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
@@ -366,7 +366,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
assertEquals(root, child.getParent());
}
@@ -374,7 +374,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
@@ -412,7 +412,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
@@ -429,7 +429,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler found = root.findChild("");
+ VirtualFileHandler found = root.getChild("");
assertEquals(root, found);
}
@@ -437,7 +437,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler found = root.findChild("child");
+ VirtualFileHandler found = root.getChild("child");
assertEquals("child", found.getPathName());
}
@@ -445,7 +445,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler found = root.findChild("subfolder");
+ VirtualFileHandler found = root.getChild("subfolder");
assertEquals("subfolder", found.getPathName());
}
@@ -453,7 +453,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler found = root.findChild("subfolder/subchild");
+ VirtualFileHandler found = root.getChild("subfolder/subchild");
assertEquals("subfolder/subchild", found.getPathName());
}
@@ -463,8 +463,8 @@
VirtualFileHandler root = context.getRoot();
try
{
- root.findChild("doesnotexist");
- fail("Should not be here!");
+ VirtualFileHandler child = root.getChild("doesnotexist");
+ assertNull(child);
}
catch (Throwable t)
{
@@ -478,7 +478,7 @@
VirtualFileHandler root = context.getRoot();
try
{
- root.findChild(null);
+ root.getChild(null);
fail("Should not be here!");
}
catch (Throwable t)
@@ -491,11 +491,11 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
- child.findChild("");
+ child.getChild("");
fail("Should not be here!");
}
catch (Throwable t)
@@ -515,7 +515,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
@@ -539,7 +539,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
checkVirtualFile(child);
}
@@ -547,7 +547,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder");
+ VirtualFileHandler child = context.getChild(root, "subfolder");
checkVirtualFile(child);
}
@@ -555,7 +555,7 @@
{
VFSContext context = getVFSContext("complex");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "subfolder/subchild");
+ VirtualFileHandler child = context.getChild(root, "subfolder/subchild");
checkVirtualFile(child);
}
@@ -563,7 +563,7 @@
{
VFSContext context = getVFSContext("simple");
VirtualFileHandler root = context.getRoot();
- VirtualFileHandler child = context.findChild(root, "child");
+ VirtualFileHandler child = context.getChild(root, "child");
child.close();
try
{
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/AssembledContextTest.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -21,14 +21,13 @@
*/
package org.jboss.test.virtual.test;
-import junit.framework.TestCase;
-
-import java.util.regex.Pattern;
import java.util.List;
+import java.util.regex.Pattern;
-import org.jboss.virtual.plugins.context.vfs.AssembledDirectory;
-import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
+import junit.framework.TestCase;
import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
+import org.jboss.virtual.plugins.context.vfs.AssembledDirectory;
/**
* comment
@@ -227,12 +226,10 @@
assertTrue("VirtualFile.class was found", found);
found = false;
- VirtualFile plugins = null;
for (VirtualFile child: children)
{
if (child.getName().equals("plugins"))
{
- plugins = child;
found = true;
break;
}
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/FileVFSUnitTestCase.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -130,10 +130,10 @@
ZipInputStream jis1 = new ZipInputStream(jf.getInputStream(jar1));
NestedJarFromStream njfs = new NestedJarFromStream(context, parent1.getRoot(), jis1, jar1URL, jf, jar1, "jar1.jar");
- VirtualFileHandler e1 = njfs.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
+ VirtualFileHandler e1 = njfs.getChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
assertNotNull(e1);
log.info("org/jboss/test/vfs/support/CommonClass.class: "+e1);
- VirtualFileHandler mfe1 = njfs.findChild("META-INF/MANIFEST.MF");
+ VirtualFileHandler mfe1 = njfs.getChild("META-INF/MANIFEST.MF");
assertNotNull("jar1!/META-INF/MANIFEST.MF", mfe1);
InputStream mfIS = mfe1.openStream();
Manifest mf = new Manifest(mfIS);
@@ -150,10 +150,10 @@
ZipInputStream jis2 = new ZipInputStream(jf.getInputStream(jar2));
NestedJarFromStream njfs2 = new NestedJarFromStream(context, parent2.getRoot(), jis2, jar2URL, jf, jar2, "jar2.jar");
- VirtualFileHandler e2 = njfs2.findChild("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
+ VirtualFileHandler e2 = njfs2.getChild("org/jboss/test/vfs/support/jar2/ClassInJar2.class");
assertNotNull(e2);
log.info("org/jboss/test/vfs/support/CommonClass.class: "+e2);
- VirtualFileHandler mfe2 = njfs2.findChild("META-INF/MANIFEST.MF");
+ VirtualFileHandler mfe2 = njfs2.getChild("META-INF/MANIFEST.MF");
assertNotNull("jar2!/META-INF/MANIFEST.MF", mfe2);
InputStream mf2IS = mfe2.openStream();
Manifest mf2 = new Manifest(mf2IS);
@@ -461,7 +461,7 @@
VFS vfs = VFS.getVFS(rootURL);
// Find ClassInJar1.class
- VirtualFile vf = vfs.findChild("jar1.jar");
+ VirtualFile vf = vfs.findChild("jar1.jar");
VirtualFile c1 = vf.findChild("org/jboss/test/vfs/support/jar1/ClassInJar1.class");
assertNotNull("ClassInJar1.class VF", c1);
log.debug("Found ClassInJar1.class: "+c1);
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/MemoryTestCase.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -80,7 +80,7 @@
List<VirtualFileHandler> list = desParent.getChildren(true);
assertNotNull(list);
assertFalse(list.isEmpty());
- assertNotNull(desParent.findChild("child"));
+ assertNotNull(desParent.getChild("child"));
}
public void testContextFactory()throws Exception
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VFSUnitTestCase.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -342,7 +342,7 @@
public void testGetVirtualFileURIIOExceptionFindChild() throws Exception
{
MockVFSContext context = registerSimpleVFSContextWithChildren();
- context.getMockRoot().setIOException("findChild");
+ context.getMockRoot().setIOException("getChild");
try
{
@@ -530,7 +530,7 @@
public void testGetVirtualFileURLIOExceptionFindChild() throws Exception
{
MockVFSContext context = registerSimpleVFSContextWithChildren();
- context.getMockRoot().setIOException("findChild");
+ context.getMockRoot().setIOException("getChild");
try
{
@@ -692,7 +692,7 @@
public void testFindChildIOException() throws Exception
{
MockVFSContext context = registerSimpleVFSContextWithChildren();
- context.getMockRoot().setIOException("findChild");
+ context.getMockRoot().setIOException("getChild");
try
{
Modified: projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java
===================================================================
--- projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java 2008-01-17 19:58:16 UTC (rev 69081)
+++ projects/vfs/trunk/src/test/java/org/jboss/test/virtual/test/VirtualFileUnitTestCase.java 2008-01-17 20:06:28 UTC (rev 69082)
@@ -1337,7 +1337,7 @@
public void testFindChildIOException() throws Exception
{
MockVFSContext context = registerSimpleVFSContextWithChildren();
- context.getMockRoot().setIOException("findChild");
+ context.getMockRoot().setIOException("getChild");
VirtualFile file = VFS.getRoot(context.getRootURI());
try
More information about the jboss-cvs-commits
mailing list