Friday, June 17, 2011

Wednesday, March 2, 2011

Need BlackBerry 4.5 Simulator to start with app-param JvmDebugLocks enabled?

For some reason when running the BlackBerry 4.5 simulator (downloaded just a couple months ago), you may have some trouble setting app-param JvmDebugLocks that enables debugging of locks for concurrency.  JvmDebugLocks is a nice feature, because it detects interlocks among other things.  Well, if you add the text "/app-param=JvmDebugLocks" in your simulator startup script (such as defaultSimulator.bat), unfortunately the simulator may not start.  It will give a JVM error and complain about net_rim_font_system.cod in the simulator log file (such as 8300.xml-(YYYY-MM-DD).log).  Note that I'm not referring to the BlackBerry solution described here about specifying a language for your simulator, because recent simulators should come already with a valid language entry.  Instead, Platform.alx seems to have missing font files specified.  Open Platform.alx and change net_rim_font_system.cod to net_rim_font_latin_truetype.cod everywhere in the file.  That is assuming you're using a Latin font; otherwise change it to whichever file you want to use from your Java subfolder of simulator.  Start the simulator again and you should be good to go.

Tuesday, January 25, 2011

Nuggets of Testing Wisdom from Kent Beck on Software Engineering Radio

I really like this interview on Software Engineering Radio with Kent Beck by Martin Lippert: Episode 167: The History of JUnit and the Future of Testing with Kent Beck".  A few good tidbits:

  • Testing at different levels: In response to a question about the development of BDD (behavioral driven testing) in response to his TDD (test driven development), he mentions the importance of testing at different levels of code, from unit tests to behavioral or acceptance tests, suggesting that BDD is entirely compatible with and perhaps a refinement of TDD.
  • Flexibility and trade-offs: He recommends considering the cost or appropriateness of testing under different circumstances, an idea that again applies to testing at different levels.  Exploratory coding should probably not require a TDD approach, because short-term costs in exploratory coding are important.  I would argue this notion applies to creative processes in general -- brainstorming activities are more about volume than perfection.
  • Stories and DRY: He says of DRY (the principle don't repeat yourself), "I don't subscribe to [it] for test code because I want my tests to read like a story."  The story theme runs throughout the interview.

Friday, January 14, 2011

IOException with RecordStoreNotOpenException on RmsStorage.save() after RmsStorage.deleteAll()

If you see java.io.IOException caused by javax.microedition.rms.RecordStoreNotOpenException thrown while executing a save() in your J2ME Polish app, running for example in the Java ME emulator or also on real devices (BlackBerry, etc.), then you may be encountering the following problem.  Check if you have called deleteAll() previously.  RmsStorage (improperly, it seems) closes out the underlying record store when it performs a deleteAll(), so that subsequent calls to save() do not work.  If you do want to use deleteAll() to clear an old RmsStorage instance, the only solution I know of is to use a different instance after clearing the old one.
Copyright 2011 by William Cain