You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Hans Bakker <ma...@antwebsystems.com> on 2009/06/08 08:03:49 UTC

Re: svn commit: r782530 - /ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java

Anil, please look at my earlier commit.....

i do not even think that your change alone does not solve the
problem.....the problem is not the context but the record not having a
status.....

regards,
Hans


On Mon, 2009-06-08 at 05:35 +0000, apatel@apache.org wrote:
> Author: apatel
> Date: Mon Jun  8 05:35:18 2009
> New Revision: 782530
> 
> URL: http://svn.apache.org/viewvc?rev=782530&view=rev
> Log:
> Fix NPE if statusId is not passed to service.
> 
> Modified:
>     ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
> 
> Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=782530&r1=782529&r2=782530&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java (original)
> +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java Mon Jun  8 05:35:18 2009
> @@ -306,7 +306,7 @@
>              return ServiceUtil.returnError(UtilProperties.getMessage(resource, "person.update.write_failure", new Object[] { e.getMessage() }, locale));
>          }
>          
> -        if (!context.get("statusId").equals(oldStatusId)) {
> +        if (UtilValidate.isNotEmpty(context.get("statusId")) && !context.get("statusId").equals(oldStatusId)) {
>              try {
>                  dispatcher.runSync("setPartyStatus", UtilMisc.toMap("partyId", partyId, "statusId", context.get("statusId"), "userLogin", context.get("userLogin")));
>              } catch (GenericServiceException e) {
> 
> 
-- 
Antwebsystems.com: Quality OFBiz services for competitive rates


Re: svn commit: r782530 - /ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Hans

I think Anil got it right, the reported NPE was caused by the passed  
in statusId being null, not the party's statusId prior to update.  The  
statusId parameter is optional and should be checked for null before  
being used.

Regards
Scott

On 8/06/2009, at 6:03 PM, Hans Bakker wrote:

> Anil, please look at my earlier commit.....
>
> i do not even think that your change alone does not solve the
> problem.....the problem is not the context but the record not having a
> status.....
>
> regards,
> Hans
>
>
> On Mon, 2009-06-08 at 05:35 +0000, apatel@apache.org wrote:
>> Author: apatel
>> Date: Mon Jun  8 05:35:18 2009
>> New Revision: 782530
>>
>> URL: http://svn.apache.org/viewvc?rev=782530&view=rev
>> Log:
>> Fix NPE if statusId is not passed to service.
>>
>> Modified:
>>    ofbiz/trunk/applications/party/src/org/ofbiz/party/party/ 
>> PartyServices.java
>>
>> Modified: ofbiz/trunk/applications/party/src/org/ofbiz/party/party/ 
>> PartyServices.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/src/org/ofbiz/party/party/PartyServices.java?rev=782530&r1=782529&r2=782530&view=diff
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- ofbiz/trunk/applications/party/src/org/ofbiz/party/party/ 
>> PartyServices.java (original)
>> +++ ofbiz/trunk/applications/party/src/org/ofbiz/party/party/ 
>> PartyServices.java Mon Jun  8 05:35:18 2009
>> @@ -306,7 +306,7 @@
>>             return  
>> ServiceUtil.returnError(UtilProperties.getMessage(resource,  
>> "person.update.write_failure", new Object[] { e.getMessage() },  
>> locale));
>>         }
>>
>> -        if (!context.get("statusId").equals(oldStatusId)) {
>> +        if (UtilValidate.isNotEmpty(context.get("statusId")) && ! 
>> context.get("statusId").equals(oldStatusId)) {
>>             try {
>>                 dispatcher.runSync("setPartyStatus",  
>> UtilMisc.toMap("partyId", partyId, "statusId",  
>> context.get("statusId"), "userLogin", context.get("userLogin")));
>>             } catch (GenericServiceException e) {
>>
>>
> -- 
> Antwebsystems.com: Quality OFBiz services for competitive rates
>