[ 
https://issues.apache.org/jira/browse/HADOOP-4760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652723#action_12652723
 ] 

tucu00 edited comment on HADOOP-4760 at 12/3/08 1:13 AM:
---------------------------------------------------------------------

The problem is in the {{Configuration.loadResource(...)}} method at:

{code}
      } else if (name instanceof InputStream) {
        try {
          doc = builder.parse((InputStream)name);
        } finally {
          ((InputStream)name).close();
        }
      }
{code}

the {{DocumentBuilder}} (the {builder} variable) {{parse(...)}} method closes 
the stream, making the {{close()}} in {{finally}} to fail.

Note that the failure does not happen with all stream classes, only with those 
that check that the stream is not closed before closing it (HDFS stream does 
that)


      was (Author: tucu00):
    The problem is in the {{Configuration.loadResource(...)}} method at:

{{
      } else if (name instanceof InputStream) {
        try {
          doc = builder.parse((InputStream)name);
        } finally {
          ((InputStream)name).close();
        }
      }
}}

the {{DocumentBuilder}} (the {builder} variable) {{parse(...)}} method closes 
the stream, making the {{close()}} in {{finally}} to fail.

Note that the failure does not happen with all stream classes, only with those 
that check that the stream is not closed before closing it (HDFS stream does 
that)

  
> Configuration addResource(InputStream) fails with HDFS streams
> --------------------------------------------------------------
>
>                 Key: HADOOP-4760
>                 URL: https://issues.apache.org/jira/browse/HADOOP-4760
>             Project: Hadoop Core
>          Issue Type: Bug
>          Components: conf
>         Environment: all
>            Reporter: Alejandro Abdelnur
>             Fix For: 0.20.0
>
>
> When adding an {{InputStream}} via {{addResource(InputStream)}} to a 
> {{Configuration}} instance, if the stream is a HDFS stream the 
> {{loadResource(..)}} method fails with {{IOException}} indicating that the 
> stream has already been closed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to