Sometimes, checking for NULL is not the correct thing to do. You need to fix the root cause which is causing the NPE.
However in this case, shouldn't you first do; assertNoNull(result); and then continue with the rest? On Sun, Jan 2, 2011 at 5:22 AM, <[email protected]> wrote: > Author: thilini > Date: Sat Jan 1 15:52:47 2011 > New Revision: 84695 > URL: http://wso2.org/svn/browse/wso2?view=rev&revision=84695 > > Log: > fix for possible NP Exception > > Modified: > > trunk/commons/qa/component-test-framework/components/mediators-script/src/test/java/org/wso2/carbon/mediator/script/test/InlineTest.java > > Modified: > trunk/commons/qa/component-test-framework/components/mediators-script/src/test/java/org/wso2/carbon/mediator/script/test/InlineTest.java > URL: > http://wso2.org/svn/browse/wso2/trunk/commons/qa/component-test-framework/components/mediators-script/src/test/java/org/wso2/carbon/mediator/script/test/InlineTest.java?rev=84695&r1=84694&r2=84695&view=diff > > ============================================================================== > --- > trunk/commons/qa/component-test-framework/components/mediators-script/src/test/java/org/wso2/carbon/mediator/script/test/InlineTest.java > (original) > +++ > trunk/commons/qa/component-test-framework/components/mediators-script/src/test/java/org/wso2/carbon/mediator/script/test/InlineTest.java > Sat Jan 1 15:52:47 2011 > @@ -46,10 +46,14 @@ > } else if (FrameworkSettings.STRATOS.equalsIgnoreCase("true")) > { > result = stockQuoteClient.stockQuoteClientforProxy("http://" > + FrameworkSettings.HOST_NAME + ":" + FrameworkSettings.HTTP_PORT + > "/services/" + FrameworkSettings.TENANT_NAME + "/", null, "IBM"); > } > - System.out.println(result); > - if (!result.toString().contains("MSFT")) { > - Assert.fail("Script mediator doesn't work"); > - log.error("Script mediator doesn't work"); > + > + if (result != null) { > + if (result.toString().contains("MSFT")) { > + System.out.println(result); > + } else { > + Assert.fail("Script mediator doesn't work"); > + log.error("Script mediator doesn't work"); > + } > } > > } > _______________________________________________ > Commons-commits mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/commons-commits > -- *Afkham Azeez* Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com, * * *Member; Apache Software Foundation; **http://www.apache.org/*<http://www.apache.org/> * email: **[email protected]* <[email protected]>* cell: +94 77 3320919 blog: **http://blog.afkham.org* <http://blog.afkham.org>* twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez> * linked-in: **http://lk.linkedin.com/in/afkhamazeez* * * *Lean . Enterprise . Middleware*
_______________________________________________ Carbon-dev mailing list [email protected] https://wso2.org/cgi-bin/mailman/listinfo/carbon-dev
