[
https://issues.apache.org/jira/browse/MBUILDCACHE-18?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17534172#comment-17534172
]
ASF GitHub Bot commented on MBUILDCACHE-18:
-------------------------------------------
cstamas commented on code in PR #10:
URL:
https://github.com/apache/maven-build-cache-extension/pull/10#discussion_r868869048
##########
src/main/java/org/apache/maven/buildcache/RemoteCacheRepositoryImpl.java:
##########
@@ -147,50 +157,33 @@ public void saveArtifactFile( CacheResult cacheResult,
@Nonnull
public Optional<byte[]> getResourceContent( String url ) throws IOException
{
- HttpGet get = new HttpGet( url );
try
{
LOGGER.info( "Downloading {}", url );
- HttpResponse response = httpClient.get().execute( get );
- int statusCode = response.getStatusLine().getStatusCode();
- if ( statusCode != HttpStatus.SC_OK )
- {
- LOGGER.info( "Cannot download {}, status code: {}", url,
statusCode );
- return Optional.empty();
- }
- try ( InputStream content = response.getEntity().getContent() )
- {
- return Optional.of( IOUtils.toByteArray( content ) );
- }
+ GetTask task = new GetTask( new URI( url ) );
+ transporter.get( task );
+ return Optional.of( task.getDataBytes() );
Review Comment:
Word of warning: unsure the data size here, but if not "heap friendly"
sized, this is OOM prone
> Use m-resolver transport layer instead of redefining another one
> ----------------------------------------------------------------
>
> Key: MBUILDCACHE-18
> URL: https://issues.apache.org/jira/browse/MBUILDCACHE-18
> Project: Maven Build Cache Extension
> Issue Type: Improvement
> Reporter: Guillaume Nodet
> Assignee: Guillaume Nodet
> Priority: Major
> Labels: pull-request-available
>
--
This message was sent by Atlassian Jira
(v8.20.7#820007)