09-15-2008 04:30 PM - edited 09-15-2008 04:34 PM
Hi,
I am trying to use the following method to build a list of installed modules. Using the Log statement, I have confirmed that there are 44 module groups. However the constructed String only shows 12 out of those. The 13th one is Truncated and nothing after that. I have tried to use String and StringBuffer both, but the behaiour is same in both.
This is strange. The source is below, Can any one of you pin-point, what looks unusual into it. I tried but the not able to catch the mistake.
private String getApplicationInfo()
{
StringBuffer sendableDeviceInfo = new StringBuffer() ;// 12. Installed Applications:
//================================================
CodeModuleGroup[] allModuleGroups = CodeModuleGroupManager.loadAll();
if (allModuleGroups != null && allModuleGroups.length > 0)
{
sendableDeviceInfo.append(" Applications Installed (" + allModuleGroups.length + ") :\r\n");
for (int nCounter = 1, nCtr2 = allModuleGroups.length - 1; nCtr2 >= 0; --nCtr2, ++nCounter){
// Log.error("For-" + nCounter, "nCtr2 => " + allModuleGroups[nCtr2].getName()) ;
// String sAppVersion = allModuleGroups[nCtr2].getVersion();
sendableDeviceInfo.append(" " + nCounter + ". " + allModuleGroups[nCtr2].getName());
sendableDeviceInfo.append("\r\n");}
}
sendableDeviceInfo.append("\r\n"); //================================================
return sendableDeviceInfo.toString() ;
}
Thanks,
09-16-2008 09:43 AM
09-16-2008 10:02 AM
How did you deterine the contents of the string? Did you write that to the log at
the end or view it with a different piece of code?
09-16-2008 10:43 AM
I am using Simulator for Blackberry8330 SmartPhone (CDMA) v4.3.0.124 (Platform)
I am Logging the generated string and then checking the string in Event Viewer (ALT+L+G+L+G). One thing I have noticed is that no matter if I use StringBuffer or String class, the String that is generated has the maximum length of 1560 characters (string.length()). Any thing that appears after that is truncated.
I tried to replace "\n" with ";", but no luck. I also tried to set the initial capacity of StringBuffer (whenever I used it instead of String) to 8192, but still no luck.
Is there any MaxSize concept, under some special circumstances ?
09-16-2008 02:56 PM
09-16-2008 03:03 PM
Log came into the scene finally, when I came to know that the application list I am trying to save in a Note is getting truncated. Then for debug purpose, I tried to dump the information in the Log.
BTW, how would you suggest to debug in such a scenario ?
Regards,
09-16-2008 03:04 PM
I'm routinely mailing myself 200k strings concatenated from little bits of status vectors and haven't seen a problem.
Early on, I had various throws that were truncating things but otherwise no problem. I'm not using stringbuffer
since this is non-critical code and I don't care about garbage.
If you are worried about the logging resources just try to send yourself mail but if you really logged
the length() result that should narrow down the problem location.
09-16-2008 03:15 PM
09-16-2008 05:41 PM
09-16-2008 06:58 PM