ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From loic.lefe...@bnpparibas.com
Subject Réf. : RE: Réf. : Re: Commons Validator
Date Thu, 07 Nov 2002 16:03:21 GMT

> I fail to see the problem here... Ant has two types of tasks. The core
tasks
> with no external dependencies (everything they need is either in Ant or
the
> Java Standard Library circa 1.1!), and the optional tasks which have
> additional external dependencies. There are many such external tasks.
>
> So your custom task can (and probably should!) use Commons Validator, and
> simply state that dependencies so that users of your task fetch it. The
> <script> task needs BSF and a BSF compatible scripting language JAR, and
> everything peachy.
>
> So no, Commons Validator will not become part of Ant, but that shouldn't
> stop you from using it! --DD

Yes, that's already done.

>
> PS: And if you really improved on the Commons Validator code, maybe you
> should contribute your code there...

Well it's just about 8% faster:
Here the optimization (but it's very simple and can be applied to the other methods)

    public static boolean isByteApache(String value) {
       return formatByteApache(value) != null;
    }

    public static Byte formatByteApache(String value) {
       Byte result = null;

       try {
          result = new Byte(value); // <-- assign is not needed!
       } catch (Exception e) {
       }

       return result;
    }


    public static final boolean isByte( String value )
    {
        try
        {
            new Byte( value );
            return true;
        }
        catch( Exception e )
        {
            return false;
        }
    }

Cheer,
Loïc

ps: don't have the time to make a patch (sorry)

>
> -----Original Message-----
> From: loic.lefevre@bnpparibas.com [mailto:loic.lefevre@bnpparibas.com]
> Sent: Thursday, November 07, 2002 9:22 AM
> To: ant-dev@jakarta.apache.org
> Subject: Réf. : Re: Commons Validator
>
>
> Well I'm currently working on JOE
> (http://joe-task.sourceforge.net/JOE-TASK.html)
> and I need some methods to tell me if a string is a byte
> or a long... Indeed, I can code them but I found the Commons
> Validator package which is part of jakarta so I thought this
> package could help other people as I need it.
> To tell you the trutt I've already coded those methods
> inspired on those in the Commons Validator, and they are faster ;-)
>
> Well, it is up to you...
> Loïc
>
> --
> To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
>
>
>




This message and any attachments (the "message") is
intended solely for the addressees and is confidential. 
If you receive this message in error, please delete it and 
immediately notify the sender. Any use not in accord with 
its purpose, any dissemination or disclosure, either whole 
or partial, is prohibited except formal approval. The internet
can not guarantee the integrity of this message. 
BNP PARIBAS (and its subsidiaries) shall (will) not 
therefore be liable for the message if modified. 

                ---------------------------------------------

Ce message et toutes les pieces jointes (ci-apres le 
"message") sont etablis a l'intention exclusive de ses 
destinataires et sont confidentiels. Si vous recevez ce 
message par erreur, merci de le detruire et d'en avertir 
immediatement l'expediteur. Toute utilisation de ce 
message non conforme a sa destination, toute diffusion 
ou toute publication, totale ou partielle, est interdite, sauf 
autorisation expresse. L'internet ne permettant pas 
d'assurer l'integrite de ce message, BNP PARIBAS (et ses
filiales) decline(nt) toute responsabilite au titre de ce 
message, dans l'hypothese ou il aurait ete modifie.


--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message