Commons IO
  1. Commons IO
  2. IO-113

FileUtils.readFileToString is not static

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.3.1
    • Component/s: Utilities
    • Labels:
      None

      Description

      FileUtils.readFileToString isn't static. It should be; since the constructor for FileUtils says "Instances should NOT be constructed in standard programming", this makes readFileToString unusable. Right now I'm using FileUtils.readBytesToByteArray(file).toString().

        Activity

        Hide
        Henri Yandell added a comment -

        I'm a moron - thanks for reporting this Raul.

        svn ci -m "IO-113 points out that readFileToString(File) was not static. hits self" src/
        Sending src/java/org/apache/commons/io/FileUtils.java
        Transmitting file data .
        Committed revision 504659.

        Show
        Henri Yandell added a comment - I'm a moron - thanks for reporting this Raul. svn ci -m " IO-113 points out that readFileToString(File) was not static. hits self " src/ Sending src/java/org/apache/commons/io/FileUtils.java Transmitting file data . Committed revision 504659.
        Hide
        Raul Acevedo added a comment -

        No worries, I'm just surprised someone didn't catch this earlier. Thanks!

        Show
        Raul Acevedo added a comment - No worries, I'm just surprised someone didn't catch this earlier. Thanks!
        Hide
        Stephen Colebourne added a comment -

        Problem is that the fix is binary incompatible
        It is source compatible though.

        Two choices:
        a) use a different method name
        b) produce 1.3.1 now with the binary incompatible change as 1.3 was only just completed

        Show
        Stephen Colebourne added a comment - Problem is that the fix is binary incompatible It is source compatible though. Two choices: a) use a different method name b) produce 1.3.1 now with the binary incompatible change as 1.3 was only just completed
        Hide
        Raul Acevedo added a comment -

        I would fix it in 1.3.1 with a binary incompatible change. One time pain for long term gain... It's really nice that all the methods are sensibly and compatibly named.

        However, it's easy for me to say, I'll go with whatever the wider community supports, especially those who are more aware of the impacts of a binary incompatible change.

        Show
        Raul Acevedo added a comment - I would fix it in 1.3.1 with a binary incompatible change. One time pain for long term gain... It's really nice that all the methods are sensibly and compatibly named. However, it's easy for me to say, I'll go with whatever the wider community supports, especially those who are more aware of the impacts of a binary incompatible change.
        Hide
        Henri Yandell added a comment -

        We could keep the instance method and make it deprecated. That would keep it binary incompatible.

        Show
        Henri Yandell added a comment - We could keep the instance method and make it deprecated. That would keep it binary incompatible.
        Hide
        Raul Acevedo added a comment -

        You mean keep it binary compatible? That works for me.

        Why does this class have a public constructor anyway?

        Show
        Raul Acevedo added a comment - You mean keep it binary compatible? That works for me. Why does this class have a public constructor anyway?
        Hide
        Henri Yandell added a comment -

        For tools that don't allow static invocation. Velocity was the main reason why we add an empty constructor with warnings not to use it to each XxxUtils class we have.

        Show
        Henri Yandell added a comment - For tools that don't allow static invocation. Velocity was the main reason why we add an empty constructor with warnings not to use it to each XxxUtils class we have.
        Hide
        Raul Acevedo added a comment -

        That's silly. I would have kept the API clean and made Velocity owners complain to the writers of that tool to fix it, since that is a bug in the tool. It shouldn't be reflected in the API.

        Anyway, thanks for the help! When will this fix be released?

        Show
        Raul Acevedo added a comment - That's silly. I would have kept the API clean and made Velocity owners complain to the writers of that tool to fix it, since that is a bug in the tool. It shouldn't be reflected in the API. Anyway, thanks for the help! When will this fix be released?
        Hide
        Stephen Colebourne added a comment -

        I think that we can probably get away with option (b) if we are quick enough.

        Show
        Stephen Colebourne added a comment - I think that we can probably get away with option (b) if we are quick enough.
        Hide
        Henri Yandell added a comment -

        I'll build a 1.3.1 tonight. It'll contain this issue and IO-112.

        Show
        Henri Yandell added a comment - I'll build a 1.3.1 tonight. It'll contain this issue and IO-112 .

          People

          • Assignee:
            Unassigned
            Reporter:
            Raul Acevedo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development