[ 
https://issues.apache.org/jira/browse/ORC-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16365093#comment-16365093
 ] 

ASF GitHub Bot commented on ORC-301:
------------------------------------

Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/orc/pull/218#discussion_r168372882
  
    --- Diff: java/core/src/java/org/apache/orc/impl/ReaderImpl.java ---
    @@ -516,12 +516,13 @@ OrcTail buildEmptyTail() {
     
       protected OrcTail extractFileTail(FileSystem fs, Path path,
           long maxFileLength) throws IOException {
    -    FSDataInputStream file = fs.open(path);
    +    FSDataInputStream file = null;
         ByteBuffer buffer;
         OrcProto.PostScript ps;
         OrcProto.FileTail.Builder fileTailBuilder = 
OrcProto.FileTail.newBuilder();
         long modificationTime;
         try {
    --- End diff --
    
    Thank you for review, @prasanthj .
    Ya. I thought to use `try-with-resource` first, but it needs more change to 
print out the log at [Line 
610](https://github.com/apache/orc/pull/218/files#diff-90ceebe6c0bfa3e98b4536455a60b498R610).


> `extractFileTail` should open a file in `try` statement
> -------------------------------------------------------
>
>                 Key: ORC-301
>                 URL: https://issues.apache.org/jira/browse/ORC-301
>             Project: ORC
>          Issue Type: Bug
>          Components: Java
>    Affects Versions: 1.4.1
>            Reporter: Dongjoon Hyun
>            Priority: Major
>
> To prevent opened file leakage, we need to move the file open position.
> {code}
> --- a/java/core/src/java/org/apache/orc/impl/ReaderImpl.java
>        long maxFileLength) throws IOException {
> -    FSDataInputStream file = fs.open(path);
> +    FSDataInputStream file = null;
>      ByteBuffer buffer;
>      OrcProto.PostScript ps;
>      OrcProto.FileTail.Builder fileTailBuilder = 
> OrcProto.FileTail.newBuilder();
>      long modificationTime;
>      try {
> +      file = fs.open(path);
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to