@Test public void correctlyHandleExpectedISO_8859_1Content() throws Exception { try (InputStream in = new ByteArrayInputStream("{\"name\":\"foo\",\"author\":\"bé\"}".getBytes(ISO_8859_1)); InputStreamReader reader = new InputStreamReader(in, ISO_8859_1); JsonParser jsonParser = jsonFactory.createParser(reader)) { NpmPublishParser underTest = new NpmPublishParser(jsonParser, tempBlobCreator, HASH_ALGORITHMS); assertThat(underTest.parse(NO_USER), notNullValue()); } }
public NpmPublishRequest parse(@Nullable final String currentUserId) throws IOException { try { NestedAttributesMap packageRoot = parsePackageRoot(); if(currentUserId != null && !currentUserId.isEmpty()) { updateMaintainer(packageRoot, currentUserId); } return new NpmPublishRequest(packageRoot, tempBlobs); } catch (Throwable t) { for (TempBlob tempBlob : tempBlobs.values()) { tempBlob.close(); } throw t; } }
NpmPublishParser extends ComponentSupport { public NpmPublishRequest parse(@Nullable final String currentUserId) throws IOException { try { NestedAttributesMap packageRoot = parsePackageRoot(); if(currentUserId != null && !currentUserId.isEmpty()) { updateMaintainer(packageRoot, currentUserId); } return new NpmPublishRequest(packageRoot, tempBlobs); } catch (Throwable t) { for (TempBlob tempBlob : tempBlobs.values()) { tempBlob.close(); } throw t; } } }
NpmPublishParser extends ComponentSupport { public NpmPublishRequest parse(@Nullable final String currentUserId) throws IOException { try { NestedAttributesMap packageRoot = parsePackageRoot(); if(currentUserId != null && !currentUserId.isEmpty()) { updateMaintainer(packageRoot, currentUserId); } return new NpmPublishRequest(packageRoot, tempBlobs); } catch (Throwable t) { for (TempBlob tempBlob : tempBlobs.values()) { tempBlob.close(); } throw t; } } NpmPublishParser(
      final JsonParser jsonParser,
      final BiFunction<InputStream, List<HashAlgorithm>, TempBlob> tempBlobCreator,
      final List<HashAlgorithm> hashAlgorithms); }
NpmPublishParser extends ComponentSupport { public NpmPublishRequest parse(@Nullable final String currentUserId) throws IOException { try { NestedAttributesMap packageRoot = parsePackageRoot(); if(currentUserId != null && !currentUserId.isEmpty()) { updateMaintainer(packageRoot, currentUserId); } return new NpmPublishRequest(packageRoot, tempBlobs); } catch (Throwable t) { for (TempBlob tempBlob : tempBlobs.values()) { tempBlob.close(); } throw t; } } NpmPublishParser(
      final JsonParser jsonParser,
      final BiFunction<InputStream, List<HashAlgorithm>, TempBlob> tempBlobCreator,
      final List<HashAlgorithm> hashAlgorithms); NpmPublishRequest parse(@Nullable final String currentUserId); }
NpmPublishParser extends ComponentSupport { public NpmPublishRequest parse(@Nullable final String currentUserId) throws IOException { try { NestedAttributesMap packageRoot = parsePackageRoot(); if(currentUserId != null && !currentUserId.isEmpty()) { updateMaintainer(packageRoot, currentUserId); } return new NpmPublishRequest(packageRoot, tempBlobs); } catch (Throwable t) { for (TempBlob tempBlob : tempBlobs.values()) { tempBlob.close(); } throw t; } } NpmPublishParser(
      final JsonParser jsonParser,
      final BiFunction<InputStream, List<HashAlgorithm>, TempBlob> tempBlobCreator,
      final List<HashAlgorithm> hashAlgorithms); NpmPublishRequest parse(@Nullable final String currentUserId); static final String NAME; }