private static JarFileSystem findJarFileSystem(File jarFile) { JarFileSystem retVal = null; @SuppressWarnings("deprecation") // keep for backward compatibility w/ NB 3.x Enumeration<? extends FileSystem> en = Repository.getDefault().getFileSystems(); while (en.hasMoreElements()) { FileSystem fs = en.nextElement(); if (fs instanceof JarFileSystem) { File fsJarFile = ((JarFileSystem) fs).getJarFile(); if (fsJarFile.equals(jarFile)) { retVal = (JarFileSystem) fs; break; } } } return retVal; }
protected Date lastModified(String name) { long t; if (name.length() == 0) { t = getJarFile().lastModified(); } else { try { t = getEntry(name).getTime(); } finally { closeCurrentRoot(false); } } return new Date(t); }
/** * Returns a FileObject representing an archive file containing the * FileObject given by the parameter. * <strong>Remember</strong> that any path within the archive is discarded * so you may need to check for non-root entries. * @param fo a file in a JAR filesystem * @return the file corresponding to the archive itself, * or null if <code>fo</code> is not an archive entry * @since 4.48 */ public static FileObject getArchiveFile(FileObject fo) { Parameters.notNull("fo", fo); //NOI18N try { FileSystem fs = fo.getFileSystem(); if (fs instanceof JarFileSystem) { File jarFile = ((JarFileSystem) fs).getJarFile(); return toFileObject(jarFile); } } catch (FileStateInvalidException e) { Exceptions.printStackTrace(e); } return null; }
public Permission getPermission() throws IOException { // Note this is normally called by URLClassPath with an unconnected // URLConnection, so the fo will probably be null anyway. if (fo != null) { File f = FileUtil.toFile(fo); if (f != null) { return new FilePermission(f.getAbsolutePath(), "read"); // NOI18N } try { FileSystem fs = fo.getFileSystem(); if (fs instanceof JarFileSystem) { return new FilePermission(((JarFileSystem) fs).getJarFile().getAbsolutePath(), "read"); // NOI18N } // [PENDING] could do XMLFileSystem too... } catch (FileStateInvalidException fsie) { // ignore } } // fallback return new FilePermission("<<ALL FILES>>", "read"); // NOI18N }
} else { if (!duplicateReported) { LOGGER.warning("Duplicate entries in " + getJarFile() + ": " + name + "; please report to JAR creator.");
File f = jfs.getJarFile();
private static JarFileSystem findJarFileSystem(File jarFile) { JarFileSystem retVal = null; Enumeration en = Repository.getDefault().getFileSystems(); while (en.hasMoreElements()) { FileSystem fs = (FileSystem)en.nextElement(); if (fs instanceof JarFileSystem) { File fsJarFile = ((JarFileSystem)fs).getJarFile(); if (fsJarFile.equals(jarFile)) { retVal = (JarFileSystem)fs; break; } } } return retVal; }
private static JarFileSystem findJarFileSystem(File jarFile) { JarFileSystem retVal = null; Enumeration en = Repository.getDefault().getFileSystems(); while (en.hasMoreElements()) { FileSystem fs = (FileSystem)en.nextElement(); if (fs instanceof JarFileSystem) { File fsJarFile = ((JarFileSystem)fs).getJarFile(); if (fsJarFile.equals(jarFile)) { retVal = (JarFileSystem)fs; break; } } } return retVal; }
final File zipFile = fileSystemDelegate.getJarFile(); final DateTime timestamp = new DateTime(zipFile.lastModified());
public Permission getPermission() throws IOException { // Note this is normally called by URLClassPath with an unconnected // URLConnection, so the fo will probably be null anyway. if (fo != null) { File f = FileUtil.toFile(fo); if (f != null) { return new FilePermission(f.getAbsolutePath(), "read"); // NOI18N } try { FileSystem fs = fo.getFileSystem(); if (fs instanceof JarFileSystem) { return new FilePermission(((JarFileSystem)fs).getJarFile().getAbsolutePath(), "read"); // NOI18N } // [PENDING] could do XMLFileSystem too... } catch (FileStateInvalidException fsie) { // ignore } } // fallback return new FilePermission("<<ALL FILES>>", "read"); // NOI18N }
public Permission getPermission() throws IOException { // Note this is normally called by URLClassPath with an unconnected // URLConnection, so the fo will probably be null anyway. if (fo != null) { File f = FileUtil.toFile(fo); if (f != null) { return new FilePermission(f.getAbsolutePath(), "read"); // NOI18N } try { FileSystem fs = fo.getFileSystem(); if (fs instanceof JarFileSystem) { return new FilePermission(((JarFileSystem)fs).getJarFile().getAbsolutePath(), "read"); // NOI18N } // [PENDING] could do XMLFileSystem too... } catch (FileStateInvalidException fsie) { // ignore } } // fallback return new FilePermission("<<ALL FILES>>", "read"); // NOI18N }
/** * Returns source root for given ClassPath root as String, or <code>null</code>. */ private static String getRoot(FileObject fileObject) { File f = null; String path = ""; try { if (fileObject.getFileSystem () instanceof JarFileSystem) { f = ((JarFileSystem) fileObject.getFileSystem ()).getJarFile (); if (!fileObject.isRoot()) { path = "!/"+fileObject.getPath(); } } else { f = FileUtil.toFile (fileObject); } } catch (FileStateInvalidException ex) { } if (f != null) { return f.getAbsolutePath () + path; } else { return null; } }
/** * Returns source root for given ClassPath root as String, or <code>null</code>. */ static String getRoot(FileObject fileObject) { File f = null; String path = ""; try { if (fileObject.getFileSystem () instanceof JarFileSystem) { f = ((JarFileSystem) fileObject.getFileSystem ()).getJarFile (); if (!fileObject.isRoot()) { path = "!/"+fileObject.getPath(); } } else { f = FileUtil.toFile (fileObject); } } catch (FileStateInvalidException ex) { } if (f != null) { return f.getAbsolutePath () + path; } else { return null; } }
/** * Returns a FileObject representing an archive file containg the * FileObject given by the parameter. * <strong>Remember</strong> that any path within the archive is discarded * so you may need to check for non-root entries. * @param fo a file in a JAR filesystem * @return the file corresponding to the archive itself, * or null if <code>fo</code> is not an archive entry * @since 4.48 */ public static FileObject getArchiveFile(FileObject fo) { try { FileSystem fs = fo.getFileSystem(); if (fs instanceof JarFileSystem) { File jarFile = ((JarFileSystem)fs).getJarFile(); return toFileObject(jarFile); } } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(e); } return null; }
File f = jfs.getJarFile(); if (f == null) return null; try {
/** * Returns a FileObject representing an archive file containg the * FileObject given by the parameter. * <strong>Remember</strong> that any path within the archive is discarded * so you may need to check for non-root entries. * @param fo a file in a JAR filesystem * @return the file corresponding to the archive itself, * or null if <code>fo</code> is not an archive entry * @since 4.48 */ public static FileObject getArchiveFile(FileObject fo) { try { FileSystem fs = fo.getFileSystem(); if (fs instanceof JarFileSystem) { File jarFile = ((JarFileSystem)fs).getJarFile(); return toFileObject(jarFile); } } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(e); } return null; }
File f = jfs.getJarFile(); if (f == null) return null; try {