Commons Validator
  1. Commons Validator
  2. VALIDATOR-188

Extend ISBN validator to support smooth transition to ISBN-13 / EAN-13 standard

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0 Release
    • Fix Version/s: 1.4.0 Release
    • Component/s: Routines
    • Labels:
      None

      Description

      Hi,

      I just revised the ISBNValidator to support ISBN-13 / EAN-13 standards, which will begin its use on 2007 (see http://www.isbn.org/standards/home/isbn/transition.asp for more information).

      To support a smooth transition, I changed the isValid(String) method so that it can validate all ISBN-10, ISBN-13 and EAN-13 codes. In addition, I created methods for validating only ISBN-10, only EAN-13, or ISBN-13 / EAN-13 codes. This way, anyone could have support for
      the new standard by just changing the .jar file.

      Please note that I've changed a few method names, and you may want to check the code style to match the existing one (however I tried to follow it whenever I could).

      Regards,
      Gabriel Belingueres

      1. ISBNValidatorTest.java
        7 kB
        Gabriel Belingueres
      2. ISBNValidator.java
        9 kB
        Gabriel Belingueres

        Activity

        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Niall Pemberton made changes -
        Resolution Fixed [ 1 ]
        Assignee Niall Pemberton [ niallp ]
        Status Open [ 1 ] Resolved [ 5 ]
        Hide
        Niall Pemberton added a comment -

        Gabriel,

        First of all thanks for raising this issue (I wasn't aware of the ISBN-13 change until you brought it up) and for taking the time to supply patches.

        Sorry I didn't answer your points about targeting this for Validator 1.4 - must have slipped past my radar. Now Java 6 has been released[1] I believe it is Sun's intention to stop support for JDK 1.3 so IMO I don't believe it will be such a big issue for most people to have a minimum JDK 1.4 dependency. I have consulted on moving Validator's minimum JDK dependency[2] and I believe a year on from the poll I did JDK 1.3 usage will be much lower than the 25% it was then and will accelerate now JDK 1.3 is "end of life".

        ISBNValidator[3] has now been completly re-written with the check digit calculation factored out into separate routines [4] and (re-)using the new CodeValidator[5]. Although I didn't directly apply your patches - I did use your work in the re-write and appreciate you submitting the code in the first place.

        Thanks

        Niall

        [1] http://www.theserverside.com/news/thread.tss?thread_id=43434
        [2] http://tinyurl.com/udvrj
        [3] http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/routines/ISBNValidator.java
        [4] http://jakarta.apache.org/commons/validator/apidocs/org/apache/commons/validator/routines/checkdigit/package-summary.html
        [5] http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/routines/CodeValidator.java

        Show
        Niall Pemberton added a comment - Gabriel, First of all thanks for raising this issue (I wasn't aware of the ISBN-13 change until you brought it up) and for taking the time to supply patches. Sorry I didn't answer your points about targeting this for Validator 1.4 - must have slipped past my radar. Now Java 6 has been released [1] I believe it is Sun's intention to stop support for JDK 1.3 so IMO I don't believe it will be such a big issue for most people to have a minimum JDK 1.4 dependency. I have consulted on moving Validator's minimum JDK dependency [2] and I believe a year on from the poll I did JDK 1.3 usage will be much lower than the 25% it was then and will accelerate now JDK 1.3 is "end of life". ISBNValidator [3] has now been completly re-written with the check digit calculation factored out into separate routines [4] and (re-)using the new CodeValidator [5] . Although I didn't directly apply your patches - I did use your work in the re-write and appreciate you submitting the code in the first place. Thanks Niall [1] http://www.theserverside.com/news/thread.tss?thread_id=43434 [2] http://tinyurl.com/udvrj [3] http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/routines/ISBNValidator.java [4] http://jakarta.apache.org/commons/validator/apidocs/org/apache/commons/validator/routines/checkdigit/package-summary.html [5] http://svn.apache.org/viewvc/jakarta/commons/proper/validator/trunk/src/share/org/apache/commons/validator/routines/CodeValidator.java
        Hide
        Gabriel Belingueres added a comment -

        Hi,

        I've seen that this functionality will be included in version 1.4, which will be centered in eliminating the ORO dependency by migrating to Java 1.4. I have two arguments I can think that this may be not the best choice.

        1) From the business stand point, we have a window of opportunity that we must take advantage of. I don't personally know how much time it takes to make a new release, but if it is a period such as a month or so for each one, then waiting about two months for a functionality that is already coded doesn't make many sense to me.

        2) From a technical stand point, there are many places that will be reluctant to migrate to Java 1.4 for applications that are in production just because of the ISBN thing (though it may be a good excuse anyway) since they are basically just numeric calculations. There are many conservative managers following the philosophy "if it is not broken, don't fix it". Also, the current implementation of ISBN validator uses almost trivial examples of regular expressions, so migrating later to Java 1.4 regexp I don't see it like a big problem (as it could be the email validation code that uses specific Perl semantics in the regexps, then making it more difficult to migrate).

        Regards,
        Gabriel

        Show
        Gabriel Belingueres added a comment - Hi, I've seen that this functionality will be included in version 1.4, which will be centered in eliminating the ORO dependency by migrating to Java 1.4. I have two arguments I can think that this may be not the best choice. 1) From the business stand point, we have a window of opportunity that we must take advantage of. I don't personally know how much time it takes to make a new release, but if it is a period such as a month or so for each one, then waiting about two months for a functionality that is already coded doesn't make many sense to me. 2) From a technical stand point, there are many places that will be reluctant to migrate to Java 1.4 for applications that are in production just because of the ISBN thing (though it may be a good excuse anyway) since they are basically just numeric calculations. There are many conservative managers following the philosophy "if it is not broken, don't fix it". Also, the current implementation of ISBN validator uses almost trivial examples of regular expressions, so migrating later to Java 1.4 regexp I don't see it like a big problem (as it could be the email validation code that uses specific Perl semantics in the regexps, then making it more difficult to migrate). Regards, Gabriel
        Niall Pemberton made changes -
        Fix Version/s 1.4.0 [ 12312009 ]
        Niall Pemberton made changes -
        Component/s Routines [ 12311270 ]
        Gabriel Belingueres made changes -
        Field Original Value New Value
        Attachment ISBNValidatorTest.java [ 12334589 ]
        Attachment ISBNValidator.java [ 12334588 ]
        Hide
        Gabriel Belingueres added a comment -

        The modified ISBNValidator class and its test cases.

        Regards,
        Gabriel Belingueres

        Show
        Gabriel Belingueres added a comment - The modified ISBNValidator class and its test cases. Regards, Gabriel Belingueres
        Gabriel Belingueres created issue -

          People

          • Assignee:
            Niall Pemberton
            Reporter:
            Gabriel Belingueres
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development