Skip to content

Strange ClassCastException with AsyncTask

I was getting a pretty strange ClassCastException when calling execute on an AsyncTask. The exception was supposedly occurring at line 1 of the source file but this is impossible as line 1 is the package statement. The exception was being raised when the background thread called the doInBackground method which I then redirected to another method called doInBackground. The result was java.lang.ClassCastException: [Ljava.lang.Object;. That funny shaped class is, I’m pretty sure, the Object[] class.

After some digging I realized that this exception was happening because I was calling execute on a non-typesafe reference to an AsyncTask ie the reference had no generic parameters. I don’t think this should raise an exception but it looks like the Dalvik VM doesn’t like it. Alas. If you run into the same problem just make sure you’re calling execute on a type-safe reference.

SVN Connectors for Eclipse 3.5 (Galileo)

On a further note from the previous post, once you downgrade to Eclipse 3.5 you’ll likely want to install Subversive and the SVN connectors. Subversive is selectable from the Galileo update site and the SVN connectors for Galileo can be found at http://community.polarion.com/projects/subversive/download/eclipse/2.0/galileo-site/.

(This should be obvious from the documentation but the documentation is very poorly organized.)

Eclipse 3.6 and ADT

Yeah, it doesn’t work. Eclipse 3.6 with the ADT (Android Development Toolkit?) will frequently freeze and occasionally crash. Not sure why this is — as the author of several Eclipse plugins I can’t possibly imagine what a plugin could do to generate such behavior — but that’s the way it is… for your own sanity I strongly recommend downgrading to Eclipse 3.5 (Galileo!) in which all these problems disappear.

Git and Egit

If you followed the previous instructions on how to set up gitosis on Ubuntu you may also be curious how to make it work with Egit, the Eclipse git plugin. I was a bit confounded by this — Egit doesn’t have exactly the most intuitive UI — but after a bit of digging I discovered that it’s simply a matter of telling Egit where to find your SSH private key and setting up a .ssh/config file. This is described in Re: egit and RSA keys for SSH. Once this is done Egit will still prompt you for a password if your private key is configured with a password…

Links


TV is a Dinosaur, The Internet is a Meteor, Google TV is the Fallout

Strangely enough, TV probably won’t die, not for a very long time at least. But we will see something new, a big screen that isn’t so much a receiver as it is a browser. In a way this TV-as-browser will just be what Cable should’ve been all along.

Stop making social networks, Facebook won
Frankly I don’t think Facebook has done much of anything beyond building a very good email client. In the big picture this is just not terribly interesting.

Digg v4 Troubles are Symptom of a Bigger Problem
Some surprisingly conservative, old-media thinking comes out of the folks at Digg.

Micro Instances for Amazon EC2 announced!
$15/mo is pretty impressive for that much ram and I suspect this price will only come down. I guess cheap personal servers are coming, just not in the form that anybody imagined.

A Taste of What’s New in the Updated App Store License Agreement and New Review Guidelines
It’s a start though I very much doubt Apple can give up its controlling, bullying ways. At least not this easily.

Checking in with Facebook
It’s difficult to see checking in as a positive thing but, I guess, in another light, perhaps it’s just another kind of publishing.

Complexity and Grendel

Is complexity the key problem?

It’s somewhat difficult to believe. Frankly, most software systems out there simply aren’t that complex. Taking stuff out of the database and then putting it back is hardly brain surgery. Let’s face it: kids could do it.

And even the most complicated systems aren’t all that complex. There’s an important distinction between complex and complicated and while large software systems may be complicated as they involve many moving parts, integration points, and failure scenarios they are hardly complex like the weather or women and other phenomena that are truly unknowable and uncontrollable.

I’ve seen systems that are horribly difficult to understand and maintain but ultimately all of their behavior was fully captured in a precise set of computer instructions and this made it only a matter of time (sometimes months) before they could be handled.

And if complexity really was such a big problem you’d have to ask — well who’s fault at that? If software engineers are continually taking on more complexity than they can handle well, then, maybe they should stop doing that. Where’s the backlash, the drive for simplicity?

Perhaps “complexity” is just a code word, a vague way of admitting ignorance. And one does wonder what the programmers of the future who, undoubtedly, will be working on vastly more complicated systems, will think of such modern cries against complexity.

Links

Scaling OpenJPA applications with Slice
It’s an interesting idea but at that point you have to wonder if it’s time to revisit some basic architectural assumptions. I’d assume that this sort of abstraction would hardly be transparent after all…

Simplicity Is Highly Overrated
Questionable anecdotal “evidence” aside I don’t buy into the simplicity vs flexibility distinction. In the most successful systems simplicity and flexibility drive one another.

Developing for Android
It’s somewhat charming to see people harp on user experience so much… but really, would the iPhone have gone anywhere if it hadn’t had a great browser? I don’t think user experience is nearly that important.

Some random thoughts on programming
Perhaps complexity isn’t the problem. If complexity was the problem then one would expect that software systems developed today would be less successful than those developed in the past. Is that really the case?

Is Transactional Programming Actually Easier?
It makes a lot of sense. It’s not so much that transactions are easier to understand than locks — they’re likely not — it’s that they’re simply more composable.

Re-thinking JDK 7
It’s not even really a debate. Waiting another 2 years would be disastrous.

As Digg Struggles, VP Of Engineering Is Shown The Door
I find it very strange that a company like Digg couldn’t do sufficient load testing to get some idea of their scaling requirements. Heck, what else are these web mega-sites good for?

Secure your codebase: OpenVPN in the (Rackspace) Cloud
Good to know. Will need to play around with OpenVPN one of these days.

State of HTML5 canvas in QtWebKit
It’s great to see the Qt guys continuing to innovate so relentlessly. If only somebody had done this with desktop Java…

Follow

Get every new post delivered to your Inbox.