Code Room
Code reviewHardcr-g028
Subject Path traversalLevel Senior–Staff~30 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this Java archive-extraction utility.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
void unzip(InputStream in, File destDir) throws IOException {    try (ZipInputStream zis = new ZipInputStream(in)) {        ZipEntry e;        while ((e = zis.getNextEntry()) != null) {            File out = new File(destDir, e.getName());            out.getParentFile().mkdirs();            try (FileOutputStream fos = new FileOutputStream(out)) {                byte[] buf = new byte[8192];                int n;                while ((n = zis.read(buf)) != -1) fos.write(buf, 0, n);            }        }    }}
Run or narrate your approach, then ask the coach.