[OFBiz] Dev - isEmail(String s) returns true if s = null !???

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[OFBiz] Dev - isEmail(String s) returns true if s = null !???

MPF-2

Hi,

I stumbelded over a bug in sequoia 0.8 that doesnt send order email. It has been fixed by by Si with 5649 including a note that I want to adress here

Any hints why
s = null;
bool = UtilValidate.isEmail(String s)

should be true?

I would say a "null" is a empty a Email-Adress and therefore no valid email adress . it should return false!

Therefore UtilValidate.java should look like this

defaultEmptyOK is false

Class UtilValidate.java
public static boolean isEmail(String s) {
- if (isEmpty(s)) return defaultEmptyOK;
+ if (isEmpty(s)) return false;


Should I open a Ticket in jira and submit the patch?


mit freundlichen GrĂ¼ssen/ Kind regards / muchos saludos
--
Dipl. Wirt.-Ing. Michael Pfurtscheller
zentric GmbH & Co. KG
mobil: +49-172-5457143
fon: +49-6101-556060
fax: +49-6101-556065
icq# 8724822
[hidden email]
http://www.zentric.com
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev

Reply | Threaded
Open this post in threaded view
|

Re: [OFBiz] Dev - isEmail(String s) returns true if s = null !???

David E. Jones

By default all of these UtilValidate methods use that defaultEmptyOK  
and that is set to true for pragmatic purposes. It makes the UI code  
MUCH MUCH more complicated any other way because we want to consider  
constraints such as isEmpty and isEmail as separate constraints that  
can have different messages and such.

If you don't want a field to be allowed to be empty, you check to see  
if it is empty explicitly. I don't think anyone would want to have a  
check for isEmail to implicitly also require it to not be empty  
because then there would be no way you could allow it to be empty,  
but require it to be an email.

This isn't a complicated thing. It is simply for pragmatic purposes,  
as pretty much everything is....

-David


On Oct 13, 2005, at 8:50 AM, [hidden email] wrote:

> Hi,
>
> I stumbelded over a bug in sequoia 0.8 that doesnt send order  
> email. It has been fixed by by Si with 5649 including a note that I  
> want to adress here
>
> Any hints why
> s = null;
> bool = UtilValidate.isEmail(String s)
>
> should be true?
>
> I would say a "null" is a empty a Email-Adress and therefore no  
> valid email adress . it should return false!
>
> Therefore UtilValidate.java should look like this
>
> defaultEmptyOK is false
>
> Class UtilValidate.java
> public static boolean isEmail(String s) {
> - if (isEmpty(s)) return defaultEmptyOK;
> + if (isEmpty(s)) return false;
>
>
> Should I open a Ticket in jira and submit the patch?
>
>
> mit freundlichen GrĂ¼ssen/ Kind regards / muchos saludos
> --
> Dipl. Wirt.-Ing. Michael Pfurtscheller
> zentric GmbH & Co. KG
> mobil: +49-172-5457143
> fon: +49-6101-556060
> fax: +49-6101-556065
> icq# 8724822
> mailto:[hidden email]
> http://www.zentric.com
>
>
> _______________________________________________
> Dev mailing list
> [hidden email]
> http://lists.ofbiz.org/mailman/listinfo/dev

 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev

smime.p7s (3K) Download Attachment