Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
kbrownx1
Posts: 2
Registered: ‎10-14-2009
My Device: Not Specified

Trouble reading JAD properties in MIDlet on Storm

 

 

 

 

I am having trouble reading JAD application properties in a MIDlet on BlackBerry Storm 9530. The test application I wrote is quite simple.  I have an array of property names, and for each I make a MIDlet.getAppProperty() call to obtain the value.

 

What is happening is this.  If I start out with just the properties that the JDE inserts into the JAD file, I can read all of these and list it on the display.  If I add a small number of custom properties, say 2, then these also display properly.  But at some point, when about 6-8 custom properties have been added, all the properties, including the RIM-xxxx properties that were previously visible now all return null.

 

 

I've checked the BlackBerry documentation and there seems to be a 4KB limit on jad files, but my jad file  is  <1KB.  Are there restrictions on the number of custom properties? 

 The test application is listed below:

---------------------------------------------------------------

 

 

 

/**
* JadProps.java
*
* (c) Research In Motion Limited, 2003-2004. Confidential and proprietary.
*/


import java.util.*;
import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.lang.*;

/**
*
* The application must extend the MIDlet class to allow the application management software to control the MIDlet.
*/
public class JadProps extends MIDlet
{

/**
* argv holds application property key names from the jad file.
*/
final String argv[] = {
"Manifest-Version",
"RIM-COD-Module-Name",
"RIM-COD-Module-Dependencies",
"MIDlet-Jar-Size",
"MIDlet-1",
"RIM-COD-Creation-Time",
"MIDlet-Jar-URL",
"RIM-COD-URL",
"RIM-COD-SHA1",
"RIM-COD-Size",
"MicroEdition-Configuration",
"MIDlet-Version",
"MIDlet-Description",
"MIDlet-Vendor",
"MicroEdition-Profile",
"RIM-MIDlet-Flags-1",
// The above are what JDE 4.7.0 adds to JAD file for each build.


// Custom properties start here
"XPP-Embed",
"XPP-Codebase",
"XPP-Filename",
"XPP-ContentServer-URL",
"XPP-TraceLog-URL",
"XPP-StreamBase",
"XPP-Player-Cache-State",
"XPP-Memory-Check",
// If I only include the above properties in the jad file,
// the jad file can be read in with MIDlet.getAppProperty().

"XPP-TraceLog-Level",
// As soon as I add this property, all the properties except
// for MIDlet-xxxx, MicroEdition-xxxx, and RIM-MIDlet-Flags-1
// become null, when I try to access with MIDlet.getAppProperty().
};


/**
* <p>The default constructor.
*/
public JadProps()
{
}

/**
* <p>Signals the MIDlet that it has entered the Active state.
*/
public void startApp()
{
new Thread() {
public void run() {
Form form = new Form("JAD PROPS");
StringItem si;
String prop;
// Display each property as
// i: propName=[propValue]
for (int i = 0; i < JadProps.this.argv.length; i++) {
String propName = JadProps.this.argv[i];
String propValue = JadProps.this.getAppProperty(propName);
prop = propName + "=[" + propValue + "]";

si = new StringItem("" + i + ": ", prop);
si.setLayout(Item.LAYOUT_NEWLINE_BEFORE | Item.LAYOUT_NEWLINE_AFTER);
form.append(si);
}

// This is just to provide a way out of the app.
final Command exit = new Command("Done", Command.OK, 0);
form.addCommand(exit);
form.setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
if (c == exit) {
JadProps.this.notifyDestroyed();
return;
}
}
});

// Make the form visible on the display.
Display.getDisplay(JadProps.this).setCurrent(form);
}
}.start();
return;
}

/**
* <p>Signals the MIDlet to stop and enter the Pause state.
*/
public void pauseApp()
{
}

/**
* <p>Signals the MIDlet to terminate and enter the Destroyed state.
* @param unconditional When set to true, the MIDlet must cleanup and release all resources. Otherwise, the MIDlet may
* throw a MIDletStateChangeException to indicate it does not want to be destroyed at this time.
*/
public void destroyApp(boolean unconditional)
{
}

}
---------------------------------------------------------------
The jad file used is this:

Manifest-Version: 1.0
RIM-COD-Module-Name: JadProps
RIM-COD-Module-Dependencies: net_rim_cldc
MIDlet-Jar-Size: 4029
MIDlet-1: JadProps,,JadProps
RIM-COD-Creation-Time: 1255493063
MIDlet-Jar-URL: JadProps.jar
RIM-COD-URL: JadProps.cod
RIM-COD-SHA1: 84 d6 ad ab f8 7e 7f 03 c1 9b f9 2d 00 b9 51 04 6a 7d 0a 57
RIM-COD-Size: 4452
MicroEdition-Configuration: CLDC-1.1
MIDlet-Version: 1.0.29
MIDlet-Name: JadProps
MIDlet-Description: Testing Jad Props on Storm
MIDlet-Vendor: xxxxxxx xxxxxx
MicroEdition-Profile: MIDP-2.0
RIM-MIDlet-Flags-1: 0
XPP-Codebase: http://xxx.xxxxxxx.com:80/xxxxx/xxxxxxxx/xxxxxxxxxxxxxxxx/
XPP-Embed: 6
XPP-Memory-Check: NOLOG
XPP-Filename: xxxxxxxx
XPP-ContentServer-URL: http://xxx.xxxxxxx.com:80/xxxxxxxxxxxxx/xx/xxxxxxxxxx
XPP-TraceLog-URL: http://xxx.xxxxxxx.com:80/xxxxxxxxxx/xxx/xxxxxxxxxx
XPP-StreamBase: rtsp://xxxxxxxxx.xxxxxxx.com:554/xxxxxxxx/xxxxxxxxxxx/
XPP-Player-Cache-State: 0
XPP-TraceLog-Level: WARN
XPP-TraceLog-Output: HTTP
---------------------------------------------------------------

 

 

Can anyone help me on why the properties all turn to null when I add one more custom property?

 

 Thanks.

 

 

Please use plain text.
New Developer
kbrownx1
Posts: 2
Registered: ‎10-14-2009
My Device: Not Specified

Re: Trouble reading JAD properties in MIDlet on Storm

I should mention that I am loading this application onto the Storm OTA via the browser by pointing to the URL of the jad file.
Please use plain text.
Developer
BBDeveloper
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Trouble reading JAD properties in MIDlet on Storm

Very interesting. Could you check with different devices and supported OS.

Use Search. "Accept Solution" If the problem is resolved.
Please use plain text.