[ 
https://issues.apache.org/jira/browse/FLINK-6172?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15938379#comment-15938379
 ] 
Ted Yu commented on FLINK-6172:
-------------------------------

RandomAccessFile#length() may throw IOE.

DefaultFileRegion is only involved in this branch:
{code}
    if (ctx.pipeline().get(SslHandler.class) == null) {
      ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), 
ctx.newProgressivePromise());
{code}
not this branch:
{code}
    } else {
      lastContentFuture = ctx.writeAndFlush(new HttpChunkedInput(new 
ChunkedFile(raf, 0, fileLength, 8192)),
{code}

> Potentially unclosed RandomAccessFile in HistoryServerStaticFileServerHandler
> -----------------------------------------------------------------------------
>
>                 Key: FLINK-6172
>                 URL: https://issues.apache.org/jira/browse/FLINK-6172
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Priority: Minor
>
> {code}
>     try {
>       raf = new RandomAccessFile(file, "r");
>     } catch (FileNotFoundException e) {
>       StaticFileServerHandler.sendError(ctx, NOT_FOUND);
>       return;
>     }
>     long fileLength = raf.length();
> {code}
> raf should be closed in all possible execution paths.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to