Insane Programming Java ramblings and finds on the net

3Apr/120

Vaadin’s LoginForm UTF8-encoding

For those using Vaadin and have its security handled through the LoginForm class, there is something you need to know. When you're deploying on a standard servlet container, the encoding is set by default to ISO-8859-1 in accordance to the servlet specification. Not a big deal, you would say, as you've set the accept-charset in the form tag to UTF-8 and as such you would be able to handle UTF-8 characters.

Well, I found out this is not the case. If you would enter I£oveVaadin as a field value in the LoginForm, it sends IÄ£oveVaadin to the backing class handling the login. Which off course would break the security. Apparently, not all browsers (I tested FireFox and Chrome) send the charset to the server, in which case the server falls back to the default specification and converting the String back to ISO-8859-1, resulting in a somewhat different value.

Luckily, the solution is simple: either convert the String to UTF-8 yourself in your handler code (easily done through a simple static method, getBytes() and converting those bytes to a new UTF-8 String) or if you're using Spring and want a more robust solution, you can add the CharacterEncodingFilter to your web.xml, configure it for UTF-8 and map it to your Vaadin servlet. This will force UTF-8 encoding on any HTTP request to the Vaadin servlet. If you ask me, you should do this by default anyways. I know I will.

Happy coding!

Filed under: Frameworks No Comments
7Mar/120

Selling Scrum: creating a pricing strategy for Scrum projects

My CSM (Certified ScrumMaster) trainer is probably going to kill me after reading this title, as one of the things she kept repeating during the CSM course was that you don't sell Scrum, and as such, pricing strategies . You sell a product to a client, and Scrum is a means to an end to get that product to that client in the most efficient way possible for all parties involved. Scrum focuses on content, early delivery and providing as much value as fast as possible. It also factors in the certainty of change.

Filed under: Opinion Continue reading
9Feb/121

Java Coding Achievements

What do you do if a project isn't going as planned? Well, you could whine about it, or make the best out of it and see the funny side of things. Today, we decided to introduce our Java Coding Achievements. The goal is to get as much achievements per month.

30Jan/120

Combining Liquibase with Spring and JPA, revisited

In one of my previous articles, I described how you could combine Spring and Liquibase to make a schema self-updating JPA application. It has been a while since I wrote the article and a lot of things have changes. Both Spring and Liquibase have a new major version release out and a lot of API's have changed.

23Jan/126

Why I never use the Maven release plugin

Just about every 6 months or so an article appears cursing Maven, attracting both proponents as opponents to Maven and Ant. While it's real fun to watch (I really get a laugh when people start to advocate the return to Ant), most of the time it's always the same arguments. Maven lacks flexibility, the plugin system sucks (when will people learn to use plugin versions...), you can't use scripting and the all time favorite: the release plugin sucks. Well, I am a Maven addict and I'm happy to say: yes, I agree, the release plugin sucks. Big time. But here's something you may have forgotten: you don't need it! Even more: you shouldn't use it.

Filed under: Maven Continue reading
22Jan/125

Exploring Spring Integration 2.1

At my current assignment, one of the things that we do is reading XML files from an FTP site, do some magic on the contents and send the modified data to a REST service. If you've read some of my earlier posts, you've probably guessed this is done through an IBM product (Websphere Process Server). Given the fact that WPS is just an ESB with a BPM engine, I wanted to see how difficult it would be and how much faster I would be if I'd use an open source product for the ESB part (there's an article coming on the BPM part too). As I'm a real Spring fan, I decided to give Spring Integration (I'll refer to it as SI from now on) a go, as other products seemed a bit too much work to start with (Mule and ServiceMix have their own server implementation for starters...).

17Jan/120

Hibernate’s bidirectional @OneToOne and lazy loading

Just a small post now, about something I discovered when developing a JPA example project concerning one-to-one relationships and fetching them.

22Dec/113

Having fun with JSON and DbUnit, continued

The beauty of a blog like this is the fact that people read the articles and take the ideas in them to the next level. And that's exactly what Dan Haywood did.

He reused my JSONDataSet idea and combined it with JUnit 4's new Rule system to add configurable dataset loading to individual test methods. It's a basic, yet very functional implementation. But I thought, what the heck, let's take his idea a step further.

15Aug/117

Getting Hibernate out of your POJO’s

Anyone using Hibernate for the persistence layer in their program, knows that a JPA POJO contains traces of proxy class types from the Hibernate API. For example, if you have a one-to-many relationship between 2 entities expressed by a List in one of the entities, the corresponding implementation of that list when retrieving that object using Hibernate will be PersistentBag. The same goes for set, respectively represented by a PersistentSet. To-one lazy fetched object references are at runtime replaced with subclasses of the actual entity, which also implement Hibernate's lazy fetching. But so far for basic Hibernate POJO pollution.

5Aug/113

How to avoid taking the Big Blue pill

Intro

As a Java consultant, I come in contact with IBM products quite often. More often than I would personally hope. I'm not saying that IBM makes bad products, they have their merits, but more often than not the choice for IBM products is more out of corporate compliance than it is because of the technical needs of the projects than are built on top of the projects.

Currently, I'm working on a project that uses a whole lot of the IBM stack: the DB2 AS/400 database, IBM Websphere 6.1 and 7, IBM Process Server, IBM Portal Server on top of a Websphere 6.1 installation, all developed on either RAD (front-end and back-end) or WID (the processes). It shouldn't come as a surprise that setting up the development workspace is a couple of days worth of work. And then you can only hope you haven't forgotten to apply the patches and that the integration between all those products has gone flawlessly. Off course, this kind of setup also means that you need one hell of a development machine when you want to develop through the entire chain of the application. 2 Gb of memory is not an option here, folks.

This got me thinking, since the last project I was on was also mainly IBM based. Is the choice for IBM projects a valid one from a technical point of view, or are there cheaper, more developer-friendly and above all, technically rivalling products out there in the open source world, whilst still keeping up an enterprise-like reputation?