AnsweredAssumed Answered

Inline receipt issues

Question asked by aamrou on Mar 9, 2017
Latest reply on Nov 10, 2017 by juan.mendez

Good afternoon.

Inline receipts used to work for me but now they don't. I tried the code below and I always get a NullPointerException thrown by the various InlineReceiptUtil method calls.

I vaguely recall that something has changed sometime ago related to this, but my search is not very fruitful so far.

 

Here is the code I tried:

 

   @Test

    public void test1() {

        String URL = "https://www.univ.edu";

        String newURL = InlineReceiptUtil.addSuccessReceiptToUrl(URL, "Success Message");

        fail(newURL);

    }

   

    @Test

    public void test2() {

        String URL = "https://www.univ.edu";

        ReceiptOptions ro = new ReceiptOptions();

        ro.addSuccessMessage("Success Message");

        String newURL = InlineReceiptUtil.addReceiptToUrl(URL, ro);

        fail(newURL);

    }

   

    @Test

    public void test3() {

        String URL = "https://www.univ.edu";

        String newURL = InlineReceiptUtil.addErrorReceiptToUrl(URL, "Error Message");

        fail(newURL);

    }

 

 

    @Test

    public void test4() {

        String URL = "https://www.univ.edu";

        ReceiptOptions ro = new ReceiptOptions();

        ro.addErrorMessage("Error Message", new Exception("Error Exception"));

        String newURL = InlineReceiptUtil.addReceiptToUrl(URL, ro);

        fail(newURL);

    }

 

And here is partial stack trace from one of these tests:

blackboard.platform.RuntimeBbServiceException: java.lang.NullPointerException

at blackboard.platform.service.ServiceManagerImpl.safeLookupService(ServiceManagerImpl.java:491)

at blackboard.platform.service.ServiceManagerImpl.safeLookupService(ServiceManagerImpl.java:479)

at blackboard.platform.BbServiceManager.safeLookupService(BbServiceManager.java:341)

at blackboard.platform.context.ContextManagerFactory.getInstance(ContextManagerFactory.java:16)

at blackboard.platform.servlet.InlineReceiptUtil.addCoreReceipts(InlineReceiptUtil.java:392)

at blackboard.platform.servlet.InlineReceiptUtil.addReceiptToUrl(InlineReceiptUtil.java:370)

at blackboard.platform.servlet.InlineReceiptUtil.addReceiptToUrl(InlineReceiptUtil.java:352)

at blackboard.platform.servlet.InlineReceiptUtil.addSuccessReceiptToUrl(InlineReceiptUtil.java:302)

at NewEmptyJUnitTest.test1(NewEmptyJUnitTest.java:48)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

 

 

Line 48 of the code is the call to  InlineReceiptUtil.addSuccessReceiptToUrl(URL, "Success Message");

in the method test1(). All the other methods calls gave the same NullPointerException.

 

Any help is appreciated.

 

 

Thanks

Ashraf

Outcomes