Menu

#120 Spaces in Header and CsvBindByName.required

v1.0 (example)
closed
None
5
2023-11-24
2023-10-27
No

Using opencsv 5.7.1.

Before adding (required = true) to @CsvBindByName, my application worked irrespective of spaces around field names in the header line.

After adding (required = true), a CsvRequiredFieldEmptyException is raised if there are any spaces around that field name in the header line.

Discussion

  • Scott Conway

    Scott Conway - 2023-10-27

    Please send us a small test application, test csv file we can use to set up an experiment with to narrow down when the change occurred and the best fix? Something we can look at and say this worked in x.y version but fails in x.z version of opencsv.

    What version were you using previously? Very curious as most of the required logic was added in 2016-2017. I was trying to see what was added in the last six months and have not found anything yet.

     
  • James Saffery

    James Saffery - 2023-10-29

    Thank you. Please see attached. I started using opencsv about two years ago with version 5.5.2. I am now on version 5.7.1 but only just recently added (required = true) to some of the @CsvBindByName annotations. Normally I would upgrade to the latest version, but right now I have a corporate network issue that is blocking access to Maven.

     
  • James Saffery

    James Saffery - 2023-10-30

    I have now upgraded to 5.8, and see the same behaviour.

     
  • Scott Conway

    Scott Conway - 2023-11-05

    Thank you for your excellent example I was able to find the issue and I do have a fix for it. There are several places where we trim the field names just for such situations but we do not have a trim where we are checking for required fields - which happens as part of the reading of the header but before we safe off the field names.

    The fix is in FieldMapByNames.java and I already have it commited. I will not be creating a new version right away because I want to take your example and make a unit test out of it inside opencsv so if the trim is removed we have a failing test that will notify the remover they are doing something bad.

     
  • James Saffery

    James Saffery - 2023-11-06

    That's great. Thank you for the fix, and for opencsv in general, a very useful library. Would it be possible to give a rough indication of when the next version is likely to be released?

     
  • Scott Conway

    Scott Conway - 2023-11-07

    No promises but I am going to shoot for this weekend. I almost had it in last night but I was getting issues uploading it to sonatype (maven central repository) and I need to resolve that. The earliest I can see myself getting back on my home computer is Thursday but it will probably be this next weekend.

    You can clone the repo from sourceforge and build it yourself to test it out.

    Scott :)

     
  • James Saffery

    James Saffery - 2023-11-08

    Excellent, thank you!

     
  • Andrew Rucker Jones

    • status: open --> pending
    • assigned_to: Scott Conway
     
  • Scott Conway

    Scott Conway - 2023-11-12

    Hello James - sorry but this is going to have to be postponed. The Nexus Repository Manager code that is hosted for open source projects at oss.sonatype.org is no longer working so I cannot upload projects to maven central repository. I have a call scheduled with sonatype to figure out what the new way of doing things are because everything I am finding on the internet want me to install a repository manager on my laptop just to upload to maven central and then they want to upsell to the not free pro version :( hopefully there is something I am missing.

     
  • James Saffery

    James Saffery - 2023-11-12

    Hi Scott, Thanks for letting me know and good luck with the resolution.

     
  • Scott Conway

    Scott Conway - 2023-11-22

    I don't know what changed today other than the fact that I was taking screen shots of everything so I could file a Jira with sonatype but it worked and 5.9 has been released.

    :)

     
  • Scott Conway

    Scott Conway - 2023-11-22
    • status: pending --> closed
     
  • James Saffery

    James Saffery - 2023-11-24

    Awesome, thank you. Works perfectly.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.