jquery and java .properties files

I recently had a need to parse a Java .properties format file in Javascript, and couldn’t find a suitable library for it, so I hacked out this (actually I copied the regular expressions from a Perl implementation): /** * parse a string containing text in Java .properties file format, and convert it into a map […]

abstraction

Apparently somebody regards this as a ‘useful abstraction’: /** * Represents a zero length String */ public static final String EMPTY_STRING = ""; Myself, when I saw it, I thought “What other value is an empty String ever going to be?”

Note to self: JAXP Debugging

I’m investigating a problem with Gamut, since the current version doesn’t work properly when running in Java 6. The problem seems to be related to which XML implementation classes it loads through JAXP. Having worked out this much, I resorted (*gasp*) to reading the documentation, which pointed out the very useful system property jaxp.debug. Sure […]

tools of the trade

Don’t get me started on EJB. Anyway, I had a problem where a jboss.xml has a resource reference that is missing from its matching ejb-jar.xml. Visually scanning the files wasn’t getting me anywhere, since they contain at least 30 EJBs, of which 20 or so had the same resource reference in. I thought if they […]

BigDecimal equals might not be what you expect

import java.math.BigDecimal;   public class BigDecimalTest { public static void main(String[] args) { BigDecimal a = new BigDecimal("0"); BigDecimal b = new BigDecimal("0.0"); System.out.println(a.equals(b)); // => false System.out.println(a.compareTo(b) == 0); // => true } } BigDecimal in Java poses a small trap for the unwary, because its equals method doesn’t work how you might expect. […]

open source Java

Since the announcement last week, lots of people have been pondering over what the open source Java release will mean. As far as I can see, it’s almost entirely about improving acceptance in Linux. Distributions with strict restrictions on what licenses they can use, like Debian, will now be able to include Java. I use […]

testing socket timeouts

A while ago I wrote about a test server I had written to help test our systems against their external dependencies. And it has proved very useful. This week I was once again working on improvements to our external transaction handling, and while my test server was useful, we also wanted to test against the […]

default values for primitives

I’ve just spent a few hours trying to figure out a problem in our application. It turns out that the page I was looking at has a condition at the top where if the object ID in question is 0, it assumes that it hasn’t been set. This was a problem because I was trying […]

persisting HTTP sessions over restarts on JBoss 4.0.4

I spent another frustrating day delving into JBoss configuration this week, just to restore behaviour we want in our application. What we want to happen is that HTTP session attributes are ‘magically’ persisted when the server is shutdown, and restored when the server starts again. This means we can minimise disruption on our live service […]

More on database abstraction

Having complained about Rails not abstracting the database enough, I ran into the opposite problem at work. One of the deployment platforms for our main system is JBoss1, and we use CMP entity beans for most of the persistence. I encountered a problem where a bean is created, and then later in the same transaction […]