JUnit4 Annotations and Ant Workaround

I usually use Maven for Java based projects, so my ant skills are a little rusty. Recently It was whipping up some JUnit negative test cases for someone else’s project that was a mess of ant build files (ugh). I decided to use some of the nifty annotation features found in JUnit 4.8.2 ( for rules and expected exception behavior). Annotations are great for addressing defects in the Java language, and help encapsulation by associating behavior directly with a class. But I digress… Anyway All the tests to check exceptions were thrown under negative test conditions looked good inside of Eclipse, but when I ran the ant test script from the command line, none of tests were being run encfprcomg the annotations, even though the JUnit jar was in the ant classpath! A little research showed that ant’s JUnit test runner doesn’t support annotations. The solution was to modify the suite() method of the AllTests class to wrap the classes under test in a JUnit4TestAdapter, i.e. something like this:

public class AllTests extends TestSuite {
	public static junit.framework.Test suite() {
	        return new JUnit4TestAdapter(TestSomething.class);

XML Encoding, UTF-8 / UTF-16 Confusion

Here’s a frustrating little problem I found when a service I deal with (we’ll call it SystemA for “Awesome”) suddenly changed character encoding…
My app was suddenly getting parse exceptions for XML messages after an upgrade to SystemA was deployed to a test environment. A peak at my logs showed the xml response looked funky, with extra spaces all throught it… no wonder my XML API went blooey:

< ? x m l v e r s i o n = ” 1 . 0 ” e n c o d i n g = ” U T F – 8 ” ? >

I blinked a little, then tried a copy paste from the log file to put into a bug note and got this little gem from textpad:

Cannot cut, copy, or drag and dtop text containing null (code = 0) characters.
Cannot cut, copy, or drag and dtop text containing null (code = 0) characters.


I opened the file up in a Hex Editor, and low and behold there were extra nulls chars all through it. Even though the xml header specified UTF-8, it looked like it was actually encoded in UTF-16.


Fix for ipad activation error, updating from expired 4.2 beta to newest beta

Shan's iPad
Shan\’s iPad

Yesterday I turned on my iPad and got the connect to itunes logo…I was a little freaked, but plugged her in to my workstation. I got a message that the ios 4.2 beta was expired and I need to update (yes, I AM a member of the Apple Developer Program).

I download the latest ios sdk, and tried to update via iTunes 10 using the iPad1,1_4.2_8C5101c ipsw . The update failed and I went into restore mode. Forgetting that downgrades are not supported, I tried to the default restore (3.2. something). Now I got an error 1015 on update… So next I restored the same ispw using iTunes again. Next I got an activation error stating the device was not registered in the developer program and to register the deviceid via the developers provision portal. I tried to go back to restore/DFU mode using the normal means (home & sleep button,etc), but it would not re-enter restore mode….it would go straight to the connect to iTunes screen. Once I connected back to iTunes, I got the same activation error again, with no way to get my deviceid from iTunes!


exsec32.dll or OLMAPI32.dll is incompatible” Error When Upgrading from Outlook 2007 to Outlook 2010

Ok, this was a nasty littler error I ran into when I needed to upgrade to Excel 2010 for a spreadsheet modeling class I was taking at Harvard. I bought the Academic Version of Office Professional 2010, then the chaos began.

IN SHORT: Upgrades from Outlook 2007 to 20010 seem to have issue as Outlook 2007 in not uninstalled when upgrading from Office 2007 to 2010 even though other Office applications (Word, Excel, etc. are uninstalled if i upgraded.)

MY SITUATION: Micfrosoft Office Enterprise 2007 installed on Window 7 64bit Professional (disclaimer: only booted into to play games or use Microsoft products outside of VMWare, otherwise I am a *Nix head!)

UPGRADE PATH: Microsoft Office Professional 2010 (Academic) upgrade performed.

I performed an upgrade rather than uninstalling 2007 and doing a fresh install of 2010 because I needed to keep some Office apps that are present in the Enterprise version that are not present in the Professional version (Visio, Project, and One Note). I figured the upgrade would install the 2007 apps included in the 2010 Professional Version (Word, Excel, PowerPoint, Outlook, etc.).

THE EXPECTED: All 2007 apps not present in the 2010 upgrade were left in place (Visio, Project, & Access) and worked with no problem.

Outlook 2007 was not uninstalled. When I triec to start the new Outlook it immediately crashed. If I started in safe mode like this:

“C:\Program Files (x86)\Microsoft Office\Office14\OUTLOOK.EXE” /safe

Outlook would start, but withn 2-30 seconds it would crash with a dll error such as:

“The file OLMAPI32.dll is incompatible with Microsoft Outlook. Install Outlook again” or “The file exsec32.dll is incompatible with Microsoft Outlook. Install Outlook again”

I tried re-upgrading to 2010 Professional again and rebooting. This did not resolve the issue. I tried repairing 2010 and this did not resolve the issue. After a bit of sleuthing I realized that Outlook 2007 had not been removed. I then decided to remove just Outlook 2007 from the Office 2007 Enterprise installation. Some people might not realize this can only be done by modifying The Office 2007 install… “Outlook 2007” is not going to be in your list of installed programs.

Uninstall like this in Windows 7:

To do this is Windows 7 you need to:

* Go to Control Panel
* Under the “Programs” heading Select “Uninstall a program”
* Right click on the “Microsoft Office Standard 2007 item in the resulting “Uninstall or change a program” window and select the ‘Change’ option per the image below:

You will  get the option to ‘Add or Remove’ Features’:

Click the radio button beside ‘Add or Remove Features” then click Continue.

As in the image below, X out the “Microsoft Office Outlook” application by clicking on the down arrow and selecting the ‘Not Available” option. Once X’d out, click on the Continue button:

Next you will see this Configuration Process Screen:

And then this success screen:

But don’t get excited yet… we’re not quite done. Reboot. Now we fix the dll error.

* Proceed again to the “Uninstall or change a program”  window (see first image above)
* Right click on “Microsoft Office 2010” in the list
* Select “Change” (as you can see in the first  picture above for Office 2007)
* Select the ‘Repair” option as pictured below then press “Continue”

This well be followed by the “Configuration Process” notification screen.

After this completed, Outlook 2010 was repaired and has functioned normally for some time now. The Office 2007 legacy apps (Visio, Project, etc.) configure to work without problems.