@Test public void testParseMissingPackageJson() { Map<String, Object> results = underTest.parsePackageJson(() -> getClass().getResourceAsStream("package-without-json.tgz")); assertThat(results, is(not(nullValue()))); assertThat(results.isEmpty(), is(true)); assertThat(results.size(), is(0)); }
public Map<String, Object> parsePackageJson(final Supplier<InputStream> supplier) { try (InputStream is = new BufferedInputStream(supplier.get())) { final CompressorStreamFactory compressorStreamFactory = new CompressorStreamFactory(); try (InputStream cis = compressorStreamFactory.createCompressorInputStream(GZIP, is)) { final ArchiveStreamFactory archiveFactory = new ArchiveStreamFactory(); try (ArchiveInputStream ais = archiveFactory.createArchiveInputStream(TAR, cis)) { return parsePackageJsonInternal(ais); } } } catch (Exception e) { log.debug("Error occurred while processing package.json, returning empty map to continue", e); return emptyMap(); } }
NpmPackageParser extends ComponentSupport { public Map<String, Object> parsePackageJson(final Supplier<InputStream> supplier) { try (InputStream is = new BufferedInputStream(supplier.get())) { final CompressorStreamFactory compressorStreamFactory = new CompressorStreamFactory(); try (InputStream cis = compressorStreamFactory.createCompressorInputStream(GZIP, is)) { final ArchiveStreamFactory archiveFactory = new ArchiveStreamFactory(); try (ArchiveInputStream ais = archiveFactory.createArchiveInputStream(TAR, cis)) { return parsePackageJsonInternal(ais); } } } catch (Exception e) { log.debug("Error occurred while processing package.json, returning empty map to continue", e); return emptyMap(); } } }
NpmPackageParser extends ComponentSupport { public Map<String, Object> parsePackageJson(final Supplier<InputStream> supplier) { try (InputStream is = new BufferedInputStream(supplier.get())) { final CompressorStreamFactory compressorStreamFactory = new CompressorStreamFactory(); try (InputStream cis = compressorStreamFactory.createCompressorInputStream(GZIP, is)) { final ArchiveStreamFactory archiveFactory = new ArchiveStreamFactory(); try (ArchiveInputStream ais = archiveFactory.createArchiveInputStream(TAR, cis)) { return parsePackageJsonInternal(ais); } } } catch (Exception e) { log.debug("Error occurred while processing package.json, returning empty map to continue", e); return emptyMap(); } }  }
NpmPackageParser extends ComponentSupport { public Map<String, Object> parsePackageJson(final Supplier<InputStream> supplier) { try (InputStream is = new BufferedInputStream(supplier.get())) { final CompressorStreamFactory compressorStreamFactory = new CompressorStreamFactory(); try (InputStream cis = compressorStreamFactory.createCompressorInputStream(GZIP, is)) { final ArchiveStreamFactory archiveFactory = new ArchiveStreamFactory(); try (ArchiveInputStream ais = archiveFactory.createArchiveInputStream(TAR, cis)) { return parsePackageJsonInternal(ais); } } } catch (Exception e) { log.debug("Error occurred while processing package.json, returning empty map to continue", e); return emptyMap(); } }  Map<String, Object> parsePackageJson(final Supplier<InputStream> supplier); }
NpmPackageParser extends ComponentSupport { public Map<String, Object> parsePackageJson(final Supplier<InputStream> supplier) { try (InputStream is = new BufferedInputStream(supplier.get())) { final CompressorStreamFactory compressorStreamFactory = new CompressorStreamFactory(); try (InputStream cis = compressorStreamFactory.createCompressorInputStream(GZIP, is)) { final ArchiveStreamFactory archiveFactory = new ArchiveStreamFactory(); try (ArchiveInputStream ais = archiveFactory.createArchiveInputStream(TAR, cis)) { return parsePackageJsonInternal(ais); } } } catch (Exception e) { log.debug("Error occurred while processing package.json, returning empty map to continue", e); return emptyMap(); } }  Map<String, Object> parsePackageJson(final Supplier<InputStream> supplier);  }