Yes your patch will do the trick, thanks for the clarification. --Rajith
On Mon, Jun 2, 2014 at 10:30 PM, Rajith Siriwardena <raj...@wso2.com> wrote: > Hi Maninda, > > Yes if that is the case, setting up an empty String is the best option. > but then isn't it violates the null check we were having in the following > code. (I don't know why it was there btw) > > ## BamMediator.java > if(service == null) { return true; } > > > I haven't checked your patch. I'll check it and get back you. > > thanks, > --Rajith > > > On Mon, Jun 2, 2014 at 9:53 PM, Maninda Edirisooriya <mani...@wso2.com> > wrote: > >> Hi Rajith, >> >> Service field was a useful parameter when BAM mediator is used inside an >> API as I remember. And that field has to be there for the backward >> compatibility as well IMO. >> The problem is handling the NPE with a null check when executing* >> msgCtx.getAxisService().getName()*. >> There is no other way to prevent that exception other than handling it >> and setting an empty string as the service. (I have attached a possible >> patch which is not tested at all) >> The correct way to handle this issue IMO is by handling the null value >> from the Axis2 level. >> WDYT? >> >> Thanks. >> >> >> * Maninda Edirisooriya* >> Senior Software Engineer >> >> *WSO2, Inc.*lean.enterprise.middleware. >> >> *Blog* : http://maninda.blogspot.com/ >> *E-mail* : mani...@wso2.com >> *Skype* : @manindae >> *Twitter* : @maninda >> >> >> On Sat, May 31, 2014 at 2:56 AM, Rajith Siriwardena <raj...@wso2.com> >> wrote: >> >>> Hi, >>> $Subject. From the following code chunks, >>> >>> ---------------------------- BamMediator.java >>> AxisService service = msgCtx.getAxisService(); >>> if(service == null) >>> >>> { return true; } >>> // When this is not inside an API theses parameters should be there >>> if ((!service.getName().equals("__SynapseService")) && >>> (service.getParameter(ADMIN_SERVICE_PARAMETER) != null || >>> service.getParameter(HIDDEN_SERVICE_PARAMETER) != null)) { return true; } >>> >>> ---------------------------- PayloadDataBuilder.java >>> try >>> >>> { service = msgCtx.getAxisService().getName(); } >>> >>> catch (Exception e) >>> >>> { String errorMsg = "Error occurred while Service Name is extracted. " + >>> e.getMessage(); log.error(errorMsg, e); service = ""; } >>> >>> --------------------------- StreamDefinitionBuilder.java >>> attributes.add(new Attribute(BamMediatorConstants.SERVICE_NAME, >>> AttributeType.STRING)); >>> --------------------------- >>> >>> >>> if the it is invoked from a proxy the value of service = <proxy which it >>> is invoked> and it works. when it is invoked from a sequence service is >>> null and it ends there >>> >>> as a solution to that I have removed the parts which checks the service >>> and dropped it from sending with events. if it isn't violating any use >>> case, attached patch to the jira issue can be used as a fix. >>> >>> jira issue: https://wso2.org/jira/browse/BAM-1642 >>> >>> Thanks, >>> --Rajith >>> >>> -- >>> *Rajith Siriwardana* >>> Software Engineer >>> WSO2 Inc. ; http://wso2.com >>> *lean. enterprise. middleware* >>> >>> *www: **http://people.apache.org/~siriwardana >>> <http://people.apache.org/~siriwardana>* >>> >> >> > > > -- > *Rajith Siriwardana* > Software Engineer > WSO2 Inc. ; http://wso2.com > *lean. enterprise. middleware* > > ------------------------------------------------------ > *http://people.apache.org/~siriwardana > <http://people.apache.org/~siriwardana>* > -- *Rajith Siriwardana* Software Engineer WSO2 Inc. ; http://wso2.com *lean. enterprise. middleware* ------------------------------------------------------ *http://people.apache.org/~siriwardana <http://people.apache.org/~siriwardana>*
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev