Freitag, 19. Februar 2010

Print stracktrace to BlackBerry eventlog

The BlackBerry Eventlog (accessable via ALT-LGLG on most devices) is great.
An application can log everything it wants starting from errors up to debug information. And: for uncaught exceptions a full stacktrace is written! Every wanted to use this in your app as well?

It isn't possible to access the stacktrace of an exception. ME does not know "getStackTrace()" there is only "printStackTrace()" which write to console only available for the exception classes. Also ME does not allow to redirect System.err or System.out to get to this information.
The only chance to see the stacktrace of a caught exception is to use printStackTrace() while in attached debugging mode.

But there is a nice trick to print the stacktrace directly to the eventlog: catch Throwable:

try
{
return instance.doAction();
}
catch(Throwable exc)
{
return false;
}

If an exceptions in doAction() occurs (as our best friend NullPointerException) it will be written by the system directly to eventlog. This won't happen if you catch Exception or RuntimeExcepion or more specific one.

Freitag, 5. Februar 2010

How to break Mobile Software

In the last days I tested a few apps from colleagues of mine. I found some nice bugs which I often found by doing similar actions, It didn't matter if this was an Android, iPone or Symbian app.
Somem years ago I saw a presentation of James A. Whittaker at a conference in Munich, this guy had so much fun in breaking software. He actually wrote some books about testing:
"How to Break Software" and "Hot to beak Security"

In the last days I had probably the same fun trying to break those mobile apps. Some tipps from the book can be applied also on mobile apps, some other things where different, so maybe it's time for:
"How to break Mobile Software"

Here are some things that worked for me:

(Mis)Use Copy and Paste
Most smartphone supports copy and paste nowadays. And with this nice feature you can start attacking all kinds of ui elements. Assume there is an input field with some limitation, this could be the lenght of characters allowed or characters that are forbidden to type. Try to paste illegal stuff into it. This often works and is a well known test-strategy on desktop applications. It's time for bringing it to mobile phones!

(Mis)use Multitouch
Since iPhone Multitouch is the next big thing for user interaction. But it's even better for an evil tester. Try hitting 2 elements at the same time, whether it 2 listeelements or 2 icons. Most applications are not designed to be protected against this. There is no deselect between the events so the app gets out of sync. Often a thread is started for an action and there is no synchronization that could stop this. Chances are high that you create strange effects on the app. And if the app get's into a strange situation for example overlapping menus: don't stop! This is your chance, now you have good chances to crash it and win by knock out.

(Mis)use Softkeyboard
Since the iPhone started a huge amount of devices came without any keyboard. They have so called soft keyboards that appears where needed on the screen. Try to get the keyboard at a point where it is not needed and use it. Maybe you can confuse the app.

(Mis)use Orientation changes
Accelerometers are more than a nice toy. But writing orientation aware apps isn't easy. Ever saw text falling out of it's boundary dialog? Try to rotate the device in the middle of an action, maybe you have the luck to find such a problem.

Donnerstag, 4. Februar 2010

BlackBerry JVM errors

More as a reminder for myself than a normal blog:

http://www.blackberry.com/developers/javaknowledge/general/kpa0307163334.shtml

good to know:
When you have one of those JVM whitescreen you can still use javaloader.
I could capture a screenshot and grab the eventlog.

Dienstag, 2. Februar 2010

Oracle and Microedition?

Just watched Oracles webcast about the upcoming Java strategy after acquisition of Sun:
http://oracle.com.edgesuite.net/ivt/4000/8104/9236/12630/lobby_external_flash_clean_480x360/default.htm
Best news for Java mobile developers: the plan is to merge ME and SE!
Best news of the day for me. 2 years ago at RIMs annual developer conference the head of Java development for BlackBerry said in a session this would never happen for their platform, so we'll see. Now there is a big player involved as well ;-)

It will obviously take a while but Google showed how to build a modern platform with Android based on Java SE. It will be interesting to see what will happen next.
Interesting: JavaFX and Netbeans are both part of the mobile strategy. It will be a thrilling year for mobile java world.


Here's the ME slide:

(c) Oracle 2010