-
-
Notifications
You must be signed in to change notification settings - Fork 705
vfs: urls fail when real file system is not populated #226
Copy link
Copy link
Open
Description
Real FS when using jboss-vfs can be populated lazily and reflections can't find any class when it happens
quick & dirty workaround for this case is touch physical files before creating SystemDir
public Vfs.Dir createDir(URL url) throws Exception {
Object content = url.openConnection().getContent();
Class<?> virtualFile = ClasspathHelper.contextClassLoader().loadClass("org.jboss.vfs.VirtualFile");
java.io.File physicalFile = (java.io.File) virtualFile.getMethod("getPhysicalFile").invoke(content);
if ((boolean)virtualFile.getMethod("isDirectory").invoke(content)) {
for(Object virtFile: (List)virtualFile.getMethod("getChildrenRecursively").invoke(content)) {
virtualFile.getMethod("getPhysicalFile").invoke(virtFile);
}
}
String name = (String) virtualFile.getMethod("getName").invoke(content);
java.io.File file = new java.io.File(physicalFile.getParentFile(), name);
if (!file.exists() || !file.canRead()) file = physicalFile;
return file.isDirectory() ? new SystemDir(file) : new ZipDir(new JarFile(file));
}but I'm working now for more clear implementation of Vfs.Dir and Vfs.File with jboss-vfs backend
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels