MCPcopy
hub / github.com/Col-E/Recaf / patchZipOutput

Method patchZipOutput

src/main/java/me/coley/recaf/util/VMUtil.java:329–337  ·  view source on GitHub ↗

Attempts to patch ZipOutputStream to prevent some tools from exploiting ZIP writing mechanism. @param zip Stream to patch.

(ZipOutputStream zip)

Source from the content-addressed store, hash-verified

327 * Stream to patch.
328 */
329 public static void patchZipOutput(ZipOutputStream zip) {
330 try {
331 Field field = ZipOutputStream.class.getDeclaredField("names");
332 field.setAccessible(true);
333 field.set(zip, new DiscardingSet());
334 } catch (NoSuchFieldException | IllegalAccessException ex) {
335 Log.error(ex, "Could not replace ZIP names");
336 }
337 }
338
339 /**
340 * A set that discards it's elements upon adding.

Callers 1

writeArchiveMethod · 0.95

Calls 2

errorMethod · 0.95
setMethod · 0.45

Tested by

no test coverage detected