OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 25 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25 Rev 61
Line 20... Line 20...
20
import java.net.URLClassLoader;
20
import java.net.URLClassLoader;
21
import java.util.Map;
21
import java.util.Map;
22
import java.util.Properties;
22
import java.util.Properties;
23
import java.util.jar.JarFile;
23
import java.util.jar.JarFile;
24
 
24
 
-
 
25
import net.jcip.annotations.ThreadSafe;
-
 
26
 
25
/**
27
/**
26
 * A module factory created from a {@link ModulePackager packaged} module.
28
 * A module factory created from a {@link ModulePackager packaged} module.
27
 * 
29
 * 
28
 * @author Sylvain CUAZ
30
 * @author Sylvain CUAZ
29
 */
31
 */
-
 
32
@ThreadSafe
30
public final class JarModuleFactory extends ModuleFactory {
33
public final class JarModuleFactory extends ModuleFactory {
31
 
34
 
32
    private static Properties getProperties(final File jar) throws IOException {
35
    private static Properties getProperties(final File jar) throws IOException {
33
        final JarFile jarFile = new JarFile(jar);
36
        final JarFile jarFile = new JarFile(jar);
34
        return readAndClose(jarFile.getInputStream(jarFile.getEntry(ModulePackager.MODULE_PROPERTIES_PATH)));
37
        return readAndClose(jarFile.getInputStream(jarFile.getEntry(ModulePackager.MODULE_PROPERTIES_PATH)));
Line 82... Line 85...
82
        this.jar = jar;
85
        this.jar = jar;
83
    }
86
    }
84
 
87
 
85
    protected final URL[] getClassPath() {
88
    protected final URL[] getClassPath() {
86
        try {
89
        try {
-
 
90
            // File is immutable and URI is stack confined
87
            return new URL[] { this.jar.toURI().toURL() };
91
            return new URL[] { this.jar.toURI().toURL() };
88
        } catch (MalformedURLException e) {
92
        } catch (MalformedURLException e) {
89
            // shouldn't happen since we create the URL from an URI
93
            // shouldn't happen since we create the URL from an URI
90
            throw new IllegalStateException(e);
94
            throw new IllegalStateException(e);
91
        }
95
        }