You need to sign in to do that
Don't have an account?
eto
@future handler: SF throws a java(!) nullpointer excpetion when calling Pagereference.getContent
I always get a NullPointerException in a @future-method when calling getContent. Here is a really easy example on how to reproduce this:
@future
public static void futureTest(){
System.debug('############################################FUTURE');
PageReference pdfPage = new PageReference( '/apex/test' );
//pdfPage.getParameters().put('id',billId);
System.debug(pdfPage);
Blob pdfblob = pdfPage.getContent(); //throws java nullpointer exception
}
<apex:page >
<!-- Begin Default Content REMOVE THIS -->
<h1>Congratulations</h1>
This is your new Page
<!-- End Default Content REMOVE THIS -->
</apex:page>
I tried to call it from a Button, which calls Apex code and from the execute anonymous feature in Eclipse. In both cases i get the Nullpointer.
Seems more to be a bug. If it's a non documented restriction I would expect to receive a apex exception instead of a java nullpointer.
Or am I missing something?