#8 stronger FileUtil.findFile method

closed
Alwin Ibba
None
5
2005-09-30
2005-06-30
David Stern
No

The changes I submitted earlier did not work with a
file path containing spaces due to System.getResource
returning a URL (and encoding spaces as %20). The
changes affect FileUtil, FileResultFactory and
XMLResultFactory since I changed the method to throw
FileNotFoundException. My view on it is that as a
utility class, FileUtil should allow for full
recoverability. The patch also contains a few changes
to FileResultFactory involving removing the member
variable for the fileName String as I don't see a need
for it anymore due to the stronger findFile. I also
added something that you may not like (but that we find
useful in our project). I wanted the ability to add
values that cannot be expressed in a flat file, the
most common being an emptry string for NOT NULL
database columns.

Discussion

  • David Stern
    David Stern
    2005-06-30

     
    Attachments
  • Alwin Ibba
    Alwin Ibba
    2005-07-01

    • assigned_to: nobody --> aibba
     
  • Alwin Ibba
    Alwin Ibba
    2005-07-01

    Logged In: YES
    user_id=804648

    Ok, I applied this patch after some refactoring. There was
    an issue with JDK 1.3 (the method URLDecoder.decode(String
    s, String enc) was introduced with 1.4) which caused the
    build to break. I changed it to use the deprecated
    URLDecoder.decode(String s) method. This method uses the
    default encoding. This is a bit sloppy but the FileReader of
    FileResultSetFactory also uses the default encoding (it ever
    did), so this is ok for now (until we find a better solution).

    I like the label stuff. However I did some modifications. I
    replaced the term "label" with "template", I replaced
    "emptyString" with "defaultString" and introduced
    "defaultInteger". I also added a method to customize the
    templates and the $ marker and implemented some tests.
    Thanks for this, it's a nice feature.

    Please, when submitting a patch, run the build, run all
    tests (some were broken due to changed behaviour), write new
    tests for new features and update the JavaDocs when changing
    behaviour. I would really appreciate this, since it saves me
    a lot of time and work when integrating the patch.

    Kind regards,

    Alwin

     
  • Alwin Ibba
    Alwin Ibba
    2005-09-30

    • status: open --> closed