Author: thomas.diesler(a)jboss.com
Date: 2010-03-19 00:00:53 -0400 (Fri, 19 Mar 2010)
New Revision: 102602
Modified:
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
Log:
unregister vfsFile
Modified:
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
===================================================================
---
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-19
02:29:00 UTC (rev 102601)
+++
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-19
04:00:53 UTC (rev 102602)
@@ -55,7 +55,9 @@
{
try
{
- return adapt(org.jboss.vfs.VFS.getChild(url));
+ org.jboss.vfs.VirtualFile vfsFile = org.jboss.vfs.VFS.getChild(url);
+ VirtualFileAdaptor30 absFile = (VirtualFileAdaptor30)adapt(vfsFile);
+ return absFile;
}
catch (URISyntaxException ex)
{
@@ -77,13 +79,13 @@
return absFile;
// Accept the file for mounting
- Closeable closeable = null;
- if (acceptForMount((org.jboss.vfs.VirtualFile)other) == true)
+ Closeable mount = null;
+ if (acceptForMount(vfsFile) == true)
{
try
{
TempFileProvider tmp = TempFileProvider.create("osgimount-",
null);
- closeable = VFS.mountZip(vfsFile, vfsFile, tmp);
+ mount = VFS.mountZip(vfsFile, vfsFile, tmp);
}
catch (IOException ex)
{
@@ -92,7 +94,7 @@
}
// Register the VirtualFile abstraction
- absFile = new VirtualFileAdaptor30(vfsFile, closeable);
+ absFile = new VirtualFileAdaptor30(vfsFile, mount);
registry.put(vfsFile, absFile);
return absFile;
}
@@ -124,7 +126,7 @@
return adaptor.getDelegate();
}
- static void safeClose(VirtualFileAdaptor30 absFile)
+ static void unregister(VirtualFileAdaptor30 absFile)
{
registry.remove(absFile.getDelegate());
}
Modified:
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
===================================================================
---
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-19
02:29:00 UTC (rev 102601)
+++
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-19
04:00:53 UTC (rev 102602)
@@ -49,14 +49,14 @@
class VirtualFileAdaptor30 implements VirtualFile
{
private org.jboss.vfs.VirtualFile delegate;
- private Closeable closeable;
+ private Closeable mount;
private TempDir streamDir;
private File streamFile;
- VirtualFileAdaptor30(org.jboss.vfs.VirtualFile root, Closeable closeable)
+ VirtualFileAdaptor30(org.jboss.vfs.VirtualFile root, Closeable mount)
{
this(root);
- this.closeable = closeable;
+ this.mount = mount;
}
VirtualFileAdaptor30(org.jboss.vfs.VirtualFile delegate)
@@ -190,7 +190,7 @@
@Override
public InputStream openStream() throws IOException
{
- if (closeable != null)
+ if (mount != null)
return getStreamURL().openStream();
return delegate.openStream();
@@ -199,8 +199,8 @@
@Override
public void close()
{
- VFSUtils.safeClose(closeable);
- VFSAdaptor30.safeClose(this);
+ VFSUtils.safeClose(mount);
+ VFSAdaptor30.unregister(this);
if (streamFile != null)
{
streamFile.delete();