/** * Set name of the ZIP/JAR file. * @param aRoot path to new ZIP or JAR file * @throws IOException if the file is not valid */ public void setJarFile(final File aRoot) throws IOException, PropertyVetoException { setJarFile(aRoot, true, true); }
/** Creates new JAR for a given JAR file. This constructor * behaves basically like: * <pre> * JarFileSystem fs = new JarFileSystem(); * fs.setJarFile(jar); * </pre> * but it is more effective in some situations. It does not open and * read the content of the jar file immediately. Instead * it waits until somebody asks for resources from inside the JAR. * * @param jar location of the JAR file * @since 7.34 */ public JarFileSystem(File jar) throws IOException { this(); try { setJarFile(jar, true, false); } catch (PropertyVetoException ex) { // cannot happen, setSystemName can throw the exception only // if the filesystem is already in Repository, which this one // is not. throw (IOException)new IOException().initCause(ex); } }
/** Initializes the root of FS. */ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject(); closeSync = new Object(); strongCache = null; softCache = new SoftReference<Cache>(null); aliveCount = 0; try { setJarFile(root); } catch (PropertyVetoException ex) { throw new IOException(ex.getMessage()); } catch (IOException iex) { ExternalUtil.log(iex.getLocalizedMessage()); } }
/** * Set name of the ZIP/JAR file. * @param aRoot path to new ZIP or JAR file * @throws IOException if the file is not valid */ public void setJarFile (final File aRoot) throws IOException, PropertyVetoException { setJarFile(aRoot, true); }
/** * Set name of the ZIP/JAR file. * @param aRoot path to new ZIP or JAR file * @throws IOException if the file is not valid */ public void setJarFile (final File aRoot) throws IOException, PropertyVetoException { setJarFile(aRoot, true); }
/** Initializes the root of FS. */ private void readObject (ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject (); closeSync = new Object(); strongCache = null; softCache = new SoftReference(null); aliveCount = 0; try { setJarFile (root); } catch (PropertyVetoException ex) { throw new IOException (ex.getMessage ()); } catch (IOException iex) { ExternalUtil.log (iex.getLocalizedMessage()); } }
/** Initializes the root of FS. */ private void readObject (ObjectInputStream ois) throws IOException, ClassNotFoundException { ois.defaultReadObject (); closeSync = new Object(); strongCache = null; softCache = new SoftReference(null); aliveCount = 0; try { setJarFile (root); } catch (PropertyVetoException ex) { throw new IOException (ex.getMessage ()); } catch (IOException iex) { ExternalUtil.log (iex.getLocalizedMessage()); } }
private static Version getVersion(File systemJarFile) { if (!systemJarFile.exists()) { return null; } try { JarFileSystem systemJar = new JarFileSystem(); systemJar.setJarFile(systemJarFile); Attributes attributes = systemJar.getManifest().getMainAttributes(); String version = attributes.getValue("Specification-Version"); // NOI18N if (version != null) { return new Version(version); } return null; } catch (IOException ex) { LOGGER.log(Level.INFO, null, ex); return null; } catch (PropertyVetoException ex) { LOGGER.log(Level.INFO, null, ex); return null; } }
} else if (file.getName().endsWith(".ear")) { JarFileSystem jfs = new JarFileSystem(); jfs.setJarFile(file); FileObject appXml = jfs.getRoot().getFileObject("META-INF/application.xml"); if (appXml != null) {