Re: svn commit: r465375 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

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

Re: svn commit: r465375 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Jacopo Cappellato
Jacques,

I see a potential problem with this patch: I could be wrong but chances
are that the "rejected" variable could be null causing a NPE.
I'd suggest the following condition:

  -         if (rejected != null) {
  +         if (rejected != null && rejected.doubleValue() > 0) {

Jacopo

[hidden email] wrote:

> Author: jleroux
> Date: Wed Oct 18 14:31:38 2006
> New Revision: 465375
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=465375
> Log:
> Bug fix.
>
> Modified:
>     incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
>
> Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
> URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?view=diff&rev=465375&r1=465374&r2=465375
> ==============================================================================
> --- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
> +++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Wed Oct 18 14:31:38 2006
> @@ -1393,7 +1393,7 @@
>                  while (recIter.hasNext()) {
>                      GenericValue rec = (GenericValue) recIter.next();
>                      Double rejected = rec.getDouble("quantityRejected");
> -                    if (rejected != null) {
> +                    if (rejected.doubleValue() > 0) {
>                   return true;
>                      }
>                  }            
>

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r465375 - /incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

Jacques Le Roux
Administrator
Jacopo,

Sure you are right, why take the risk ?

In a previous bug fix I already changed
    if (rejected != null) {
to
     if (rejected.doubleValue() > 0) {

I change it to check null.

Thanks for you review.

Jacques

> Jacques,
>
> I see a potential problem with this patch: I could be wrong but chances
> are that the "rejected" variable could be null causing a NPE.
> I'd suggest the following condition:
>
>   -         if (rejected != null) {
>   +         if (rejected != null && rejected.doubleValue() > 0) {
>
> Jacopo
>
> [hidden email] wrote:
> > Author: jleroux
> > Date: Wed Oct 18 14:31:38 2006
> > New Revision: 465375
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=465375
> > Log:
> > Bug fix.
> >
> > Modified:
> >     incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
> >
> > Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
> > URL:
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?view=diff&rev=465375&r1=465374&r2=465375

> > ==============================================================================
> > --- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
> > +++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Wed Oct 18 14:31:38 2006
> > @@ -1393,7 +1393,7 @@
> >                  while (recIter.hasNext()) {
> >                      GenericValue rec = (GenericValue) recIter.next();
> >                      Double rejected = rec.getDouble("quantityRejected");
> > -                    if (rejected != null) {
> > +                    if (rejected.doubleValue() > 0) {
> >                  return true;
> >                      }
> >                  }
> >