Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

BlackBerry Device Software version 7.0 throws a NullPointerException when receiving an data push

Started 10-13-2011 by
Modified 01-26-2012 by

Symptoms

 

In BlackBerry® 7, an issue has been identified where, when receiving a data push, a NullPointerException may be thrown upon calling StreamConnection#close(). Depending on how the application is coded this may result in the data being lost.

Diagnosis

 

Affects:

  • BlackBerry smartphones running BlackBerry 7
  • BlackBerry Java® Applications

If an Java-based application utilizes data push has been tested to work fine in BlackBerry® Device Software versions prior to BlackBerry 7 but fails to receive data properly in BlackBerry 7 then this is likely the cause. Debugging this application would be the easiest way to confirm if a NullPointerException is thrown.

 

Note: This issue does not appear to affect BlackBerry® WebWorks™ applications that receive data pushes

 

You can track the status of this issue in Issue Tracker here: https://www.blackberry.com/jira/browse/JAVAAPI-2062

Solution

 

Until a fix is implemented into device code the workaround is to make use of the MDSPushInputStream as it is demonstrated in the HTTPPushDemo sample application. By calling MDSPushInputStream#accept() in the same manner shown in this sample, the following call to StreamConnection#close() should succeed.

 

The call to MDSPushInputStream#accept() will not alter the functionality of the application, this call simply responds back to the BlackBerry® Enterprise Server to acknowledge that the push was received. It is used for pushes that require application-level reliability. The added network traffic is minimal.

Contributors