List of usage examples for org.apache.commons.vfs FileSystemException initCause
public synchronized Throwable initCause(Throwable cause)
From source file:org.ofbiz.commons.vfs.ofbiz.OfbizComponentProvider.java
public FileObject findFile(FileObject base, String name, FileSystemOptions properties) throws FileSystemException { try {/*from w ww . java 2 s . c o m*/ //name = name.replaceAll("^ofbiz-component://", ""); int nameLength = name.length(); int componentNameStart = 16; while (componentNameStart < nameLength && name.charAt(componentNameStart) == '/') componentNameStart++; if (componentNameStart == nameLength) throw new IllegalArgumentException("Invalid name(" + name + ")"); int componentNameEnd = componentNameStart; while (componentNameEnd < nameLength && name.charAt(componentNameEnd) != '/') componentNameEnd++; if (componentNameEnd == nameLength) throw new IllegalArgumentException("Invalid name(" + name + ")"); int restStart = componentNameEnd; while (restStart < nameLength && name.charAt(restStart) == '/') restStart++; if (restStart == nameLength) throw new IllegalArgumentException("Invalid name(" + name + ")"); String componentName = name.substring(componentNameStart, componentNameEnd); URL location = FlexibleLocation.resolveLocation("component://" + componentName + "/."); FileObject ofbizBase = getContext().resolveFile(location.toString(), properties); return VFSUtil.toFileObject(ofbizBase.getFileSystem().getFileSystemManager(), ofbizBase.resolveFile(name.substring(restStart)).getURL().toString(), properties); } catch (Exception e) { FileSystemException fse = new FileSystemException(e.getMessage(), null, e); fse.initCause(e); throw fse; } }
From source file:org.ofbiz.commons.vfs.ofbiz.OfbizHomeProvider.java
public FileObject findFile(FileObject base, String name, FileSystemOptions properties) throws FileSystemException { //new Exception("findFile(" + base + ", " + name + ")").printStackTrace(); try {//w w w . jav a 2 s . c o m URL location = FlexibleLocation.resolveLocation("ofbizhome://."); FileObject ofbizBase = getContext().resolveFile(location.toString(), properties); return VFSUtil.toFileObject(ofbizBase.getFileSystem().getFileSystemManager(), ofbizBase.resolveFile(name.substring(13)).getURL().toString(), properties); } catch (Exception e) { FileSystemException fse = new FileSystemException(e.getMessage(), null, e); fse.initCause(e); throw fse; } }