in src/main/java/org/apache/sling/feature/cpconverter/handlers/slinginitialcontent/SlingInitialContentBundleEntryMetaDataCollector.java [83:114]
Set<SlingInitialContentBundleEntryMetaData> collectFromContextAndWriteTmpFiles() throws IOException {
final Manifest manifest = context.getManifest();
// create JAR file to prevent extracting it twice and for random access
try (OutputStream fileOutput = Files.newOutputStream(newBundleFile, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING);
JarOutputStream bundleOutput = new JarOutputStream(fileOutput, manifest)) {
Enumeration<? extends JarEntry> entries = jarFile.entries();
// first we collect all the entries into a set, collectedSlingInitialContentBundleEntries.
// we need it up front to be perform various checks in another loop later.
while (entries.hasMoreElements()) {
JarEntry jarEntry = entries.nextElement();
if (jarEntry.getName().equals(JarFile.MANIFEST_NAME)) {
continue;
}
if (!jarEntry.isDirectory()) {
extractFile(jarEntry, bundleOutput);
}
if (total.get() + BUFFER > TOOBIG) {
throw new IllegalStateException("Sling-Initial-Content: File content being unzipped is too big "
+ "(>" + FileUtils.byteCountToDisplaySize(TOOBIG) + "): " + context.getPath());
}
}
}
return collectedSlingInitialContentBundleEntries;
}