I tried using the Apache XMLConfiguration to save the settings of an application I am developing to XML format. When I used it with Java 1.5 it all worked perfectly; however if I tried using it with Java 1.6 I was getting the following exception.

After doing some search on google I found that this can be a problem with the xerces XML library (xercesImpl.jar). Checking the 3rd party libraries I am using in my project, I found a library that was using and distributing an earlier version of xercesImpl.jar.

I downloaded the latest version (2.91) of xercesImpl.jar from the Apache xerces project (http://xerces.apache.org/mirrors.cgi#binary) and replaced in the 3rd party library I was using the xercesImpl.jar file with the one I downloaded. Now everything seems to work fine, even in Java 1.6.  🙂

This is another script I found while cleaning up my hdd. Now, we all know that java .class files can be decompiled to (a version) of their source code. The first java decompiler out there is jad. I tried to decompile some of my class files using jad.exe, but I couldn’t find a way of decompiling multiple .class files at the same time. So instead of digging into the documentation, I decided to quickly create a script that allows me to decompile a number of .class files at the same time.

Here’s how it works! I created a VBScript that goes through a directory (and subdirectories) of .class files and creates a dos batch file. The dos batch file can now be used to run and actually decompile all the .class files!

The VBscript can be found under this link: Decompile_vbs.

You need to edit it and change the paths to the .class and source directories.

When you execute this file, it will create a dos batch file like this one: Example_decompile.batPlease note this batch file will be generated under the directory where jad.exe exists! You can now run this batch file, which will actually decompile the .class files.

It is time for spring cleaning my hard disk at home. I am sorting/deleting files that I no longer use. I will post here files that I do not need now, but might need in the future.

So… I found a small linux shell script  that individually compiles every java file in a directory and all its subdirectories. The code is:


for d in ls
javac $d/*.java > $d/compile.txt


The text file can be found here:  batchcompile

I recently wanted to redirect the output of Log4j to a JTextPane, so as to output messages to the JTextPane using a different color depending on the severity.

I spent some time searching for information and I quickly put together a small example. The following screenshot shows the output.


The source code is available here.

I recently installed eclipse 3.3 and Java 1.6. Today I tried to use SiTra (Simple Transformations in Java) but when I tried to compile it Java started complaining on the following methods of the SimpleTransformerImpl.java:

The error was something about java inconvertible types. I don’t know if it is the new version of eclipse or Java 1.6. Looks like for some reason the compiler doesn’t recognise that Rule.class is of type Class<? extends Rule<S, T>>, so as to call the public <S, T> T transform(Class<? extends Rule<S, T>> ruleType, S source)

A simple solution is to ct the Rule.class expression to Class (it sounds weird but it worked).

So the transform and transformAll methods become:

Alloy Analyzer v4.0 has been out for quite a while. Alloy v4.0 is an extension of the Alloy v 3.0 language (http://alloy.mit.edu/alloy4/quickguide/a4.html). More specifically parts of the concrete syntax of the language has changed (i.e. when invoking a predicate from within another predicate we now have to use brackets “pred1 [param1,param2,..]” instead of parentheses “pred 1(param1, param2,..)“. Also some of the properties of the language have changed (in MDA terms constraints on the metamodel, or well-formedness rules have changed). For example in Alloy 4 you are able to overload predicates, functions and fields. These are relatively small changes and it should be easy to accommodate them in UML2Alloy.

However, Alloy v4.0 has been developed from scratch and it is based on the kodkod model finder. The AST implementation has changed substantially and the convenience methods provided on the AST model elements are fine tuned for the Alloy compiler. For example Signature constructors are private and I couldn’t find a way to update the properties of Signatures (i.e. the Multiplicity of the Signature) after a Signature has been created.

Of course this is perfect if you have an Alloy model and you just want to parse, but not very convenient if you use an MDA approach to instantiate Alloy AST objects. For example in UML2Alloy you can change the Multiplicity of a Signature (i.e. change from set to some to enforce that some Signature instances will exist in the model). If you don’t have access to the Multiplicity attribute of the Signature class, after the object has been created, complicates the situation.

Moreover the AST class elements have been defined as final so there is no way you can override the Alloy v4.0 AST classes.

So, I spent almost 1 day evaluating the situation and trying to find a solution. One solution would be to create my own implementation of Alloy’s AST. Another would be to create wrapper classes of Alloy’s AST that will have pointers to the actual Alloy implementation.

Then I stepped back and thought about the siltation. Well, I already have a rather stable implementation that uses Alloy v3.0 AST. In Alloy v4.0 the AST has NOT changed. Just the concrete syntax. So the solution is easy.

Currently in UML2Alloy after the Alloy AST objects have been generated by SiTra, a visitor is used to create a text file that contains the Alloy model. So, all I have to do is use another visitor and override the methods that create the part of the model for which the concrete syntax has changed.

Today I finished a beta version of a simple java program that collects the statistics from a subversion repository. I have created a website for the program: http://www.freewebs.com/subvstats/

It currently works by checking the whole history of the repository, finding how many lines have been added/removed in each file by using the “svn diff” command and creating an HTML report.
A sample of the report can be found here: http://www.freewebs.com/subvstats/samplereport.html

The program should work for relatively small repositories. As soon as I have time I will document it more and generate more statistics. And yes, I am thinking of making it opensource, but not in its current state. I first need to find some time to document the code properly and have a stable version.

Keywords: Subversion, statistics, package, tool, program, software, java, subvstats.