All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ehoffman.resources.JbossVitualFileSystemWTFWorkAround Maven / Gradle / Ivy

The newest version!
package org.ehoffman.resources;

import java.io.File;
import java.io.IOException;
import java.net.URLConnection;

/**
 * https://issues.jboss.org/browse/JBVFS-147
 * @author rex
 */
public final class JbossVitualFileSystemWTFWorkAround {

    private JbossVitualFileSystemWTFWorkAround() {
    }

    public static File fixJbossesScrewUp(final URLConnection urlConnection) throws IOException {
        if (org.jboss.vfs.VirtualFile.class.isAssignableFrom(urlConnection.getContent().getClass())) {
            final org.jboss.vfs.VirtualFile vf = (org.jboss.vfs.VirtualFile) urlConnection.getContent();
            final File contentsFile = vf.getPhysicalFile();
            final File dir = contentsFile.getParentFile();
            return new File(dir, contentsFile.getName());
        }
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy