Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6447284

Properties.load()'s "remain open after returns" behavior is not documented in spec

XMLWordPrintable

    • b95
    • generic
    • generic

      Bill Pugh wrote:

      >> The current implementation of java.util.Properties.load(InputStream is)
      >> doesn't
      >> close the InputStream passed to it as an argument. However, this
      >> doesn't seem to be documented
      >> in the JavaDoc.
      >>
      >> This could cause a file to not be closed promptly, which can cause real
      >> problems in some
      >> configurations.
      >>
      >> It seems to me that at a minimum, it should be documented whether or
      >> not it closes it.
      >> If we had it to do over again, it should probably close its argument,
      >> but I suspect it is too late
      >> in the game to change that.
      >>
      >> In general, I think the appropriate design is that any method that
      >> exhaustively reads an
      >> InputStream or Reader should close it. Would you agree?
      >>
      >> Bill

            sherman Xueming Shen
            sherman Xueming Shen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: