jodd-core/src/main/java/jodd/io/findfile/ClassScanner.java
protected void scanJarFile(final File file) {
		final ZipFile zipFile;
		try {
			zipFile = new ZipFile(file);
		} catch (IOException ioex) {
			if (!ignoreException) {
				throw new FindFileException("Invalid zip: " + file.getName(), ioex);
			}
			return;
		}
		final Enumeration entries = zipFile.entries();
		while (entries.hasMoreElements()) {
			final ZipEntry zipEntry = (ZipEntry) entries.nextElement();
			final String zipEntryName = zipEntry.getName();
			try {
				if (StringUtil.endsWithIgnoreCase(zipEntryName, CLASS_FILE_EXT)) {
					final String entryName = prepareEntryName(zipEntryName, true);
					final ClassPathEntry classPathEntry = new ClassPathEntry(entryName, zipFile, zipEntry);
					try {
						scanEntry(classPathEntry);
					} finally {
						classPathEntry.closeInputStream();
					}
				} else if (includeResources) {
					final String entryName = prepareEntryName(zipEntryName, false);
					final ClassPathEntry classPathEntry = new ClassPathEntry(entryName, zipFile, zipEntry);
					try {
						scanEntry(classPathEntry);
					} finally {
						classPathEntry.closeInputStream();
					}
				}
			} catch (RuntimeException rex) {
				if (!ignoreException) {
					ZipUtil.close(zipFile);
					throw rex;
				}
			}
		}
		ZipUtil.close(zipFile);
	}
protected void scanJarFile(final File file) {
		final ZipFile zipFile;
		try {
			zipFile = new ZipFile(file);
		} catch (IOException ioex) {
			if (!ignoreException) {
				throw new FindFileException("Invalid zip: " + file.getName(), ioex);
			}
			return;
		}
		final Enumeration entries = zipFile.entries();
		while (entries.hasMoreElements()) {
			final ZipEntry zipEntry = (ZipEntry) entries.nextElement();
			final String zipEntryName = zipEntry.getName();
			try {
				if (StringUtil.endsWithIgnoreCase(zipEntryName, CLASS_FILE_EXT)) {
					final String entryName = prepareEntryName(zipEntryName, true);
					final ClassPathEntry classPathEntry = new ClassPathEntry(entryName, zipFile, zipEntry);
					try {
						scanEntry(classPathEntry);
					} finally {
						classPathEntry.closeInputStream();
					}
				} else if (includeResources) {
					final String entryName = prepareEntryName(zipEntryName, false);
					final ClassPathEntry classPathEntry = new ClassPathEntry(entryName, zipFile, zipEntry);
					try {
						scanEntry(classPathEntry);
					} finally {
						classPathEntry.closeInputStream();
					}
				}
			} catch (RuntimeException rex) {
				if (!ignoreException) {
					ZipUtil.close(zipFile);
					throw rex;
				}
			}
		}
		ZipUtil.close(zipFile);
	}
protected void scanJarFile ( final File file ) { final ZipFile zipFile ; try { zipFile = new ZipFile ( file ) ; } catch ( IOException ioex ) { if ( ! ignoreException ) { throw new FindFileException ( "Invalid zip: " + file . getName ( ) , ioex ) ; } return ; } final Enumeration entries = zipFile . entries ( ) ; while ( entries . hasMoreElements ( ) ) { final ZipEntry zipEntry = ( ZipEntry ) entries . nextElement ( ) ; final String zipEntryName = zipEntry . getName ( ) ; try { if ( StringUtil . endsWithIgnoreCase ( zipEntryName , CLASS_FILE_EXT ) ) { final String entryName = prepareEntryName ( zipEntryName , true ) ; final ClassPathEntry classPathEntry = new ClassPathEntry ( entryName , zipFile , zipEntry ) ; try { scanEntry ( classPathEntry ) ; } finally { classPathEntry . closeInputStream ( ) ; } } else if ( includeResources ) { final String entryName = prepareEntryName ( zipEntryName , false ) ; final ClassPathEntry classPathEntry = new ClassPathEntry ( entryName , zipFile , zipEntry ) ; try { scanEntry ( classPathEntry ) ; } finally { classPathEntry . closeInputStream ( ) ; } } } catch ( RuntimeException rex ) { if ( ! ignoreException ) { ZipUtil . close ( zipFile ) ; throw rex ; } } } ZipUtil . close ( zipFile ) ; }
Scans classes inside single JAR archive. Archive is scanned as a zip file.
@see #onEntry(ClassPathEntry)
Scans classes inside single JAR archive . Archive is scanned as a zip file .